Qt World Summit: Register Today!

Recovering from underruns in QAudioOutput, using custom QIODevice

  • Moderators

    Hi all,

    If I use a QIODevice provided by QAudioOutput, it automatically recovers from buffer underruns once I write in more data:
    QIODevice *autoDevice = audioOutput->start();

    // ... Underrun occurs

    autoDevice->write(moreData, length);
    // ... QAudioOutput continues playing

    However, if I provide a custom device, it doesn't automatically recover:

    // ... Underrun occurs

    myCustomDevice->write(moreData, length);
    // ... Nothing happens

    I presumed that in the first case, QAudioOutput internally connects the signals to enable auto-recovery when new data arrives. So, I made sure I emitted the readyRead() and bytesWritten() signals from inside MyCustomDevice::writeData(). That didn't work though.

    Am I missing something? Does QAudioOutput connect signals when I call audioOutput->start(myCustomDevice), or do I have to do it manually?

Log in to reply