Buffer underflow



  • After each play the sound track using the QAudioOutput I get a message in Application Output: "Got a buffer underflow!". What could be the reason?
    Here is the code:

    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
        QFile file;
        file.setFileName("/path/to/file/1.wav");
        file.open(QIODevice::ReadOnly);
        QAudioFormat outputFormat;
        outputFormat.setSampleRate(44100);
        outputFormat.setChannelCount(1);
        outputFormat.setSampleSize(16);
        outputFormat.setCodec("audio/pcm");
        outputFormat.setByteOrder(QAudioFormat::LittleEndian);
        outputFormat.setSampleType(QAudioFormat::SignedInt);
        QAudioOutput* player = new QAudioOutput(outputFormat);
        player->start(&file);
        QEventLoop loop;
        QObject::connect(player, SIGNAL(stateChanged(QAudio::State)), &loop, SLOT(quit()));
        do{
            loop.exec();
        }while(player->state() == QAudio::ActiveState);
        file.close();
        delete player;
        return a.exec();
    }
    

    In more complicated project occurs SegFault at instruction return a.exec();, when I play sound using the QAudioOutput.
    My OS is Debian Linux. Kernel 3.16.0-4-amd64. Compiler - GCC v4.9.2. Qt version - 5.5.0


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.