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. Duplicate device name returned from QAudioDeviceInfo::availableDevices
Forum Updated to NodeBB v4.3 + New Features

Duplicate device name returned from QAudioDeviceInfo::availableDevices

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 479 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.
  • _ Offline
    _ Offline
    _Henning_
    wrote on last edited by _Henning_
    #1

    Hi,

    I am trying to list the available devices on my system and output them:

    QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
    for (const QAudioDeviceInfo & dev : devices)
    output(dev.deviceName());

    I don't understand why two devices are returned on my system with the same name but different properties:

    Microphone (High Definition Audio Device)
    sample rates: 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, 96000, 192000,
    channel counts: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
    sample size: 8, 16, 24, 32, 48, 64,
    codecs: audio/pcm,
    byte order: 1,
    sample type: 1, 2, 3,

    Microphone (High Definition Audio Device)
    sample rates: 44100,
    channel counts: 2,
    sample size: 8, 16, 24, 32, 64,
    codecs: audio/pcm,
    byte order: 1,
    sample type: 1, 3,

    The documentation (https://doc.qt.io/qt-5/qaudiodeviceinfo.html#deviceName) states that the device name should be unique.
    Of course I can workaround the problem somehow, I was just thinking if I don't understand something or if this is a qt but I should report.

    (a little bit off-topic: how do I convert the enum values to strings ? Of course I searched how to do this but all solutions I found required the Q_ENUM macro but the macro is not present in the QAudioFormat class where the enums are declared).

    I am on Windows10/MSVC2019 16.5.2/Qt 5.14.2 msvc2017_64

    Any help is appreciated.

    Regards,
    Henning

    jsulmJ 1 Reply Last reply
    0
    • _ _Henning_

      Hi,

      I am trying to list the available devices on my system and output them:

      QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
      for (const QAudioDeviceInfo & dev : devices)
      output(dev.deviceName());

      I don't understand why two devices are returned on my system with the same name but different properties:

      Microphone (High Definition Audio Device)
      sample rates: 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, 96000, 192000,
      channel counts: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
      sample size: 8, 16, 24, 32, 48, 64,
      codecs: audio/pcm,
      byte order: 1,
      sample type: 1, 2, 3,

      Microphone (High Definition Audio Device)
      sample rates: 44100,
      channel counts: 2,
      sample size: 8, 16, 24, 32, 64,
      codecs: audio/pcm,
      byte order: 1,
      sample type: 1, 3,

      The documentation (https://doc.qt.io/qt-5/qaudiodeviceinfo.html#deviceName) states that the device name should be unique.
      Of course I can workaround the problem somehow, I was just thinking if I don't understand something or if this is a qt but I should report.

      (a little bit off-topic: how do I convert the enum values to strings ? Of course I searched how to do this but all solutions I found required the Q_ENUM macro but the macro is not present in the QAudioFormat class where the enums are declared).

      I am on Windows10/MSVC2019 16.5.2/Qt 5.14.2 msvc2017_64

      Any help is appreciated.

      Regards,
      Henning

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @_Henning_ said in Duplicate device name returned from QAudioDeviceInfo::availableDevices:

      how do I convert the enum values to strings ?

      Not elegant but works:

      QString strValue;
      switch(value) {
      case ENUM_VALUE_1:
      strValue = "ENUM_VALUE_1";
      break;
      case...
      }
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • XMuliX Offline
        XMuliX Offline
        XMuli
        wrote on last edited by XMuli
        #3

        Hi, did you solve it later? It's now 2023.05 and I came across that I'm still to the same problem.

        Using QAudioDeviceInfo::availableDevices on Qt5.15.2 + MSVC 2022 gets duplicate names, but using MinGW compilation does not.(Windows 10 22H2)

        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