Audio stream recording and playback using Qt
I am trying to develop a multimedia program using Qt which gets an audio input stream from a microphone (开发者_StackOverflowusing QAudioInput
), then stores the sampled bytes in memory for 60 milliseconds, then play it back (using QAudioOutput
).
The documentation for QAudioOuput
has an example which does most of this, but it uses a file as its data source instead. How can I modify this to use an input stream instead?
QAudioInput::start() and QAudioOutput::start() both take a pointer to a QIODevice as a parameter. This could be pointer to a QFile (like in the example) or a QBuffer if you want to keep the data in the memory.
精彩评论