Thanks for the reply. Is the QAudioBuffer.data() the actual microphone data or only formatting data (channels, bit rate, etc)? If not, how do I convert the const void* from data() to a QByteArray?
Thanks for the reply. Is the QAudioBuffer.data() the actual microphone data or only formatting data (channels, bit rate, etc)? If not, how do I convert the const void* from data() to a QByteArray?
Well, the QAudioBuffer has a QAudioFormat so the data must be the actual audio data.
Without trying the API would suggest that this should be possible:
Qt Code:
To copy to clipboard, switch view to plain text mode
Cheers,
_
I tried using the code you posted to save the QByteArray to a file. I get an error, "Windows Media Player cannot play this file."
edit: I did some testing and it saves the microphone data, but it didn't use the codec from the QAudioRecorder.
Last edited by vanillac; 27th March 2015 at 20:39.
If you want to write to a file, then converting into a byte array is just an unnecessary step, you can directly write the "const char*" data into the file.
Cheers,
_
Bookmarks