Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Buffer underflow

Buffer underflow

Scheduled Pinned Locked Moved General and Desktop
qtmultimediasegfaultpulseaudio
1 Posts 1 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Evil_Genius
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved