QML SoundEffect ElementThe SoundEffect element provides a way to play sound effects in QML. More... PropertiesSignalsMethodsDetailed DescriptionThis element is part of the QtMultimediaKit 1.1 module. The following example plays a wav file on mouse click. import Qt 4.7 import QtMultimediaKit 1.1 Text { text: "Click Me!"; font.pointSize: 24; width: 150; height: 50; SoundEffect { id: playSound source: "soundeffect.wav" } MouseArea { id: playArea anchors.fill: parent onPressed: { playSound.play() } } } Property DocumentationThis property provides a way to control the number of times to repeat the sound on each play(). Set to -1 (infinite) to enable infinite loop. This property indicates the following status of the soundeffect. Null: no source has been set or is null. Loading: the soundeffect is trying to load the source. Ready: the source is loaded and ready for play. Error: some error happened during operation, such as failure of loading the source. This property holds the volume of the playback, from 0.0 (silent) to 1.0 (maximum volume). Signal DocumentationMethod DocumentationStart playback of the sound effect, looping the effect for the number of times as specificed in the loops property. This is the default method for SoundEffect. MouseArea { anchors.fill: parent onPressed: { SoundEffect { source:"soundeffect.wav" } } } Stop current playback. Note that if the backend is PulseAudio, due to the limitation of the underlying API, tis stop will only prevent next looping but will not be able to stop current playback immediately. © 2008-2010 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. Privacy Policy X
|