9

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?

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
maxmcmahon
  • 445
  • 3
  • 8
  • 1
    I found the fix for my answer, although apparently I can't answer my own question until tomorrow. I just had to run: `sudo apt-get install libqt5multimedia5-plugins` – maxmcmahon Feb 21 '14 at 19:46

2 Answers2

18

It was fixed with a simple command:

sudo apt-get install libqt5multimedia5-plugins

Qt Multimedia requires this plugin package for audio backend support.

maxmcmahon
  • 445
  • 3
  • 8
3

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.