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 on Qt 5.2.1 does not play .wav files
Forum Updated to NodeBB v4.3 + New Features

QSound on Qt 5.2.1 does not play .wav files

Scheduled Pinned Locked Moved General and Desktop
10 Posts 2 Posters 4.3k 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.
  • R Offline
    R Offline
    rushmore
    wrote on last edited by
    #1

    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
    0
    • R Offline
      R Offline
      rushmore
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #3

        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
        0
        • R Offline
          R Offline
          rushmore
          wrote on last edited by
          #4

          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
          0
          • JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #5

            -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
            0
            • R Offline
              R Offline
              rushmore
              wrote on last edited by
              #6

              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
              0
              • JKSHJ Offline
                JKSHJ Offline
                JKSH
                Moderators
                wrote on last edited by
                #7

                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
                0
                • R Offline
                  R Offline
                  rushmore
                  wrote on last edited by
                  #8

                  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
                  0
                  • JKSHJ Offline
                    JKSHJ Offline
                    JKSH
                    Moderators
                    wrote on last edited by
                    #9

                    [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
                    0
                    • R Offline
                      R Offline
                      rushmore
                      wrote on last edited by
                      #10

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

                      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