Qt World Summit: Register Today!

QML SoundEffect Element is too slow!

  • hi,
    i have a mouseArea in my QML file with an onPressed function which calls a mp3 file.
    The mp3 file is playing correctly, but if i touch the mousearea again during it play the file, it's just waiting till the end of the soundfile and plays it again.

    For example: i have a 1 second mp3-file.
    if i push a mousearea 10 times with my finger during a second, the 1 second mp3-file is repeating... 10 seconds!!!
    the sound should appears when i press the mousearea without to wait till the end.

    can anybody help?

    best regards...

    here a short snippet:
    @MouseArea {
    id: ma0
    x: 0
    y: 0
    width: 460
    height: 200
    onPressed: {
    } }

        SoundEffect {
                 id: play_click
                 source: "res/click.MP3"
                 volume: 1.0

  • How about choosing an audio file with a small duration for example 200 ms?

    If your case is a game consider looking at the "Qt Game Enabler API"http://projects.developer.nokia.com/qtgameenabler/wiki/audio

  • that sounds good "Qt Game Enabler API".

    but there is my next problem.
    I integrate the "Qt Game Enabler API" from this site "Using the Audio Plugin":https://projects.developer.nokia.com/qtgameenabler/wiki/audio_qml#UsingtheAudioplugin

    But on pushing the mousearea i dont hear anything on my device.
    I think i have a "Source location" problem because the "QML Audio Test Project":http://projects.developer.nokia.com/qtgameenabler/wiki/examples#QtGameEnablerQmlAudiotest works fine.

    QML Soundeffect Location:

    The source of a QML Soundeffect i get at his
    location: "C:\QtSDK\Projects\PROJECTNAME\PROJECTNAME\qml\PROJECTNAME\res\reload.wav"
    calling in QML: source: "res/reload.wav"

    QML Audio Plugin Location:

    The source of a QML Audio Plugin i get at his
    location: "C:\QtSDK\Projects\PROJECTNAME\PROJECTNAME\qml\PROJECTNAME\res\reload.wav"
    calling in QML: source: "res/reload.wav"

    A Snippet from my PRO file:

    Add more folders to ship with the application, here

    folder_01.source = qml/PROJECTNAME
    folder_01.target = qml

    i cant get it work... how i had to declare the source file?
    source: ":/audio/reload.wav" = dont work too

  • I have the same problem, I make a new project, and put all the requeriments and it not work!!!

    did you find the solution?

    the qml audio test plugin works fine too.

  • hi,
    maybe u can check this video...
    this is my solution:


  • LOT OF THANKS!!!!!

    what was my problem?

    Is the first time that I make a resource.qrc and when I add the prefix I don´t delete the address, now with only this: "/" it works fine!!!


Log in to reply