QAudioDeviceInfo finds no default audio device on Ubuntu

柔情痞子 提交于 2019-11-29 14:17:22

问题


I am trying to run the basic example from the QAudioDeviceInfo class reference, but Qt is not finding a default audio device.

Running this code shows no output:

foreach (const QAudioDeviceInfo &deviceInfo,  QAudioDeviceInfo::availableDevices(QAudio::AudioOutput))
    qDebug() << "Device name: " << deviceInfo.deviceName();

I'm running Qt Creator 2.7.1 with Qt 5.0.2 on Ubuntu 13.10. Qt Multimedia was installed via apt-get. My pro file has QT += multimedia. My header file includes:

#include <QAudio>
#include <QAudioOutput>
#include <QAudioDeviceInfo>

Any ideas as to what I might be doing wrong?


回答1:


It was fixed with a simple command:

sudo apt-get install libqt5multimedia5-plugins

Qt Multimedia requires this plugin package for audio backend support.




回答2:


Had same issue in windows. Fixed it by replacing Qt5Multimedia.dll in \Python34\Lib\site-packages\PyQt* with one from \Qt\Tools\QtCreator\bin.

Spend some time finding solution so decided to leave it here.



来源:https://stackoverflow.com/questions/21939759/qaudiodeviceinfo-finds-no-default-audio-device-on-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!