More sound simultaneously with QSoundEffect and alsa
-
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.
-
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.
-
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
-
Glad you found out and thanks for sharing ! :)
Happy hacking !