I have a small C++ Qt program that uses a QAudioOutput instance to emit sound. It compiles & runs fine using Qt 4.8.5.
However, in Qt 5.0, 5.1, and 5.2, my application compiles, but does not work. I get the following error message while the constructor of the QAudioOutput instance is running:
Unable to create a connection to the pulseaudio context.
Also, the constructor does not return, so my program hangs.
I do not have pulseaudio running. ALSA is working fine, and this is what my program uses when compiled with Qt 4.8.5.
Inspecting the Qt5 “plugins/audio” directory, there is only “libqtmedia_pulse.so” there, the name of which suggests that it depends on pulseaudio.
My questions:
From Qt documentation wiki on Multimedia Backends:
Here is the list of the current audio backends:
Windows Multimedia CoreAudio (Mac OS / iOS) PulseAudio (Unix) Alsa (Unix) OpenSL ES (Android) QNX
Only PulseAudio, CoreAudio, and QNX backends are actual plugins. The other backends are “#ifdef’ed” in the related classes.
So basically ALSA is not a plugin but must be selected when you configure Qt (if you build your own, which I assume you are).
From Qt documentation wiki on building Qt5 from git:
Qt Multimedia
You’ll need at least alsa-lib (>= 1.0.15) and gstreamer (>=0.10.24, but <1.0 for now [lists.qt-project.org]) with the base-plugins package.
Ubuntu/Debian:
sudo apt-get install libasound2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
When configuring Qt I have lost count over the times when some feature was not compiled in because of missing dependencies. So make absolutely 100% sure that all dependencies are installed properly, and that all your configuration options are valid with the current configuration program (available options change even between minor versions)! Remember to look closely at output from build process (collect output in a file and search through it after build completes for any messages with "skipping" or "error" or such keywords.
OTOH, if you did not build your own Qt then I have no clue and you should disregard this answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With