1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qsound.cpp:97 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QSound Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QSound Class Reference</h1>
<p>The QSound class provides access to the platform audio facilities.
<a href="#details">More...</a>
<p><tt>#include <<a href="qsound-h.html">qsound.h</a>></tt>
<p>Inherits <a href="qobject.html">QObject</a>.
<p><a href="qsound-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QSound"><b>QSound</b></a> ( const QString & filename, QObject * parent = 0, const char * name = 0 )</li>
<li class=fn><a href="#~QSound"><b>~QSound</b></a> ()</li>
<li class=fn>int <a href="#loops"><b>loops</b></a> () const</li>
<li class=fn>int <a href="#loopsRemaining"><b>loopsRemaining</b></a> () const</li>
<li class=fn>void <a href="#setLoops"><b>setLoops</b></a> ( int l )</li>
<li class=fn>QString <a href="#fileName"><b>fileName</b></a> () const</li>
<li class=fn>bool <a href="#isFinished"><b>isFinished</b></a> () const</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>void <a href="#play-2"><b>play</b></a> ()</li>
<li class=fn>void <a href="#stop"><b>stop</b></a> ()</li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li class=fn>bool <a href="#isAvailable"><b>isAvailable</b></a> ()</li>
<li class=fn>void <a href="#play"><b>play</b></a> ( const QString & filename )</li>
<li class=fn>bool <a href="#available"><b>available</b></a> ()</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The QSound class provides access to the platform audio facilities.
<p>
<p> 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:
<pre>
QSound::<a href="#play">play</a>("mysounds/bells.wav");
</pre>
<p> A second API is provided in which a QSound object is created from
a sound file and is played later:
<pre>
QSound bells("mysounds/bells.wav");
bells.<a href="#play">play</a>();
</pre>
<p> 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.
<p> On Microsoft Windows the underlying multimedia system is used;
only WAVE format sound files are supported.
<p> On X11 the <a href="ftp://ftp.x.org/contrib/audio/nas/">Network Audio
System</a> is used if available, otherwise all operations work
silently. NAS supports WAVE and AU files.
<p> On Macintosh, ironically, we use QT (<a href="http://quicktime.apple.com">QuickTime</a>) for sound, this
means all QuickTime formats are supported by Qt/Mac.
<p> On Qt/Embedded, a built-in mixing sound server is used, which
accesses <tt>/dev/dsp</tt> directly. Only the WAVE format is supported.
<p> The availability of sound can be tested with
<a href="#isAvailable">QSound::isAvailable</a>().
<p>See also <a href="multimedia.html">Multimedia Classes</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QSound"></a>QSound::QSound ( const <a href="qstring.html">QString</a> & filename, <a href="qobject.html">QObject</a> * parent = 0, const char * name = 0 )
</h3>
Constructs a QSound that can quickly play the sound in a file
named <em>filename</em>.
<p> This may use more memory than the static <tt>play</tt> function.
<p> The <em>parent</em> and <em>name</em> arguments (default 0) are passed on to
the <a href="qobject.html">QObject</a> constructor.
<h3 class=fn><a name="~QSound"></a>QSound::~QSound ()
</h3>
Destroys the sound object. If the sound is not finished playing <a href="#stop">stop</a>() is called on it.
<p> <p>See also <a href="#stop">stop</a>() and <a href="#isFinished">isFinished</a>().
<h3 class=fn>bool <a name="available"></a>QSound::available ()<tt> [static]</tt>
</h3>
<p> Returns TRUE if sound support is available; otherwise returns FALSE.
<h3 class=fn><a href="qstring.html">QString</a> <a name="fileName"></a>QSound::fileName () const
</h3>
Returns the filename associated with the sound.
<h3 class=fn>bool <a name="isAvailable"></a>QSound::isAvailable ()<tt> [static]</tt>
</h3>
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.
<p> If no sound is available, all QSound operations work silently and
quickly.
<h3 class=fn>bool <a name="isFinished"></a>QSound::isFinished () const
</h3>
Returns TRUE if the sound has finished playing; otherwise returns FALSE.
<p> <b>Warning:</b> On Windows this function always returns TRUE for unlooped sounds.
<h3 class=fn>int <a name="loops"></a>QSound::loops () const
</h3>
Returns the number of times the sound will play.
<h3 class=fn>int <a name="loopsRemaining"></a>QSound::loopsRemaining () const
</h3>
Returns the number of times the sound will loop. This value
decreases each time the sound loops.
<h3 class=fn>void <a name="play"></a>QSound::play ( const <a href="qstring.html">QString</a> & filename )<tt> [static]</tt>
</h3>
Plays the sound in a file called <em>filename</em>.
<p>Example: <a href="sound-example.html#x2813">sound/sound.cpp</a>.
<h3 class=fn>void <a name="play-2"></a>QSound::play ()<tt> [slot]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> 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.
<p> The sound can be played again at any time, possibly mixing or
replacing previous plays of the sound.
<h3 class=fn>void <a name="setLoops"></a>QSound::setLoops ( int l )
</h3>
Sets the sound to repeat <em>l</em> times when it is played. Passing the
value -1 will cause the sound to loop indefinitely.
<p> <p>See also <a href="#loops">loops</a>().
<h3 class=fn>void <a name="stop"></a>QSound::stop ()<tt> [slot]</tt>
</h3>
Stops the sound playing.
<p> On Windows the current loop will finish if a sound is played
in a loop.
<p> <p>See also <a href="#play">play</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright © 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright © 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>
|