QSound only works on my development machine
-
I can get QSound to play on my development kit (Qt5.4, Windows7, VS2013+QtPlugin) using this code:
SoundFx::SoundFx(QObject *parent) : QObject(parent)
{
sound_dir = QString::fromStdString(FedTerm::base_dir) + "/sounds/";
}void SoundFx::Play(int sound)
{
switch(sound)
{
case ALERT: QSound::play(QDir::toNativeSeparators(sound_dir + "alert.wav")); break;
case FRIENDS: QSound::play(QDir::toNativeSeparators(sound_dir + "friends.wav")); break;
}
}However, on other computers, for some reason I can't fathom, it just doesn't play. The directory is correct, and there is no error message. I the multimedia library is present. I'm sure I'm missing something obvious, but I have no idea what.
Can anyone point me in the right direction?
Many thanks,
Alan
-
@alan.lenton said:
Hi
Are you 100% sure that
FedTerm::base_dir
is pointing to the correct folder on the "other" machines?Also if u run the .exe in the deploy folder on your own machine,
does it just work? -
Thank you that worked - once I'd figured out the directories to put them in!
There's nothing in the documentation for QSound that indicates you need plugins. It would be nice if those bits of the library that need plugins told you which ones it needs. For instance:
Header: #include <QSound>
qmake: QT += multimedia
Plugins: qtaudio_windows.dll, qmedia_audioengine.dllBy the way, I happen to think that in general,the Qt documentation is very good :)
alan
-
Hi,
That's what usually windeployqt does for you :)