Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSoundEffect not working in Qt 6.4.2 windows 10
Qt 6.12 LTS is out! See what's new in the release blog

QSoundEffect not working in Qt 6.4.2 windows 10

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 1.4k 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.
  • KaguroK Offline
    KaguroK Offline
    Kaguro
    wrote on last edited by Kaguro
    #1

    Hi Guys i would like to play a soundeffect with the QSoundEffect but when i tried in this way:

    QSoundEffect *soundEffect = new QSoundEffect();
    soundEffect->setSource(QUrl("D:/QtProjectver200/Android_alarm/RES/alligator3.wav"));
    soundEffect->setLoopCount(QSoundEffect::Infinite);
    soundEffect->setVolume(50);
    soundEffect->play();
    

    And the audio is not playing. The error what the Qt write out:
    QSoundEffect(qaudio): Error decoding source d:/QtProjectver200/Android_alarm/RES/alligator3.wav

    Thanks for your help!

    1 Reply Last reply
    0
    • KaguroK Offline
      KaguroK Offline
      Kaguro
      wrote on last edited by
      #2

      I download the wav file from here:
      https://www.freesoundeffects.com/free-track/alligator3-89353/

      JonBJ 1 Reply Last reply
      0
      • KaguroK Kaguro

        I download the wav file from here:
        https://www.freesoundeffects.com/free-track/alligator3-89353/

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @Kaguro

        • Make sure that is the correct path: if it is not QSoundEffect still gives this (somewhat misleading) error message. Use e.g. QFile::exists() to verify.
        • I don't know how this works on Windows, but do you have the necessary decoder for .wav files?
        • have you tried with another file in a different path? Have you tried with something other than a .wav file?
        KaguroK 1 Reply Last reply
        0
        • JonBJ JonB

          @Kaguro

          • Make sure that is the correct path: if it is not QSoundEffect still gives this (somewhat misleading) error message. Use e.g. QFile::exists() to verify.
          • I don't know how this works on Windows, but do you have the necessary decoder for .wav files?
          • have you tried with another file in a different path? Have you tried with something other than a .wav file?
          KaguroK Offline
          KaguroK Offline
          Kaguro
          wrote on last edited by
          #4

          @JonB

          • Yes the QFile::exists() returns true. I tried this way now (the file is in the build folder):
              effect.setSource(QUrl::fromLocalFile("engine.wav"));
              effect.setLoopCount(QSoundEffect::Infinite);
              effect.setVolume(0.25f);
              effect.play();
          

          The new error is: qt.multimedia.audiooutput: Failed to set up resampler

          • Necessary decoder? I don't know what it is, I didn't add anything other than the main QT. I gave to add some decoder?
          • Yes I tried with some different paths and i tried with .OGG file too.
          JonBJ 1 Reply Last reply
          0
          • KaguroK Kaguro

            @JonB

            • Yes the QFile::exists() returns true. I tried this way now (the file is in the build folder):
                effect.setSource(QUrl::fromLocalFile("engine.wav"));
                effect.setLoopCount(QSoundEffect::Infinite);
                effect.setVolume(0.25f);
                effect.play();
            

            The new error is: qt.multimedia.audiooutput: Failed to set up resampler

            • Necessary decoder? I don't know what it is, I didn't add anything other than the main QT. I gave to add some decoder?
            • Yes I tried with some different paths and i tried with .OGG file too.
            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #5

            @Kaguro

            • Yes, setSource(QUrl::fromLocalFile(...)) looks like the correct way to specify a local file.

            • qt.multimedia.audiooutput: Failed to set up resampler: Google for exactly that phrase. https://stackoverflow.com/questions/74500509/failed-to-setup-resampler-when-starting-qaudiosink tells you there is a Qt 6.4.x bug for exactly this, refers you to https://bugreports.qt.io/browse/QTBUG-108383 and tells you what to do. The Qt bug report tells you it was fixed in 6.4.3 but not 6.4.2.

            1 Reply Last reply
            3

            • Login

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