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. QAudioDeviceInfo::defaultOutputDevice() is incorrectly null
Forum Updated to NodeBB v4.3 + New Features

QAudioDeviceInfo::defaultOutputDevice() is incorrectly null

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 418 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.
  • T Offline
    T Offline
    ThomH
    wrote on last edited by
    #1

    I am building code I wrote myself under Ubuntu 20.04 in Qt Creator 4.11.0 which reports itself as being based on Qt 5.12.8. I'm running this under VMWare. I installed Qt Creator via its Snap, as presented in the 'Ubuntu Software' storefront.

    The 'Settings' application shows a sound output device (of Analog Output - ES1371/ES1373 / Creative Labs CT2518 (Audio PCI 6V/128/5200 / Creative CT4810/CT5803/CT5806 [Sound Blaster PCI]), though of course that's just what VMWare is presenting to the virtualised machine). If I hit the 'Test' button and play some of the tests, they are audible.

    If I launch Firefox and browse to e.g. Youtube then it also has no problem producing sound.

    Tracking down an issue with the Linux build of my Qt project, I added the following slightly redundant code:

    qDebug() << "Available devices:" << QAudioDeviceInfo::availableDevices(QAudio::AudioOutput).size();
    
    const QAudioDeviceInfo &defaultDeviceInfo = QAudioDeviceInfo::defaultOutputDevice();
    if(defaultDeviceInfo.isNull()) {
        qDebug() << "No default device";
    }
    

    And it dutifully outputs:

    Available devices: 0
    No default device
    

    Is there anything I can do to look behind that? Why is Qt unable to find an audio device when I clearly have one, and Firefox has no issue taking advantage of it? Is this normal for Qt under X11?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by Bonnie
      #2

      Does the audio plugins also be installed by Ubuntu?
      On Linux, there should be plugins/audio/libqtaudio_alsa.so and plugins/audio/libqtmedia_pulse.so.
      Also, from their name, you can know that they use alsa and pulseaudio as backends.
      Do you have either of the libraries installed too?

      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