QSound(3qt)
β¨ QSound β it's a Qt 3 thing bestie π
okay so welcome to the qsound.3qt manual page, and yes it's giving "old school Qt", it's from the Qt library, section 3qt, and it's literally all about making noises happen on your computer π
πΈ NAME πΈ
QSound β your lil backstage pass to the platform audio facilities π
π¦ SYNOPSIS π¦
#include <qsound.h>
and heads up: it Inherits QObject π
π Public Members
QSound ( const QString & filename, QObject * parent = 0, const char *
name = 0 )
~QSound ()
int loops () const
int loopsRemaining () const
void setLoops ( int l )
QString fileName () const
bool isFinished () const
π Public Slots
void play ()
void stop ()
π Static Public Members
bool isAvailable ()
void play ( const QString & filename )
bool available ()
π DESCRIPTION π
so the QSound class provides access to the platform audio facilities. that's the whole vibe β¨
Qt gives you the audio operation you're gonna need in GUI apps like 99% of the time: playing a sound file asynchronously. and the easiest way to do that is literally one single call, no cap:
QSound::play("mysounds/bells.wav");
then there's a second API, where you build a whole QSound object out of a sound file and play it later on:
QSound bells("mysounds/bells.wav");
bells.play();
sounds played the second way (the object way) may use more memory, but they play more immediately than sounds played the first way β it lowkey depends on the underlying platform audio facilities, so like, platform-dependent bestie π€·
- 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 (π yes, silently). NAS supports WAVE and AU files.
- On Macintosh, ironically, we use QT (QuickTime) for sound, which means all QuickTime formats are supported by Qt/Mac. ironic and iconic π
- On Qt/Embedded, a built-in mixing sound server is used, which accesses
/dev/dspdirectly. Only the WAVE format is supported.
you can test whether sound is even a thing with QSound::isAvailable(). vibe check first, always π₯
See also Multimedia Classes.
π§ MEMBER FUNCTION DOCUMENTATION π§
QSound::QSound ( const QString & filename, QObject * parent = 0, const char * name = 0 )
Constructs a QSound that can quickly play the sound in a file named filename.
ngl this may use more memory than the static play function. tradeoffs, bestie.
the parent and name arguments (default 0) are passed on to the QObject constructor. π«Ά
QSound::~QSound ()
Destroys the sound object. and if the sound is not finished playing, stop() is called on it. no lingering audio jumpscares π
See also stop() and isFinished().
bool QSound::available () [static]
Returns TRUE if sound support is available; otherwise returns FALSE. periodt.
QString QSound::fileName () const
Returns the filename associated with the sound. π
bool QSound::isAvailable () [static]
Returns TRUE if sound facilities exist on the platform; otherwise returns FALSE. your app can choose either to notify the user if sound is crucial to the application, or to just operate silently without bothering the user. main character decision, honestly.
and if no sound is available, all QSound operations work silently and quickly. so like, it just ghosts you but politely π
bool QSound::isFinished () const
Returns TRUE if the sound has finished playing; otherwise returns FALSE.
β οΈ Warning: On Windows this function always returns TRUE for unlooped sounds. not a drill, that's the actual behaviour.
int QSound::loops () const
Returns the number of times the sound will play. π
int QSound::loopsRemaining () const
Returns the number of times the sound will loop. This value decreases each time the sound loops. the countdown is real π
void QSound::play ( const QString & filename ) [static]
Plays the sound in a file called filename.
Example: sound/sound.cpp.
void QSound::play () [slot]
This is an overloaded member function, provided for convenience. It behaves essentially like the above function. (iykyk β¨)
Starts the sound playing. The function returns immediately β it does not wait around for the audio to finish, she has places to be. 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. replay value: infinite π
void QSound::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 π³ forever girlie.
See also loops().
void QSound::stop () [slot]
Stops the sound playing. bye π
On Windows the current loop will finish if a sound is played in a loop. so it's less "stop" and more "stop after this lap", fr fr.
See also play().
π₯ SEE ALSO π₯
π 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. (yes, a robot wrote it, and honestly? slay π€β¨)
π 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 Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt 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. (man page girlies, we're on our own out here π)
If you find errors in 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 (3.3.8).
okay that's the whole page bestie π shoutout to Trolltech AS, this was dated 2 February 2007, and it's from Qt version 3.3.8 β so when you're out here reading QSound(3qt), just know you're reading a certified vintage classic. mwah π
ππΈ
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms