summaryrefslogtreecommitdiffstats
path: root/doc/html/qsound.html
blob: e84f634d7c1cedd0110fd17c1a7b9837a09b8127 (plain)
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>TQSound 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&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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>TQSound Class Reference</h1>

<p>The TQSound class provides access to the platform audio facilities.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qsound-h.html">qsound.h</a>&gt;</tt>
<p>Inherits <a href="qobject.html">TQObject</a>.
<p><a href="qsound-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQSound"><b>TQSound</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;filename, TQObject&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn><a href="#~TQSound"><b>~TQSound</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&nbsp;l )</li>
<li class=fn>TQString <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&nbsp;TQString&nbsp;&amp;&nbsp;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 TQSound class provides access to the platform audio facilities.
<p> 

<p> TQt provides the most commonly retquired audio operation in GUI
applications: asynchronously playing a sound file. This is most
easily accomplished with a single call:
<pre>
        TQSound::<a href="#play">play</a>("mysounds/bells.wav");
    </pre>
 
<p> A second API is provided in which a TQSound object is created from
a sound file and is played later:
<pre>
        TQSound 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://tquicktime.apple.com">QuickTime</a>) for sound, this
means all QuickTime formats are supported by TQt/Mac.
<p> On TQt/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">TQSound::isAvailable</a>().
<p>See also <a href="multimedia.html">Multimedia Classes</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQSound"></a>TQSound::TQSound ( const&nbsp;<a href="qstring.html">TQString</a>&nbsp;&amp;&nbsp;filename, <a href="qobject.html">TQObject</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a TQSound that can tquickly 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">TQObject</a> constructor.

<h3 class=fn><a name="~TQSound"></a>TQSound::~TQSound ()
</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>TQSound::available ()<tt> [static]</tt>
</h3>

<p> Returns TRUE if sound support is available; otherwise returns FALSE.

<h3 class=fn><a href="qstring.html">TQString</a> <a name="fileName"></a>TQSound::fileName () const
</h3>
Returns the filename associated with the sound.

<h3 class=fn>bool <a name="isAvailable"></a>TQSound::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 TQSound operations work silently and
tquickly.

<h3 class=fn>bool <a name="isFinished"></a>TQSound::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>TQSound::loops () const
</h3>
Returns the number of times the sound will play.

<h3 class=fn>int <a name="loopsRemaining"></a>TQSound::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>TQSound::play ( const&nbsp;<a href="qstring.html">TQString</a>&nbsp;&amp;&nbsp;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>TQSound::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>TQSound::setLoops ( int&nbsp;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>TQSound::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">TQt toolkit</a>.
Copyright &copy; 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 &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>