Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    QSound on Qt 5.2.1 does not play .wav files

    General and Desktop
    2
    10
    3806
    Loading More Posts
    • 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.
    • R
      rushmore last edited by

      I just recently ported my code from Qt 4.8.5 to Qt 5.2.1 (desktop version). I found all the .wav files that used to play in 4.8.5 do not play any more in 5.2.1, even though I've added multimedia module. I'm sure this has been reported by others as seen here:
      https://bugreports.qt-project.org/browse/QTBUG-28948
      It says the bug has been fixed. But why I'm still getting it in Qt 5.2.1? There is also a solution for Mac as described here:

      http://stackoverflow.com/questions/14165608/qt5-qsound-does-not-play-all-wave-files

      But what about Windows? I would like my code to support both Mac and Windows.

      Thank you!

      1 Reply Last reply Reply Quote 0
      • R
        rushmore last edited by

        Sorry, I take it back, they do play in Windows. But still not play in Mac for me.

        1 Reply Last reply Reply Quote 0
        • JKSH
          JKSH Moderators last edited by

          I can't think of why it won't play, but as a workaround, try QSoundEffect and/or QMediaPlayer.

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply Reply Quote 0
          • R
            rushmore last edited by

            As far as I know, QSound is just a wrap around QSoundEffect in Qt5, so that does not work (I did try it and got the same result).

            1 Reply Last reply Reply Quote 0
            • JKSH
              JKSH Moderators last edited by

              -QSound and QSoundEffect are unrelated classes.- EDIT: Oops, you're right. However, QSoundEffect has gives you more access to its internals.

              • What does QSoundEffect::supportedMimeTypes() return?
              • After you try to play, what does QSoundEffect::status() return?

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              1 Reply Last reply Reply Quote 0
              • R
                rushmore last edited by

                QSoundEffect::supportedMimeTypes() returns:

                "audio/x-wav", "audio/wav", "audio/wave", "audio/x-pn-wav"

                status() returns 2, meaning "ready to play"? But I called play()...

                1 Reply Last reply Reply Quote 0
                • JKSH
                  JKSH Moderators last edited by

                  Actually, connect the statusChanged() signal to a slot that prints the status. (The playback is asynchronous, so if you call status() immediately after play() you won't see anything). What different statuses do you get?

                  Also, have you tried QMediaPlayer, and/or the Audacity trick?

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  1 Reply Last reply Reply Quote 0
                  • R
                    rushmore last edited by

                    I did print from a connected slot. It prints 1 and then 2. That's it.

                    What is Audacity trick? QMediaPlayer sounds really like a overkill to just play a single beep : (.

                    1 Reply Last reply Reply Quote 0
                    • JKSH
                      JKSH Moderators last edited by

                      [quote author="rushmore" date="1398956657"]I did print from a connected slot. It prints 1 and then 2. That's it.[/quote]Sounds like there's a bug. If you submit a bug report and attach your .wav file, someone who works on Qt Multimedia will look into it.

                      [quote]What is Audacity trick?[/quote]See the 1st answer in your StackOverflow link. Basically, use http://audacity.sourceforge.net/ to open and re-save your .wav file. If the problem is caused by missing headers, this trick should restore them.

                      [quote]QMediaPlayer sounds really like a overkill to just play a single beep : (. [/quote]I agree. But it's better than having no sound.

                      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                      1 Reply Last reply Reply Quote 0
                      • R
                        rushmore last edited by

                        Audacity trick didn't help unfortunately. I think I will need to file a bug report.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post