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. QAudioInput -- error underrun? HOW?
Forum Updated to NodeBB v4.3 + New Features

QAudioInput -- error underrun? HOW?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 3.8k Views 1 Watching
  • 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.
  • F Offline
    F Offline
    fyngyrz
    wrote on last edited by
    #1

    OSX 10.6.8, Qt 4.7, USB soundcard

    Hi. I've implemented the example that shows how to use QAudioInput with a QIODevice, here:

    http://doc.qt.nokia.com/4.7-snapshot/multimedia-audioinput.html

    I start the thing this way:

    @
    mAudioInput->start(mInAudioInfo);
    @

    ...according to the brief (very!) description on the low level multimedia page, here:

    http://labs.qt.nokia.com/2010/05/10/low-level-audio-processing-with-qtmultimedia/

    ...this should result in me not having to do anything further for data to come in from the input device. What I am doing in the...

    @
    qint64 AudioInfo::writeData(const char *data, qint64 len)
    @

    ...function is storing the incoming data to a buffer, processing it, and elsewhere, writing it back out as sound.

    What is WEIRD is that the...

    @
    mAudioInput
    @

    ...keeps stopping with an underrun. Now, all it hands me in the writeData function is a pointer and a length, which I am supposed to return back to it (and I do), so how in blue blazes is it able to get into an underrun condition? If I never looked at the data or wrote it over itself (in my buffers of course), how would it know? It can't. It doesn't even know where they are. So what the heck is going on?

    Right now, as a horrible and not usable workaround, every time I go to read the captured data, I check state(), and if it has gone to idle (which it almost always has), I...

    @
    mAudioInput->start(mInAudioInfo);
    @

    ...which restarts it, and I get (jittery, awful) audio for a while, and then... eventually the program crashes deep in the QAudio code.

    It's like I am completely missing something I'm supposed to do after it passes me a buffer, but I can't even find a hint of such a thing.

    Can anyone help me here?

    1 Reply Last reply
    0
    • F Offline
      F Offline
      fyngyrz
      wrote on last edited by
      #2

      Oh, boy. I reduced the sample rate -- by a lot -- from 96 khz down to 24 khz, and the underrun errors went away...

      o This is a USB device with an embedded sound "card": designed to run at 96 khz in stereo.

      o Running a Windows VM and going after the card under the VM, through USB, and the VM's abstraction layer... results in 100% operation of the device at 96 khz in stereo, no problems at all. Even if I stick the card out on a hub. So the problem here certainly isn't the card or the USB system. And this machine is fast.

      o It would appear, at least, that either QAudioInput or the way I'm using it is not up to the task of dealing with audio very well.

      I'm hoping someone comes along and says "oh, you forgot to set the priority" or something along those lines. Help?

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goocreations
        wrote on last edited by
        #3

        I'm having the same issues with Qt5 (alpha). And it happens randomly. Sometimes I can record for 2 hours without any problem and other times (with exactly the same settings 16bit samples at 44100Hz) I get the underrun error.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goocreations
          wrote on last edited by
          #4

          And if I get an underrun error, it sometimes just stops recording. Very annoying if your program is so unstable due to this problem.

          1 Reply Last reply
          0
          • JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #5

            That sounds serious. Please report this at http://bugreports.qt-project.org/ -- that way there's a chance it can be fixed before Qt 5 is released

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goocreations
              wrote on last edited by
              #6

              Bug report at "https://bugreports.qt-project.org/browse/QTBUG-28530":https://bugreports.qt-project.org/browse/QTBUG-28530

              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