Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSound only works on my development machine

QSound only works on my development machine

Scheduled Pinned Locked Moved Unsolved General and Desktop
qsound
5 Posts 4 Posters 2.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alan.lenton
    wrote on 11 Apr 2016, 16:09 last edited by
    #1

    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

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 11 Apr 2016, 16:13 last edited by mrjj 4 Nov 2016, 16:14
      #2

      @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?

      1 Reply Last reply
      0
      • V Offline
        V Offline
        VRonin
        wrote on 11 Apr 2016, 17:21 last edited by
        #3

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

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        A 1 Reply Last reply 2 May 2016, 13:44
        1
        • V VRonin
          11 Apr 2016, 17:21

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

          A Offline
          A Offline
          alan.lenton
          wrote on 2 May 2016, 13:44 last edited by
          #4

          @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 :)

          alan

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 2 May 2016, 22:09 last edited by
            #5

            Hi,

            That's what usually windeployqt does for you :)

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved