|Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions|
The QSound class provides access to the platform audio facilities. More...
List of all member functions.
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:
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().
See also Multimedia Classes.
This may use more memory than the static play function.
The parent and name arguments (default 0) are passed on to the QObject constructor.
Returns TRUE if sound support is available; otherwise returns FALSE.
If no sound is available, all QSound operations work silently and quickly.
Note: On Windows this will always return TRUE as there is no way to determine when the sound has finished.
This function is not supported on Windows and will always return the total number of loops.
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.
On Windows, sounds with a loop count different from 1 will always loop indefinitely.
See also loops().
See also play().
This file is part of the Qt toolkit. Copyright © 1995-2003 Trolltech. All Rights Reserved.