source: trunk/doc/html/qsound.html@ 208

Last change on this file since 208 was 190, checked in by rudi, 14 years ago

reference documentation added

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