Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. More sound simultaneously with QSoundEffect and alsa
Qt 6.11 is out! See what's new in the release blog

More sound simultaneously with QSoundEffect and alsa

Scheduled Pinned Locked Moved Solved Mobile and Embedded
4 Posts 2 Posters 2.5k 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.
  • yeckelY Offline
    yeckelY Offline
    yeckel
    wrote on last edited by
    #1

    Hi,
    I'm working on a custom ARM board and I should get sounds working in Qt5.5. At the beginning just one sound in one time could be played uing QSoundEffect and aplay. Then I've configured /etc/asound.cfg for using alsa mixer plugin dmix and that default output for alsa should be the mixer:

    pcm.dmixed {
        type dmix
        ipc_key 1024
        ipc_key_add_uid 0
        slave.pcm "hw:0,0"
    }
    pcm.dsnooped {
        type dsnoop
        ipc_key 1025
        slave.pcm "hw:0,0"
    }
    
    pcm.duplex {
        type asym
        playback.pcm "dmixed"
        capture.pcm "dsnooped"
    }
    
    pcm.!default {
        type plug
        slave.pcm "duplex"
    }
    
    ctl.!default {
      type hw
      card 0
    }
    

    From this time can I play more aplay, however the QT app is able to play just one sound (on desktop linux more).

    QAudioDeviceInfo::defaultOutputDevice().deviceName():
    Default device name: "sysdefault:CARD=DatAudio"

    QAudioDeviceInfo::availableDevices(QAudio::AudioOutput):
    Device Name: "sysdefault:CARD=DatAudio"
    Preferred Format: "audio/pcm"
    Device Name: "default"
    Preferred Format: "audio/pcm"

    I suppose the QT is using wrong output (not default). According the strace the /etc/asound.conf is read as well as alsa plugin /usr/lib/qt/plugins/audio/libqtaudio_alsa.so (there is no other available)

    What can I do to change the output? Is that the right way? Thanks.

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

      Hi,

      I think the best thing to do would be to check the Alsa plugin source to see what it's doing and maybe modify it for your purpose.

      Hope it helps.

      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
      • yeckelY Offline
        yeckelY Offline
        yeckel
        wrote on last edited by
        #3

        Ok it was a bug in qt5/qtmultimedia/src/plugins/alsa/qalsaaudiooutput.cpp method bool QAlsaAudioOutput::open() which is fixed in QT5.7

        The old version was explicitly opening alsa device hw:0 and the 5.7 version is using the proper "default" device as specified in /etc/asound.cfg

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

          Glad you found out and thanks for sharing ! :)

          Happy hacking !

          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
          2

          • Login

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