Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QSoundEffect Class

The 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

enum Loop { Infinite }
enum Status { Null, Loading, Ready, Error }

Properties

  • 1 property inherited from QObject

Public Functions

QSoundEffect(QObject * parent = 0)
~QSoundEffect()
QString category() const
bool isLoaded() const
bool isMuted() const
bool isPlaying() const
int loopCount() const
int loopsRemaining() const
void setCategory(const QString & category)
void setLoopCount(int loopCount)
void setMuted(bool muted)
void setSource(const QUrl & url)
void setVolume(qreal volume)
QUrl source() const
Status status() const
qreal volume() const
  • 31 public functions inherited from QObject

Public Slots

void play()
void stop()
  • 1 public slot inherited from QObject

Signals

void categoryChanged()
void loadedChanged()
void loopCountChanged()
void loopsRemainingChanged()
void mutedChanged()
void playingChanged()
void sourceChanged()
void statusChanged()
void volumeChanged()

Static Public Members

QStringList supportedMimeTypes()
  • 11 static public members inherited from QObject

Additional Inherited Members

  • 9 protected functions inherited from QObject

Detailed Description

The QSoundEffect class provides a way to play low latency sound effects.

Member Type Documentation

enum QSoundEffect::Loop

ConstantValueDescription
QSoundEffect::Infinite-2Used as a parameter to loops for infinite looping

enum QSoundEffect::Status

ConstantValueDescription
QSoundEffect::Null0No source has been set or the source is null.
QSoundEffect::Loading1The SoundEffect is trying to load the source.
QSoundEffect::Ready2The source is loaded and ready for play.
QSoundEffect::Error3An error occurred during operation, such as failure of loading the source.

Property Documentation

category : QString

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()

loops : int

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()

loopsRemaining : const int

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()

muted : bool

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()

playing : const bool

This property indicates whether the sound effect is playing or not.

Access functions:

bool isPlaying() const

Notifier signal:

void playingChanged()

source : QUrl

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()

status : const Status

Access functions:

Status status() const

Notifier signal:

void statusChanged()

volume : qreal

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()

Member Function Documentation

QSoundEffect::QSoundEffect(QObject * parent = 0)

Creates a QSoundEffect with the given parent.

QSoundEffect::~QSoundEffect()

Destroys this sound effect.

bool QSoundEffect::isLoaded() const

Returns whether the sound effect has finished loading the source.

void QSoundEffect::loadedChanged() [signal]

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

The corresponding handler is onLoadedChanged.

void QSoundEffect::play() [slot]

Start playback of the sound effect, looping the effect for the number of times as specified in the loops property.

void QSoundEffect::stop() [slot]

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.

QStringList QSoundEffect::supportedMimeTypes() [static]

Returns a list of the supported mime types for this sound effect.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web