Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. DefaultAudioInput returns non valid audio name?
Forum Updated to NodeBB v4.3 + New Features

DefaultAudioInput returns non valid audio name?

Scheduled Pinned Locked Moved General and Desktop
10 Posts 3 Posters 3.1k Views 1 Watching
  • 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.
  • I Offline
    I Offline
    ilean
    wrote on last edited by
    #1

    Hello.

    For sure i'm missing something, but I cannot solve it.

    It's code from Qt official doc. (QAudioRecorder doc,)

    @QStringList inputs = audioRecorder->audioInputs();
    QString selectedInput = audioRecorder->defaultAudioInput();

    foreach (QString input, inputs) {
    QString description = audioRecorder->audioInputDescription(input);
    // show descriptions to user and allow selection
    selectedInput = input;
    }

    audioRecorder->setAudioInput(selectedInput);@

    The problem is that nor Audio Input names neither audio input description match what defaultAudioInput() returns.
    At last in my system (Windows 8) it is "Default Input Device" and I'm not able to know wich input device is the default one.

    Is there any way to know it?

    Furthermore, if you try to create a input using "Default Input Device" name, doesn't works. So, it's imperative for me to know that correct default input device name.

    1 Reply Last reply
    0
    • I Offline
      I Offline
      ilean
      wrote on last edited by
      #2

      Up!

      Nobody knows answer or am I completly wrong and nobody wants to enlight me? XDDD

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        It might also be that not many people are currently using Windows 8 for development.

        Default Input Device should correspond to your mixer default input device, you can take a look at it there.

        IIRC, you can use QAudioDeviceInfo::defaultInputDevice() when you want to create the default device.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • I Offline
          I Offline
          ilean
          wrote on last edited by
          #4

          Hi SGaist. Thankyou for your interest.

          Yes, I can use that function to create a default audio device and works fine.
          But the problem persists as there is no way to know the real name for "Default audio device". So, I cannot select correct device in the ComboBox.

          I will take a look on other OS.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            You can use QAudioDeviceInfo::availableDevices to get a list of all devices and build your combo box with it. IIRC the default device will be named "default" so you don't have to worry about that

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • I Offline
              I Offline
              ilean
              wrote on last edited by
              #6

              No, thats the problem.... there is no "default" named device in list.

              Look at this to see what I'm saying.
              !http://s2.postimg.org/88vfoc1gp/avaiable_Devices.png(avaiableDevices)!
              It's a debug image from audioinput example, audioinput.cpp file

              As you can see, there is only one device in system with his "real name"

              And here, in m_device variable, obtained by defaultInputDevice(), you can see the name ... "Default..."
              !http://s28.postimg.org/cuuun268t/default_Input_Device.png(defaultInputDevice)!

              I've checked in Windows XP, and defaultInputDevice() returns real name. So, it's a W8 issue. I will check it in W7 and OS-X. Oh, great W8!!!! :/

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                That's pretty strange indeed, can you check what happens if you have more than one audio device ? e.g. usb audio card, bluetooth headset etc… ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  bsomervi
                  wrote on last edited by
                  #8

                  I've just hit this too.

                  The only way I see around this is to have platform specific code on Windows that puts an extra entry in my audio device choice combo box and more platform specific code in the changed action to detect the default entry and open the device by re-fetching the default.

                  Does the "Default (Input|Output) Device" get looked up at program startup or is it dynamic and track changes at he o/s level while the application runs?

                  1 Reply Last reply
                  0
                  • I Offline
                    I Offline
                    ilean
                    wrote on last edited by
                    #9

                    [quote author="bsomervi" date="1392160785"]I've just hit this too.

                    The only way I see around this is to have platform specific code on Windows that puts an extra entry in my audio device choice combo box and more platform specific code in the changed action to detect the default entry and open the device by re-fetching the default.

                    Does the "Default (Input|Output) Device" get looked up at program startup or is it dynamic and track changes at he o/s level while the application runs?[/quote]

                    plataform-specific code could be the solution, but keep in mind that the plataform is not "Windows" but "Windows 8". Perhaps, using WinAPI in a different way that Qt does, we'll be able to know default audio device name in all windows versions.

                    I'm happy not being alone xD

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      bsomervi
                      wrote on last edited by
                      #10

                      I have worked around this without having to write any platform specific code. I had to assume that the special device names "Default Input Device" and "Default Output Device" will never appear on any platform unless they are really a "default" device since there doesn't seem to be a way of identifying a saved QAudioDeviceInfo object (reflecting a user choice) as the "default" one.

                      To answer my other question - both the default devices and the whole QAudioDeviceInfo::availableDevices(...) lists are "live" and reflect the current system state at all times. This fact means that my code to work with the special "default" devices was required anyway to recognize that the user may have changed the default or plugged/unplugged a device between one stream start() call and the next.

                      1 Reply Last reply
                      0

                      • Login

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