![]() |
| ||
Classes - Annotated - Tree - Functions - Home - Structure |
The QSound class provides access to the platform audio facilities. More...
#include <qsound.h>
Inherits QObject.
Qt provides the most commonly required audio operation in GUI applications: playing a sound file asynchronously to the user. This is most simply 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 later played:
QSound bells("mysounds/bells.wav"); bells.play();
Sounds played by 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 Qt/Embedded, a built-in mixing sound server is used, which accesses /dev/dsp directly. Only a single WAVE format is supported, though that support can be configured when building Qt. The default is 11.025 kHz 8-bit mono PCM.
The availability of sound can be tested with QSound::available().
This can use more memory than the static play function.
The parent and name arguments (default 0) are passed on to the QObject constructor.
If no sound is available, all QSound operations work silently and quickly.
The sound can be played again at any time, possibly mixing or replacing previous plays of the sound.
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
This file is part of the Qt toolkit, copyright © 1995-2001 Trolltech, all rights reserved.
Copyright © 2001 Trolltech | Trademarks | Qt version 3.0.0-beta1-beta1
|