0

Question:

1. The QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) return only one audio device(default device) from three audio out devices. Why? Total three audio out devices are available and while checking with ALSA devices verified the output using "tinyplay" utility by command line. But QAudioDeviceInfo::availableDevices() doesn't return these three devices, it return only one device(default).

Note: Used the sample code on qt samples for audiooutput. Only one device returned.

m_deviceBox->addItem(defaultDeviceInfo.deviceName(), qVariantFromValue(defaultDeviceInfo));
foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) {
if (deviceInfo != defaultDeviceInfo) {
 m_deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo));
}
}

2. How to set a particular ALSA device(for eg: card0, device 0) as default audio device? In this case QAudioDeviceInfo::defaultOutputDevice() is set as device 0 on sound card2.

Please see below for details........

System Setup:

Target Board : iMX6Q Sabre AI

OS : Android M6

Qt : QT 5.8

Android NDK r10

Android SDK : 25.2.5

Available Sound Cards:

root@sabreauto_6q:/ # cat /proc/asound/cards

0 [cs42888audio ]: cs42888-audio - cs42888-audio cs42888-audio 1 [imxspdif ]: imx-spdif - imx-spdif imx-spdif 2 [imxhdmisoc ]: imx-hdmi-soc - imx-hdmi-soc imx-hdmi-soc

Available Sound Devices:

root@sabreauto_6q:/ # cat /proc/asound/card0/ id pcm0c/ pcm0p/ pcm1c/ pcm1p/

root@sabreauto_6q:/ # cat /proc/asound/card1/ id pcm0c/

root@sabreauto_6q:/ # cat /proc/asound/card2/ id pcm0p/

Note: Total 3 sound cards and 3 Audio(ALSA) out devices are present.

Attempts to test audio out devices:

Using tinyplay utility sound out verified for whole audio out drivers.

tinyplay test.wav -D 0 -d 0 --> Sound verified. Note : ALSA device 0 on Sound Card 0 is running to produce sound out.

tinyplay test.wav -D 0 -d 1 --> Sound verified.

tinyplay test.wav -D 2 -d 0 --> Sound verified.

Akhil
  • 11
  • 2

0 Answers0