[SailfishDevel] Problem with playing sounds in first application

Thomas Tanghus thomas at tanghus.net
Thu Jun 11 18:06:04 UTC 2015


On Tuesday 03 February 2015 23:13:44 Luis Manuel Ramos Da Costa wrote:
>         Audio {
>             id      : whipSound
>             loops   : Audio.Infinite
>             source:"qrc:/sounds/resources/sounds/whipSound.flac"
>         }

That can teach me to read the ml regularly ;)

The loops property isn't documented in the documentation in the SDK, so I made 
an ugly hack to emulate it:

   Audio {
        id: alarm;
        source: Qt.resolvedUrl(selectedSound);

        property bool forceStopped: false;

        function forceStop() {
            forceStopped = true;
            stop();
        }

        onStopped: {
            if(loopSound && !forceStopped) {
                play();
            } else {
                forceStopped = false;
            }
        }
    }


-- 
Med venlig hilsen / Best regards

Thomas Tanghus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20150611/c13e6120/attachment.pgp>


More information about the Devel mailing list