Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML SoundEffect Element is too slow!
QtWS25 Last Chance

QML SoundEffect Element is too slow!

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 3 Posters 4.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.
  • 3 Offline
    3 Offline
    3vmedia
    wrote on last edited by
    #1

    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: {
    play_click.stop()
    play_click.play()
    } }

        SoundEffect {
                 id: play_click
                 source: "res/click.MP3"
                 volume: 1.0
             }@
    
    1 Reply Last reply
    0
    • G Offline
      G Offline
      geronik
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • 3 Offline
        3 Offline
        3vmedia
        wrote on last edited by
        #3

        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
        DEPLOYMENTFOLDERS = folder_01

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

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tommyj23
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • 3 Offline
            3 Offline
            3vmedia
            wrote on last edited by
            #5

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

            "http://www.youtube.com/watch?v=O_-DmTxZUe8":http://www.youtube.com/watch?v=O_-DmTxZUe8

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tommyj23
              wrote on last edited by
              #6

              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!!!

              thanks!!!

              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