SoundEffect not playing sound.I put "fixed.wav" file on the same folder.



  • SoundEffect not playing sound.I put fixed.wav file on the same folder

    @
    Below is my code 'qml file'

    import QtQuick 1.0

    import Qt 4.7
    import QtMultimediaKit 1.1

    Rectangle {
    width: 360
    height: 640

    Text {
        id:textlabel
        x: 81
        y: 131
         text: "Click Me!";
         font.pointSize: 24;
         width: 150; height: 50;
    
         SoundEffect {
             id: playsound
             source: "fixed.wav"
    
         }
         MouseArea {
             id: playArea
             x: -23
             y: 1
             anchors.rightMargin: 23
             anchors.bottomMargin: -1
             anchors.leftMargin: -23
             anchors.topMargin: 1
             anchors.fill: parent
             onPressed: { playsound.play() }
         }
     }
    

    }

    @



  • When i put
    source: "file:///D:/QtSDK/Examples/4.7/declarative/demos/samegame/qml/fixed.wav"
    its working but when i put,
    source: "fixed.wav"
    it is not working.

    please reply.

    @SoundEffect {
    id: playsound
    source: "fixed.wav"
    //source: "file:///D:/QtSDK/Examples/4.7/declarative/demos/samegame/qml/fixed.wav"

              }@


  • you should import the qtmultimediakit

    @
    import QtQuick 1.0
    import QtMultimediaKit 1.1
    @

    and edit your .pro file

    CONFIG += mobility
    MOBILITY += multimedia



  • I have already add these lines on my project file,the main concern is about the source of the soundeffect. as i mentioned in my last reply.



  • Is your QML file in the resource, if, then it tries to find your audio from the resource too.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.