You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
166 lines
5.5 KiB
166 lines
5.5 KiB
'\" t
|
|
.TH TQSound 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
|
|
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
|
|
.\" license file included in the distribution for a complete license
|
|
.\" statement.
|
|
.\"
|
|
.ad l
|
|
.nh
|
|
.SH NAME
|
|
TQSound \- Access to the platform audio facilities
|
|
.SH SYNOPSIS
|
|
\fC#include <tqsound.h>\fR
|
|
.PP
|
|
Inherits TQObject.
|
|
.PP
|
|
.SS "Public Members"
|
|
.in +1c
|
|
.ti -1c
|
|
.BI "\fBTQSound\fR ( const TQString & filename, TQObject * parent = 0, const char * name = 0 )"
|
|
.br
|
|
.ti -1c
|
|
.BI "\fB~TQSound\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "int \fBloops\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "int \fBloopsRemaining\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBsetLoops\fR ( int l )"
|
|
.br
|
|
.ti -1c
|
|
.BI "TQString \fBfileName\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBisFinished\fR () const"
|
|
.br
|
|
.in -1c
|
|
.SS "Public Slots"
|
|
.in +1c
|
|
.ti -1c
|
|
.BI "void \fBplay\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBstop\fR ()"
|
|
.br
|
|
.in -1c
|
|
.SS "Static Public Members"
|
|
.in +1c
|
|
.ti -1c
|
|
.BI "bool \fBisAvailable\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBplay\fR ( const TQString & filename )"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBavailable\fR ()"
|
|
.br
|
|
.in -1c
|
|
.SH DESCRIPTION
|
|
The TQSound class provides access to the platform audio facilities.
|
|
.PP
|
|
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:
|
|
.PP
|
|
.nf
|
|
.br
|
|
TQSound::play("mysounds/bells.wav");
|
|
.br
|
|
.fi
|
|
.PP
|
|
A second API is provided in which a TQSound object is created from a sound file and is played later:
|
|
.PP
|
|
.nf
|
|
.br
|
|
TQSound bells("mysounds/bells.wav");
|
|
.br
|
|
.br
|
|
bells.play();
|
|
.br
|
|
.fi
|
|
.PP
|
|
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.
|
|
.PP
|
|
On Microsoft Windows the underlying multimedia system is used; only WAVE format sound files are supported.
|
|
.PP
|
|
On X11 the Network Audio System is used if available, otherwise all operations work silently. NAS supports WAVE and AU files.
|
|
.PP
|
|
On Macintosh, ironically, we use QT (QuickTime) for sound, this means all QuickTime formats are supported by Qt/Mac.
|
|
.PP
|
|
The availability of sound can be tested with TQSound::isAvailable().
|
|
.PP
|
|
See also Multimedia Classes.
|
|
.SH MEMBER FUNCTION DOCUMENTATION
|
|
.SH "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 \fIfilename\fR.
|
|
.PP
|
|
This may use more memory than the static \fCplay\fR function.
|
|
.PP
|
|
The \fIparent\fR and \fIname\fR arguments (default 0) are passed on to the TQObject constructor.
|
|
.SH "TQSound::~TQSound ()"
|
|
Destroys the sound object. If the sound is not finished playing stop() is called on it.
|
|
.PP
|
|
See also stop() and isFinished().
|
|
.SH "bool TQSound::available ()\fC [static]\fR"
|
|
Returns TRUE if sound support is available; otherwise returns FALSE.
|
|
.SH "TQString TQSound::fileName () const"
|
|
Returns the filename associated with the sound.
|
|
.SH "bool TQSound::isAvailable ()\fC [static]\fR"
|
|
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.
|
|
.PP
|
|
If no sound is available, all TQSound operations work silently and quickly.
|
|
.SH "bool TQSound::isFinished () const"
|
|
Returns TRUE if the sound has finished playing; otherwise returns FALSE.
|
|
.PP
|
|
\fBWarning:\fR On Windows this function always returns TRUE for unlooped sounds.
|
|
.SH "int TQSound::loops () const"
|
|
Returns the number of times the sound will play.
|
|
.SH "int TQSound::loopsRemaining () const"
|
|
Returns the number of times the sound will loop. This value decreases each time the sound loops.
|
|
.SH "void TQSound::play ( const TQString & filename )\fC [static]\fR"
|
|
Plays the sound in a file called \fIfilename\fR.
|
|
.PP
|
|
Example: sound/sound.cpp.
|
|
.SH "void TQSound::play ()\fC [slot]\fR"
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
.PP
|
|
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.
|
|
.PP
|
|
The sound can be played again at any time, possibly mixing or replacing previous plays of the sound.
|
|
.SH "void TQSound::setLoops ( int l )"
|
|
Sets the sound to repeat \fIl\fR times when it is played. Passing the value -1 will cause the sound to loop indefinitely.
|
|
.PP
|
|
See also loops().
|
|
.SH "void TQSound::stop ()\fC [slot]\fR"
|
|
Stops the sound playing.
|
|
.PP
|
|
On Windows the current loop will finish if a sound is played in a loop.
|
|
.PP
|
|
See also play().
|
|
|
|
.SH "SEE ALSO"
|
|
.BR http://doc.trolltech.com/tqsound.html
|
|
.BR http://www.trolltech.com/faq/tech.html
|
|
.SH COPYRIGHT
|
|
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
|
|
license file included in the distribution for a complete license
|
|
statement.
|
|
.SH AUTHOR
|
|
Generated automatically from the source code.
|
|
.SH BUGS
|
|
If you find a bug in Qt, please report it as described in
|
|
.BR http://doc.trolltech.com/bughowto.html .
|
|
Good bug reports help us to help you. Thank you.
|
|
.P
|
|
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.
|
|
.P
|
|
If you find errors in this manual page, please report them to
|
|
.BR qt-bugs@trolltech.com .
|
|
Please include the name of the manual page (tqsound.3qt) and the Qt
|
|
version (3.3.8).
|