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. [FIXED][Qt5] QSound won't play any sound

[FIXED][Qt5] QSound won't play any sound

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.1k 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.
  • Arty.McLabinA Offline
    Arty.McLabinA Offline
    Arty.McLabin
    wrote on last edited by
    #1

    @QSound soundTheme("warhorn.mp3"); //warhorn.wav won't work too ( i have both these files in there)
    soundTheme.play();@

    the dir of the files is right, as i also have a picture-loading label which loads a .png from the same dir, a line before QSound attempt.

    also tried using QSoundEffect, won't produce any sound just as well.

    note: i've connected multimedia to QT+= in my .pro and ran qmake, app output won't tell anything. the app runs, the only issue is that the audio simply won't launch.

    Static linking is cool. Really.

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

      Hi,

      How did you run your application?

      Note that QSound and QSoundEffect are old classes which cannot play compressed files (like MP3 files). See their documentation:

      • http://qt-project.org/doc/qt-5/QSound.html
      • http://qt-project.org/doc/qt-5/QSoundEffect.html

      If you want to play MP3 files, use QMediaPlayer.

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

      1 Reply Last reply
      0
      • Arty.McLabinA Offline
        Arty.McLabinA Offline
        Arty.McLabin
        wrote on last edited by
        #3

        [quote author="JKSH" date="1411832071"]Hi,

        How did you run your application?

        Note that QSound and QSoundEffect are old classes which cannot play compressed files (like MP3 files). See their documentation:

        • http://qt-project.org/doc/qt-5/QSound.html
        • http://qt-project.org/doc/qt-5/QSoundEffect.html

        If you want to play MP3 files, use QMediaPlayer.[/quote]

        *thanks for the note, yet it's not about the mp3, wav won't work just as well.

        also seems like i did fix it with the QMediaPlayer class, thanks for that.

        Static linking is cool. Really.

        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