Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-42326

QAudioDeviceInfo::availableDevices() doesn't return all available devices with ALSA backend

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.4.2
    • 5.3.2
    • Multimedia
    • None
    • e1d76e2df53b766f418e15282a2b908e91108b66

    Description

      With the ALSA backend, QAudioDeviceInfo::availableDevices() only returns the devices that are actually backed by hardware sound cards, but not the PCMs defined in an asoundrc. The reason for this is the explicit iteration of sound cards in qalsaaudiodeviceinfo.cpp:

      while (snd_card_next(&card) == 0 && card >= 0) {
          if (snd_device_name_hint(card, "pcm", &hints) < 0)
              continue;
          /* .... */
      }
      

      Passing -1 for card to snd_device_name_hint and eliminating the loop fixes the behaviour. The ALSA docs explicitly state that "-1" indicates "all available devices" and this is also the way aplay/arecord handle this.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ylopes Yoann Lopes
            pumphaus Arno Rehn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes