Eneboo - Documentación para desarrolladores
|
The QSound class provides access to the platform audio facilities. Más...
#include <qsound.h>
Slots públicos | |
void | play () |
void | stop () |
void | play () |
void | stop () |
Métodos públicos | |
QSound (const QString &filename, QObject *parent=0, const char *name=0) | |
~QSound () | |
int | loops () const |
int | loopsRemaining () const |
void | setLoops (int) |
QString | fileName () const |
bool | isFinished () const |
QSound (const QString &filename, QObject *parent=0, const char *name=0) | |
~QSound () | |
int | loops () const |
int | loopsRemaining () const |
void | setLoops (int) |
QString | fileName () const |
bool | isFinished () const |
Métodos públicos estáticos | |
static bool | isAvailable () |
static void | play (const QString &filename) |
static bool | available () |
static bool | isAvailable () |
static void | play (const QString &filename) |
static bool | available () |
Amigas | |
class | QAuServer |
The QSound class provides access to the platform audio facilities.
Qt provides the most commonly required audio operation in GUI applications: asynchronously playing a sound file. This is most easily accomplished with a single call:
QSound::play("mysounds/bells.wav");
A second API is provided in which a QSound object is created from a sound file and is played later:
QSound bells("mysounds/bells.wav"); bells.play();
Sounds played using the second model may use more memory but play more immediately than sounds played using the first model, depending on the underlying platform audio facilities.
On Microsoft Windows the underlying multimedia system is used; only WAVE format sound files are supported.
On X11 the Network Audio System is used if available, otherwise all operations work silently. NAS supports WAVE and AU files.
On Macintosh, ironically, we use QT (QuickTime) for sound, this means all QuickTime formats are supported by Qt/Mac.
On Qt/Embedded, a built-in mixing sound server is used, which accesses /dev/dsp
directly. Only the WAVE format is supported.
The availability of sound can be tested with QSound::isAvailable().
QSound::~QSound | ( | ) |
Destroys the sound object. If the sound is not finished playing stop() is called on it.
QSound::~QSound | ( | ) |
static bool QSound::available | ( | ) | [inline, static] |
Returns TRUE if sound support is available; otherwise returns FALSE.
static bool QSound::available | ( | ) | [inline, static] |
QString QSound::fileName | ( | ) | const |
QString QSound::fileName | ( | ) | const |
Returns the filename associated with the sound.
static bool QSound::isAvailable | ( | ) | [static] |
bool QSound::isAvailable | ( | ) | [static] |
Returns TRUE if sound facilities exist on the platform; otherwise returns FALSE. An application may choose either to notify the user if sound is crucial to the application or to operate silently without bothering the user.
If no sound is available, all QSound operations work silently and quickly.
bool QSound::isFinished | ( | ) | const |
bool QSound::isFinished | ( | ) | const |
Returns TRUE if the sound has finished playing; otherwise returns FALSE.
int QSound::loops | ( | ) | const |
Returns the number of times the sound will play.
int QSound::loops | ( | ) | const |
int QSound::loopsRemaining | ( | ) | const |
Returns the number of times the sound will loop. This value decreases each time the sound loops.
int QSound::loopsRemaining | ( | ) | const |
void QSound::play | ( | ) | [slot] |
void QSound::play | ( | ) | [slot] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Starts the sound playing. The function returns immediately. Depending on the platform audio facilities, other sounds may stop or may be mixed with the new sound.
The sound can be played again at any time, possibly mixing or replacing previous plays of the sound.
void QSound::play | ( | const QString & | filename | ) | [static] |
Plays the sound in a file called filename.
static void QSound::play | ( | const QString & | filename | ) | [static] |
void QSound::setLoops | ( | int | ) |
void QSound::setLoops | ( | int | l | ) |
Sets the sound to repeat l times when it is played. Passing the value -1 will cause the sound to loop indefinitely.
void QSound::stop | ( | void | ) | [slot] |
Stops the sound playing.
On Windows the current loop will finish if a sound is played in a loop.
void QSound::stop | ( | ) | [slot] |
QAuServer [friend] |