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. QAudioDecoder not emitting signals

QAudioDecoder not emitting signals

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 334 Views 2 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.
  • D Offline
    D Offline
    davecotter
    wrote on last edited by davecotter
    #1

    On Windows (under which QAudioDecoder is supposed to work), i call a background thread via boost::threads, and in that thread i create a QAudioDecoder, connect EVERY signal it provides to a slot-handler, load it up with an mp3 file, and play it, then poll for events while in an "audio-pump" loop. The only signals i get are:

    14: Signal: Source Changed
    14: Signal: State Changed: Decoding
    

    I don't receive any other signals, significantly i get no bufferReady() signal, therefore i get no audio.

    The documentation states this: "If a QObject has no thread affinity (that is, if thread() returns zero), or if it lives in a thread that has no running event loop, then it cannot receive queued signals or posted events"

    To be clear, i have called this->thread() and it does indeed return non-null, and during my audio-pump loop, i do call processEvents() which should allow the decoding and its signals right?

    I could not find example code of a working QAudioDecoder.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      davecotter
      wrote on last edited by
      #3

      okay turns out i wasn't creating the thread correctly.

      when i switched to "worker thread" style as explained here, it all started working.

      :)

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi,

        Your thread does not have an event loop running. You are likely calling your QApplication processEvent method which lies in a different thread and is not related to the one where your QAudioDecoder lies.

        Why not use a QThread for that ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • D Offline
          D Offline
          davecotter
          wrote on last edited by
          #3

          okay turns out i wasn't creating the thread correctly.

          when i switched to "worker thread" style as explained here, it all started working.

          :)

          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