SoundEffectThe SoundEffect type provides a way to play sound effects in QML. More... Inherits QtObject SoundEffect instantiates the C++ class QSoundEffect Properties
MethodsDetailed DescriptionSoundEffect is part of the QtMultimedia 5.0 module. The following example plays a WAV file on mouse click. import QtQuick 2.0 import QtMultimedia 5.0 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 SoundEffect.Infinite to enable infinite looping. This property contains the number of loops remaining before the sound effect stops by itself, or SoundEffect.Infinite if that's what has been set in loops. This property indicates the current status of the SoundEffect as enumerated within SoundEffect. Possible statuses are listed below.
Method DocumentationStart playback of the sound effect, looping the effect for the number of times as specified in the loops property. This is the default method for SoundEffect. SoundEffect { id: playSound source: "soundeffect.wav" } MouseArea { id: playArea anchors.fill: parent onPressed: { playSound.play() } } Stop current playback. Note that if the backend is PulseAudio, due to the limitation of the underlying API, calling stop will only prevent next looping but will not be able to stop current playback immediately. |