I have the following setup,
audio_output = new QAudioOutput(*audio_format, this);
audio_device = audio_output->start(); // Return QIODevice
audio_device->open(QIODevice::ReadWrite);
I need a function that writes data to the end of the audio_device stream whilst it's playing. The problem is that as it's playing, it's changing the pos (tested this). I need to call,
audio_device->write(buffer, byte - buffer);
To write to the end of the written buffer. How can I have it play and write at the same time?
Many thanks for any help here.
__Edit__
Partial fix! It makes a slight crackle.
while (audio_device->write(buffer, byte - buffer) < 1)
usleep(10);
Looks like it was failing to write the buffer. Is there a nicer way to do that?