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. qsoundeffect(qaudio): error decoding source file
Forum Updated to NodeBB v4.3 + New Features

qsoundeffect(qaudio): error decoding source file

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 942 Views 1 Watching
  • 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.
  • B Offline
    B Offline
    Batyu
    wrote on last edited by
    #1

    I'm trying to play a sound effect but QT always gives me this error:

    QSoundEffect(qaudio): Error decoding source file:///home/baty/Qt Projects/testproj/untitled/click2.mp3
    

    The file does exist in the location, i also tried adding it as a resource file but it cant play the sound.

        QSoundEffect effect;
        effect.setSource(QUrl::fromLocalFile("/home/baty/Qt Projects/testproj/untitled/click2.mp3"));
        effect.setLoopCount(QSoundEffect::Infinite);
        effect.setVolume(10.f);
        effect.play();
        qDebug()<<effect.status();
    

    the qDebug() gives me a QSoundEffect::Loading state, which is, according to the documentation trying to load the file. (it only gives me the error when i paste the code into main.cpp just before w.show();

    jsulmJ 1 Reply Last reply
    0
    • B Batyu

      I'm trying to play a sound effect but QT always gives me this error:

      QSoundEffect(qaudio): Error decoding source file:///home/baty/Qt Projects/testproj/untitled/click2.mp3
      

      The file does exist in the location, i also tried adding it as a resource file but it cant play the sound.

          QSoundEffect effect;
          effect.setSource(QUrl::fromLocalFile("/home/baty/Qt Projects/testproj/untitled/click2.mp3"));
          effect.setLoopCount(QSoundEffect::Infinite);
          effect.setVolume(10.f);
          effect.play();
          qDebug()<<effect.status();
      

      the qDebug() gives me a QSoundEffect::Loading state, which is, according to the documentation trying to load the file. (it only gives me the error when i paste the code into main.cpp just before w.show();

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Batyu I guess for MP3 play back you will need Gstreamer plug-in containing MP3 support - is it installed?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      B 1 Reply Last reply
      1
      • jsulmJ jsulm

        @Batyu I guess for MP3 play back you will need Gstreamer plug-in containing MP3 support - is it installed?

        B Offline
        B Offline
        Batyu
        wrote on last edited by
        #3

        @jsulm I installed Gstreamer plugin, it still doesnt work, but i converted the mp3 file to a .wav file, and now it gives me QSoundEffect::Ready status, so the file is ready to play, but i still can't hear the sound. Maybe theres some problem with the audiooutput

        JoeCFDJ 1 Reply Last reply
        0
        • B Batyu

          @jsulm I installed Gstreamer plugin, it still doesnt work, but i converted the mp3 file to a .wav file, and now it gives me QSoundEffect::Ready status, so the file is ready to play, but i still can't hear the sound. Maybe theres some problem with the audiooutput

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by
          #4

          @Batyu You did not mention your OS and Qt version. In Linux, try to use
          strace your app
          to see if any plugin or lib loading fails.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            QSoundEffect only works with uncompressed data.

            For the missing output, are you sure you selected a valid one and that the volume is not 0 ?

            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
            1

            • Login

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