The QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) return only one audio device(default device) on three audio out devices. Why?



  • 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 it is shown in QAudioDeviceInfo::availableDevices(). Do we need to do any update on configurations?
    Note:
    Used the sample code on qt samples for audiooutput. Only one device return.

    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

    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:

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

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.