Play a sound
-
Hello everyone,
I'm trying to play a short sound with QSound. Everything works under GNU/Linux but no sound comes out of my speakers under Windows.
Here is my code (very simple) :QSound::play(":/ressources/audio/notification.wav")
and the error message displayed in the terminal :
using null output device, none available
Does somebody knows what happens ? Is there a package to install with the maintenanceTool ?
Thank you so much !
-
@cmdEvo said in Play a sound:
Google forqt using null output device, none available
E.g. https://forum.qt.io/topic/31004/error-using-null-output-device-none-available
I admit they seem to be more Linux than Windows, but might be a starting point for ideas? -
Looks like your qpa audio plugin is not loaded.
Qt comes with plugins for Windows (WinMM and WASAPI), Linux (ALSA and PulseAudio), macOS / iOS (CoreAudio), Android (OpenSL ES) and QNX.
If no audio plugins are available, a fallback dummy backend will be used. This should print out warnings if this is the case when you try and use QAudioInput or QAudioOutput. To fix this problem, make sure the dependencies for the Qt plugins are installed on the system and reconfigure Qt (e.g. alsa-devel package on Linux), or create your own plugin with a default key to always override the dummy fallback. The easiest way to determine if you have only a dummy backend is to get a list of available audio devices.
QAudioDeviceInfo::availableDevices(QAudio::AudioOutput).size() = 0 (dummy backend)Maybe you can set QT_DEBUG_PLUGINS environment variable to 1 to check the reason.
I remember someone once said about need to install some media package in Windows. -
I have found out a solution.
I have just copied the folder named 'plugins' from Qt\5.15.0\mingw81_64 to the release folder and it works.
Could somebody explain me why please ? Is there an other way to load the needed plugin ?