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. How to play sound on specific audio device?
Qt 6.11 is out! See what's new in the release blog

How to play sound on specific audio device?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 712 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.
  • G Offline
    G Offline
    gkavrecic
    wrote on last edited by
    #1

    I need to play sounds on different audio devices on the machine.
    Currently, I use QSound, but it only works on current default audio device.

    I'm able to find info about available audio devices: QAudioDeviceInfo::availableDevices()
    Is it somehow possible to have two C++ objects (QSound like) and use them for different audio outputs?

    Kent-DorfmanK 1 Reply Last reply
    0
    • G gkavrecic

      I need to play sounds on different audio devices on the machine.
      Currently, I use QSound, but it only works on current default audio device.

      I'm able to find info about available audio devices: QAudioDeviceInfo::availableDevices()
      Is it somehow possible to have two C++ objects (QSound like) and use them for different audio outputs?

      Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on last edited by
      #2

      @gkavrecic said in How to play sound on specific audio device?:

      Is it somehow possible to have two C++ objects (QSound like) and use them for different audio outputs?

      Not through the QSound mechanism. QSound is very primitive, only sinking to the default sound device.

      The dystopian literature that served as a warning in my youth has become an instruction manual in my elder years.

      G 1 Reply Last reply
      2
      • Kent-DorfmanK Kent-Dorfman

        @gkavrecic said in How to play sound on specific audio device?:

        Is it somehow possible to have two C++ objects (QSound like) and use them for different audio outputs?

        Not through the QSound mechanism. QSound is very primitive, only sinking to the default sound device.

        G Offline
        G Offline
        gkavrecic
        wrote on last edited by
        #3

        @Kent-Dorfman
        I'm aware of QSound limits.
        Looking for an alternative.

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

          What about QMediaPlayer?
          It has the QMediaService, but this class is strongly advised to avoid in new code.

          I hardly believe that Qt has no approach to play a sound on a specific device.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            gkavrecic
            wrote on last edited by gkavrecic
            #5

            If it helps to anyone, use QSoundEffect.
            Not sure in which version started to support this, but for sure does not support devices in 5.10, but does in 5.15

            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