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. Volume changing, even though it shouldn't, while changing microphone
QtWS25 Last Chance

Volume changing, even though it shouldn't, while changing microphone

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 2 Posters 758 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    Which version of Qt are you using ?
    On which OS does it happen ?

    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
    0
    • X Offline
      X Offline
      xuwjuy1
      wrote on last edited by
      #3

      Qt version: 6.2.2
      OS: Windows. I don't know if we've replicated the problem on Linux, we're mainly using the program on Windows.

      That said, when I change my microphone on Windows normally, meaning outside our Qt application, I have never had such volume problems.

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xuwjuy1
        wrote on last edited by xuwjuy1
        #4

        Actually, let me correct the problem description in the sense that the volume does not turn very loud, but rather starts clipping heavily (which makes me suspect it exceeded the maximum allowed value).

        My teammate who also has had the problem says he may have solved the issue by explicitly setting the QAudioSource volume level each time a new object is instantiated.

        1 Reply Last reply
        0
        • X Offline
          X Offline
          xuwjuy1
          wrote on last edited by
          #5

          Further update: my teammate's solution of setting the microphone volume explicitly when changing microphone did not solve the issue, at least on my computer.

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

            Did you check the volume value before destroying the source and after creating the new one ?

            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
            0
            • X Offline
              X Offline
              xuwjuy1
              wrote on last edited by xuwjuy1
              #7

              Yes. In both cases, the nominal value is 1.0, the maximum (when calling source->volume()). But once the error happens, the microphone sound is somewhat louder and starts heavily clipping.

              1 Reply Last reply
              0
              • X Offline
                X Offline
                xuwjuy1
                wrote on last edited by
                #8

                So, my teammate found the bug coming from our software after all. The audio problem is now fixed, our buffer was working badly. Sorry for the inconvenience.

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

                  Glad you found out and thanks for sharing !

                  Can you explain happened with your buffer ?

                  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
                  • X Offline
                    X Offline
                    xuwjuy1
                    wrote on last edited by xuwjuy1
                    #10

                    As far as I understand from my teammate's explanation, we have created our own buffer class, and the class sometimes took the last byte of the previous audio sample (we use the 16-bit PCM format) and combined it with the next audio sample's first byte. He fixed the issue by regularly emptying the buffer.

                    Our buffer class is a subclass of QIODevice.

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

                      That's surprising to have a residual byte from a 16bit format. Anyway, glad you found the culprit.

                      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
                      0

                      • Login

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