QSoundEffect ClassThe QSoundEffect class provides a way to play low latency sound effects. More... #include <QSoundEffect> Inherits: QObject. QSoundEffect is instantiated by QML element SoundEffect Public Types
Properties
Public Functions
Public Slots
Signals
Static Public Members
Additional Inherited Members
Detailed DescriptionThe QSoundEffect class provides a way to play low latency sound effects. Member Type Documentation
|
Constant | Value | Description |
---|---|---|
QSoundEffect::Infinite | -2 | Used as a parameter to loops for infinite looping |
Constant | Value | Description |
---|---|---|
QSoundEffect::Null | 0 | No source has been set or the source is null. |
QSoundEffect::Loading | 1 | The SoundEffect is trying to load the source. |
QSoundEffect::Ready | 2 | The source is loaded and ready for play. |
QSoundEffect::Error | 3 | An error occurred during operation, such as failure of loading the source. |
This property contains the category of this sound effect.
Some platforms can perform different audio routing for different categories, or may allow the user to set different volume levels for different categories.
This setting will be ignored on platforms that do not support audio categories.
Access functions:
QString | category() const |
void | setCategory(const QString & category) |
Notifier signal:
void | categoryChanged() |
This property provides a way to control the number of times to repeat the sound on each play().
Set to QSoundEffect::Infinite to enable infinite looping.
Access functions:
int | loopCount() const |
void | setLoopCount(int loopCount) |
Notifier signal:
void | loopCountChanged() |
This property contains the number of loops remaining before the sound effect stops by itself, or QSoundEffect::Infinite if that's what has been set in loops.
Access functions:
int | loopsRemaining() const |
Notifier signal:
void | loopsRemainingChanged() |
This property provides a way to control muting. A value of true will mute this effect.
Access functions:
bool | isMuted() const |
void | setMuted(bool muted) |
Notifier signal:
void | mutedChanged() |
This property indicates whether the sound effect is playing or not.
Access functions:
bool | isPlaying() const |
Notifier signal:
void | playingChanged() |
This property provides a way to control 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.
Access functions:
QUrl | source() const |
void | setSource(const QUrl & url) |
Notifier signal:
void | sourceChanged() |
Access functions:
Status | status() const |
Notifier signal:
void | statusChanged() |
This property holds the volume of the playback, from 0.0 (silent) to 1.0 (maximum volume).
Access functions:
qreal | volume() const |
void | setVolume(qreal volume) |
Notifier signal:
void | volumeChanged() |
Creates a QSoundEffect with the given parent.
Destroys this sound effect.
Returns whether the sound effect has finished loading the source.
The loadedChanged signal is emitted when the loading state has changed.
The corresponding handler is onLoadedChanged.
Start playback of the sound effect, looping the effect for the number of times as specified in the loops property.
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.
Returns a list of the supported mime types for this sound effect.