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. QAudioOutput vs QTimer strange behaviour
Qt 6.11 is out! See what's new in the release blog

QAudioOutput vs QTimer strange behaviour

Scheduled Pinned Locked Moved Unsolved General and Desktop
31 Posts 4 Posters 8.4k 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.
  • A abarmotov

    @mzimmers said in QAudioOutput vs QTimer strange behaviour:

    When that's commented out, it seems to work fine, right?

    no, HMMM is still there on second click
    but i tested only on 5.12.8

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by jsulm
    #20

    @abarmotov Why do you think so? You wrote: "then press on button two times". So, as I explained: on the first button press you set slotIsRunning_ to true, so on second button press slotIsRunning_ is true and you print "HMMM". So, nothing is interrupted. Still don't get what the issue is...

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    A mzimmersM 3 Replies Last reply
    0
    • jsulmJ jsulm

      @abarmotov Why do you think so? You wrote: "then press on button two times". So, as I explained: on the first button press you set slotIsRunning_ to true, so on second button press slotIsRunning_ is true and you print "HMMM". So, nothing is interrupted. Still don't get what the issue is...

      A Offline
      A Offline
      abarmotov
      wrote on last edited by
      #21

      @jsulm said in QAudioOutput vs QTimer strange behaviour:

      Still don't get what the issue is...

      the mouse click on button "should not" interrupt any running slot, but must be queued in qt event loop in single thread app
      am i wrong ?

      1 Reply Last reply
      0
      • jsulmJ jsulm

        @abarmotov Why do you think so? You wrote: "then press on button two times". So, as I explained: on the first button press you set slotIsRunning_ to true, so on second button press slotIsRunning_ is true and you print "HMMM". So, nothing is interrupted. Still don't get what the issue is...

        A Offline
        A Offline
        abarmotov
        wrote on last edited by
        #22

        @jsulm said in QAudioOutput vs QTimer strange behaviour:

        so on second button press slotIsRunning_ is true

        slotIsRunning_ is set to false at end of slot - that the point

        1 Reply Last reply
        0
        • jsulmJ jsulm

          @abarmotov Why do you think so? You wrote: "then press on button two times". So, as I explained: on the first button press you set slotIsRunning_ to true, so on second button press slotIsRunning_ is true and you print "HMMM". So, nothing is interrupted. Still don't get what the issue is...

          mzimmersM Offline
          mzimmersM Offline
          mzimmers
          wrote on last edited by
          #23

          @jsulm said in QAudioOutput vs QTimer strange behaviour:

          @abarmotov Why do you think so? You wrote: "then press on button two times". So, as I explained: on the first button press you set slotIsRunning_ to true, so on second button press slotIsRunning_ is true and you print "HMMM". So, nothing is interrupted. Still don't get what the issue is...

          He sets slotIsRunning_ at the start of the slot, but then sets it to false towards the end.

          jsulmJ 1 Reply Last reply
          0
          • mzimmersM mzimmers

            @jsulm said in QAudioOutput vs QTimer strange behaviour:

            @abarmotov Why do you think so? You wrote: "then press on button two times". So, as I explained: on the first button press you set slotIsRunning_ to true, so on second button press slotIsRunning_ is true and you print "HMMM". So, nothing is interrupted. Still don't get what the issue is...

            He sets slotIsRunning_ at the start of the slot, but then sets it to false towards the end.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #24

            @mzimmers Yeah, did not notice that.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • A Offline
              A Offline
              abarmotov
              wrote on last edited by
              #25

              Any thoughts on why this is happening?

              1 Reply Last reply
              0
              • A Offline
                A Offline
                abarmotov
                wrote on last edited by
                #26

                i found it:

                QPulseAudioOutput::~QPulseAudioOutput()
                {
                    close();
                    disconnect(m_tickTimer, SIGNAL(timeout()));
                    QCoreApplication::processEvents(); // THAT STRING BREAKS EVENT LOOP
                }
                
                jsulmJ 1 Reply Last reply
                0
                • A abarmotov

                  i found it:

                  QPulseAudioOutput::~QPulseAudioOutput()
                  {
                      close();
                      disconnect(m_tickTimer, SIGNAL(timeout()));
                      QCoreApplication::processEvents(); // THAT STRING BREAKS EVENT LOOP
                  }
                  
                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #27

                  @abarmotov said in QAudioOutput vs QTimer strange behaviour:

                  THAT STRING BREAKS EVENT LOOP

                  It does not "break" event loop, it just tells event loop to check and handle events if there are any.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  A 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @abarmotov said in QAudioOutput vs QTimer strange behaviour:

                    THAT STRING BREAKS EVENT LOOP

                    It does not "break" event loop, it just tells event loop to check and handle events if there are any.

                    A Offline
                    A Offline
                    abarmotov
                    wrote on last edited by
                    #28

                    @jsulm
                    but this is the way my slot is called a second time, while that slot in middle on execution
                    this behavior is not obvious when deleting QAudioOutput

                    jsulmJ 1 Reply Last reply
                    0
                    • A abarmotov

                      @jsulm
                      but this is the way my slot is called a second time, while that slot in middle on execution
                      this behavior is not obvious when deleting QAudioOutput

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #29

                      @abarmotov Why did you add processEvents at all there?

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      A 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @abarmotov Why did you add processEvents at all there?

                        A Offline
                        A Offline
                        abarmotov
                        wrote on last edited by
                        #30

                        @jsulm it ain't me )
                        QPulseAudioOutput - this is qt source code

                        jsulmJ 1 Reply Last reply
                        0
                        • A abarmotov

                          @jsulm it ain't me )
                          QPulseAudioOutput - this is qt source code

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #31

                          @abarmotov Ah, right. Would be interesting to know why it was added - doesn't look correct to me and causes the issue you have.

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          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