Signals

Methods

Detailed Description

This type allows you to play uncompressed audio files (typically WAV files) in a generally lower latency way, and is suitable for "feedback" type sounds in response to user actions (e.g. virtual keyboard sounds, positive or negative feedback for popup dialogs, or game sounds). If low latency is not important, consider using the MediaPlayer or Audio types instead, since they support a wider variety of media formats and are less resource intensive.

Typically the sound effect should be reused, which allows all the parsing and preparation to be done ahead of time, and only triggered when necessary. This is easy to achieve with QML, since you can declare your SoundEffect instance and refer to it elsewhere.

This property holds the url for the sound to play. For the SoundEffect to attempt to load the source, the URL must exist and the application must have read permission in the specified directory. If the desired source is a local file the URL may be specified using either absolute or relative (to the file that declared the SoundEffect) pathing.

An error occurred during operation, such as failure of loading the source.

volume : qreal

This property holds the volume of the sound effect playback.

The volume is scaled linearly from 0.0 (silence) to 1.0 (full volume). Values outside this range will be clamped.

The default volume is 1.0.

UI volume controls should usually be scaled nonlinearly. For example, using a logarithmic scale will produce linear changes in perceived loudness, which is what a user would normally expect from a volume control. See QtMultimedia.convertVolume() for more details.

Signal Documentation

categoryChanged()

The categoryChanged signal is emitted when the category property has changed.

The corresponding handler is onCategoryChanged.

loadedChanged()

The loadedChanged signal is emitted when the loading state has changed.

The corresponding handler is onLoadedChanged.

loopCountChanged()

The loopCountChanged signal is emitted when the initial number of loops has changed.

The corresponding handler is onLoopCountChanged.

loopsRemainingChanged()

The loopsRemainingChanged signal is emitted when the remaining number of loops has changed.

The corresponding handler is onLoopsRemainingChanged.

mutedChanged()

The mutedChanged signal is emitted when the mute state has changed.

The corresponding handler is onMutedChanged.

playingChanged()

The playingChanged signal is emitted when the playing property has changed.

The corresponding handler is onPlayingChanged.

sourceChanged()

The sourceChanged signal is emitted when the source has been changed.

The corresponding handler is onSourceChanged.

statusChanged()

The statusChanged signal is emitted when the status property has changed.