Important: Please read the Qt Code of Conduct -

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)
    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,


  • Lifetime Qt Champion

    @alan.lenton said:
    Are you 100% sure that
    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?

  • On windows you have to deploy the audio plugin qtaudio_windows.dll and qtmedia_audioengine.dll

  • @VRonin

    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.dll

    By the way, I happen to think that in general,the Qt documentation is very good :)


  • Lifetime Qt Champion


    That's what usually windeployqt does for you :)

Log in to reply