I'm trying to join two or more files together.
For each new file to add I call this function:
void MainWindow
::mergemp3(QString fname
) //fname is the new file to add {
mergedaudio +=temp; //mergedaudio is a global qbytearray which is the resulting joined up file
}
void MainWindow::mergemp3(QString fname) //fname is the new file to add
{
QFile mp3name (fname);
mp3name.open(QIODevice::ReadOnly);
QByteArray temp= mp3name.readAll();
mergedaudio +=temp; //mergedaudio is a global qbytearray which is the resulting joined up file
}
To copy to clipboard, switch view to plain text mode
Then I write out the merged file:
QFile test
("testout.mp3");
writetest<< mergedaudio;
QFile test("testout.mp3");
test.open(QIODevice::WriteOnly);
QDataStream writetest(&test);
writetest<< mergedaudio;
To copy to clipboard, switch view to plain text mode
The resulting file (mp3) doesn't play correctly. I know this can be done as I used standard c++ to do it.
Any idea what I've done wrong?
Added after 5 minutes:
Oops. Was using the << which is for formatted data.
Bookmarks