Diagnosing audio problems



  • This code prints 0 0 under FreeBSD which has Realtek ALC887 driver installed and working:

    foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) {
        qDebug() << "Device name: " << deviceInfo.deviceName() << endl;
    } // copy-paste from this site
    
    QAudioDeviceInfo di = QAudioDeviceInfo(QAudioDeviceInfo::defaultOutputDevice());
    
    qDebug() << di.supportedCodecs().length() << endl;
    qDebug() << di.supportedSampleRates().length() << endl;
    

    That means it is unable to discover the devices, codecs and bitrates.
    What can I do to troubleshoot this issue?



  • I realize that Unix Qt multimedia is Gstreamer based.
    Is not having any audio devices in Qt indicative of a problem with Gstreamer install?



  • If sound works in KDE but not in my Qt app, what does that mean?


  • Lifetime Qt Champion

    Hi,

    Not necessarily but you should check your GStreamer install.



  • Gstreamer appears to work just fine with Audacity, Ardour, VLC and all possible KDE and GTK players etc. I cannot find any fault with Gstreamer, even installed "all" plugins package and still no devices detected by Qt.


  • Lifetime Qt Champion

    Which version of Qt did you install ? How did you install it ?



  • It was Qt5 from the FreeBSD packages (not from the ports): pkg install Qt5
    It seems to be version 5.5.1

    When compiled and run under Windows 7 this prints:

    Device name:  "Speakers (Realtek High Definiti" 
    Device name:  "Acer P241W (2- High Definition "  // a monitor, actually. HDMI connection, that's probably why?
    Device name:  "Realtek Digital Output (Realtek" 
    

    So this probably has something to do with Qt configuration on the FreeBSD machine, it probably does not know something critical about Gstreamer.


  • Lifetime Qt Champion

    Did you check that you have all QtMultimedia plugins installed ?



  • Oh, on Unix that would be

    PulseAudio (Unix)
    Alsa (Unix)

    That may be the case: FreeBSD comes with OSS and Alsa is optional. I did not have Alsa installed, that may be it. I will install, re-test and reply back.

    But I do not understand why Gstreamer is not sufficient if it is Qt's back end for Unix.
    And how could KDE sound work if Qt could not detect any audio devices. This simply does not make any sense.


  • Lifetime Qt Champion

    Depending on your version of KDE, it's phonon that's used.



  • So what's the next step?


  • Lifetime Qt Champion

    Start your application with QT_DEBUG_PLUGINS=1 to see what's going on when your application starts.



  • These lines have something to do with audio:

    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/lib/qt5/plugins/audio" ... // there is no audio directory
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/home/leo/NetBeansProjects/OscilloscopeQT/dist/Debug/GNU-Generic/audio" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/home/leo/.kde4/lib/kde4/plugins/audio" ... // there is no .kde4/lib
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/lib/kde4/plugins/audio" ... // also no audio directory
    

    Is there a manual on installing the Qt audio plugins under Unix?


  • Lifetime Qt Champion

    That looks strange, you should check with the FreeBSD guys.



  • According to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=208987 multimedia audio plugins cannot be installed from the packages under FreeBSD.
    They have to be compiled from the ports tree and select the options to build audio plugins and use ALSA or PA:

    cd /usr/ports/multimedia/qt5-multimedia
    make config 
    make deinstall install clean
    

    But still there are no devices recognized after reinstalling with the compiled audio plugins:

     QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/lib/qt5/plugins/audio" ...
     QFactoryLoader::QFactoryLoader() looking at "/usr/local/lib/qt5/plugins/audio/libqtaudio_alsa.so"
    Found metadata in lib /usr/local/lib/qt5/plugins/audio/libqtaudio_alsa.so, metadata=
     {
    "IID": "org.qt-project.qt.audiosystemfactory/5.0",
    "MetaData": {
     "Keys": [
    "alsa"
    ]
     },
     "className": "QAlsaPlugin",
     "debug": false,
    "version": 328961
     }
    
    
    Got keys from plugin meta data ("alsa")
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/lib/kde4/plugins/audio" ...
     loaded library "/usr/local/lib/qt5/plugins/audio/libqtaudio_alsa.so"
     Device count: 0
    Device count: 0
    

  • Lifetime Qt Champion

    What about PA ?



  • I am very hesitant to use or rely on PA due to horrible latency and frankly the whole concept of having a sound server where only mic input and speaker output are required sounds outlandish to me.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.