Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Brainstorm
  4. QAudioDeviceInfo::defaultInputDevice() unexpected behavior
QtWS25 Last Chance

QAudioDeviceInfo::defaultInputDevice() unexpected behavior

Scheduled Pinned Locked Moved Unsolved Brainstorm
qaudiorecorderqaudioinputqaudiodeviceinf
5 Posts 2 Posters 894 Views
  • 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.
  • H Offline
    H Offline
    haykarmeni
    wrote on 6 Sept 2021, 04:56 last edited by
    #1

    Hi guys. I am implementing an audio recorder app with GUI and use QAudioDeviceInfo class for extracting locally available audio input devices. It works correctly, but when I want to extract the default Audio Input device name with QAudioDeviceInfo::defaultInputDevice() it works unexpectedly.

        const auto l_deviceInfos = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
        const auto l_default = QAudioDeviceInfo::defaultInputDevice().deviceName();
        qDebug()<<l_default;// displays "Default Input Device"
        QAudioDeviceInfo l_elem{};
        foreach(l_elem, l_deviceInfos){
            ui->cmboxAudioInputs->addItem(l_elem.deviceName(),QVariant::fromValue(l_elem));
            //works fine and adds all names of available audio input devices
        }
    

    Could you please explain what is the problem and how can I handle it? Thanks

    E 1 Reply Last reply 6 Sept 2021, 05:30
    0
    • H haykarmeni
      6 Sept 2021, 04:56

      Hi guys. I am implementing an audio recorder app with GUI and use QAudioDeviceInfo class for extracting locally available audio input devices. It works correctly, but when I want to extract the default Audio Input device name with QAudioDeviceInfo::defaultInputDevice() it works unexpectedly.

          const auto l_deviceInfos = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
          const auto l_default = QAudioDeviceInfo::defaultInputDevice().deviceName();
          qDebug()<<l_default;// displays "Default Input Device"
          QAudioDeviceInfo l_elem{};
          foreach(l_elem, l_deviceInfos){
              ui->cmboxAudioInputs->addItem(l_elem.deviceName(),QVariant::fromValue(l_elem));
              //works fine and adds all names of available audio input devices
          }
      

      Could you please explain what is the problem and how can I handle it? Thanks

      E Offline
      E Offline
      eyllanesc
      wrote on 6 Sept 2021, 05:30 last edited by
      #2

      @haykarmeni What value do you expect?

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      H 1 Reply Last reply 6 Sept 2021, 05:50
      0
      • E eyllanesc
        6 Sept 2021, 05:30

        @haykarmeni What value do you expect?

        H Offline
        H Offline
        haykarmeni
        wrote on 6 Sept 2021, 05:50 last edited by
        #3

        @eyllanesc based on https://doc.qt.io/qt-5/qaudiodeviceinfo.html#deviceName it will return the human-readable name of the audio device, so in this case Microphone (Realtek (R) Audio) as my default audio input device, because when I call qDebug() for l_elem.deviceName() it works fine and displays all names of available devices

        E 1 Reply Last reply 6 Sept 2021, 06:50
        0
        • H haykarmeni
          6 Sept 2021, 05:50

          @eyllanesc based on https://doc.qt.io/qt-5/qaudiodeviceinfo.html#deviceName it will return the human-readable name of the audio device, so in this case Microphone (Realtek (R) Audio) as my default audio input device, because when I call qDebug() for l_elem.deviceName() it works fine and displays all names of available devices

          E Offline
          E Offline
          eyllanesc
          wrote on 6 Sept 2021, 06:50 last edited by
          #4

          @haykarmeni The docs say: eg. default, Intel, U0x46d0x9a4

          If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

          H 1 Reply Last reply 6 Sept 2021, 07:22
          0
          • E eyllanesc
            6 Sept 2021, 06:50

            @haykarmeni The docs say: eg. default, Intel, U0x46d0x9a4

            H Offline
            H Offline
            haykarmeni
            wrote on 6 Sept 2021, 07:22 last edited by haykarmeni 9 Jun 2021, 07:31
            #5

            @eyllanesc, so is there any other way to extract the exact name of the default audio input file? Am I right, that the first element of the returned value of QAudioDeviceInfo::availableDevices(QAudio::AudioInput) is the DeviceInfo of the default audio input device?

            1 Reply Last reply
            0

            1/5

            6 Sept 2021, 04:56

            • Login

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