TQSound(3qt)

NAME
TQSound - Access to the platform audio facilities

SYNOPSIS
#include <tqsound.h>

Inherits TQObject.

  Public Members
TQSound ( const TQString & filename, TQObject * parent = 0, const char * name = 0 )
~TQSound ()
int loops () const
int loopsRemaining () const
void setLoops ( int l )
TQString fileName () const
bool isFinished () const

  Public Slots
void play ()
void stop ()

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

DESCRIPTION
The TQSound 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:

        TQSound::play("mysounds/bells.wav");

A second API is provided in which a TQSound object is created from a sound file and is played later:

        TQSound 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.

The availability of sound can be tested with TQSound::isAvailable().

See also Multimedia Classes.

MEMBER FUNCTION DOCUMENTATION

TQSound::TQSound ( const TQString & filename, TQObject * parent = 0, const char * name = 0 )
Constructs a TQSound that can quickly play the sound in a file named filename.

This may use more memory than the static play function.

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

TQSound::~TQSound ()
Destroys the sound object. If the sound is not finished playing stop() is called on it.

See also stop() and isFinished().

bool TQSound::available () [static]
Returns true if sound support is available; otherwise returns false.

TQString TQSound::fileName () const
Returns the filename associated with the sound.

bool TQSound::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 TQSound operations work silently and quickly.

bool TQSound::isFinished () const
Returns true if the sound has finished playing; otherwise returns false.

Warning: On Windows this function always returns true for unlooped sounds.

int TQSound::loops () const
Returns the number of times the sound will play.

int TQSound::loopsRemaining () const
Returns the number of times the sound will loop. This value decreases each time the sound loops.

void TQSound::play ( const TQString & filename ) [static]
Plays the sound in a file called filename.

Example: sound/sound.cpp.

void TQSound::play () [slot]
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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 TQSound::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.

See also loops().

void TQSound::stop () [slot]
Stops the sound playing.

On Windows the current loop will finish if a sound is played in a loop.

See also play().

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

COPYRIGHT
Copyright 1992-2007 Trolltech ASA, 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 help us to help you. Thank you.

The definitive TQt documentation is provided in HTML format; it is located at $TQTDIR/doc/html and can be read using TQt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.

If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (tqsound.3qt) and the Qt version (3.3.8).