QSound(3qt)

NAME
QSound - Access to the platform audio facilities

#include <qsound.h>

Inherits QObject.

  Public Members
QSound ( const QString & filename, QObject * parent=0, const char * name=0 )
~QSound ()

  Public Slots
void play ()

  Static Public Members
bool available ()
void play ( const QString & filename )

DESCRIPTION
Access to the platform audio facilities.

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, where a QSound object is created from a sound file and is later be 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 and hence 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().

MEMBER FUNCTION DOCUMENTATION

QSound::QSound ( const QString & filename, QObject * parent=0, const char * name=0 )
Constructs a sound which can quickly play the sound in file named filename.

This can use more memory than the static play function.

The parent and name arguments (default 0) are passed on to the QObject constructor.

QSound::~QSound ()
Destructs the sound.

bool QSound::available () [static]
Returns TRUE if sound facilities exist on the platform. An application may choose to notify the user if sound is crucial the the application, or operate silently without bothering the user.

If no sound is available, QSound operation all work silently and quickly.

void QSound::play () [slot]
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]
Play the sound in file named filename.

SEE ALSO
http://doc.trolltech.com/qsound.html http://www.trolltech.com/faq/tech.html

COPYRIGHT
Copyright 1992-2001 Trolltech AS, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.

AUTHOR
Generated automatically from the source code.

BUGS
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports make our job much simpler. Thank you.

In case of content or formattting problems with this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qsound.3qt) and the Qt version (2.3.7).