Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 3f684444755c5ad1181cdd5a97348f3c > files > 1450

PyQt4-devel-4.7.4-2.fc14.i686.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QSound Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QSound Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QSound class provides access to the platform audio facilities. <a href="#details">More...</a></p>
<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qsound.html#QSound">__init__</a></b> (<i>self</i>, QString, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />QString <b><a href="qsound.html#fileName">fileName</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsound.html#isFinished">isFinished</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qsound.html#loops">loops</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qsound.html#loopsRemaining">loopsRemaining</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsound.html#play-2">play</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsound.html#setLoops">setLoops</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qsound.html#stop">stop</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />bool <b><a href="qsound.html#isAvailable">isAvailable</a></b> ()</li><li><div class="fn" /><b><a href="qsound.html#play">play</a></b> (QString)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>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 using the static <a href="qsound.html#play">play</a>() function:</p>
<pre> QSound.play("mysounds/bells.wav");</pre>
<p>Alternatively, create a QSound object from the sound file first and then call the <a href="qsound.html#play">play</a>() slot:</p>
<pre> QSound bells("mysounds/bells.wav");
 bells.play();</pre>
<p>Once created a QSound object can be queried for its <a href="qsound.html#fileName">fileName</a>() and total number of <a href="qsound.html#loops">loops</a>() (i.e. the number of times the sound will play). The number of repetitions can be altered using the <a href="qsound.html#setLoops">setLoops</a>() function. While playing the sound, the <a href="qsound.html#loopsRemaining">loopsRemaining</a>() function returns the remaining number of repetitions. Use the <a href="qsound.html#isFinished">isFinished</a>() function to determine whether the sound has finished playing.</p>
<p>Sounds played using a QSound object may use more memory than the static <a href="qsound.html#play">play</a>() function, but it may also play more immediately (depending on the underlying platform audio facilities). Use the static <a href="qsound.html#isAvailable">isAvailable</a>() function to determine whether sound facilities exist on the platform. Which facilities that are actually used varies:</p>
<p><table align="center" border="0" cellpadding="2" cellspacing="1" class="generic">
<thead><tr class="qt-style" valign="top"><th>Platform</th><th>Audio Facility</th></tr></thead>
<tr class="odd" valign="top"><td>Microsoft Windows</td><td>The underlying multimedia system is used; only WAVE format sound files are supported.</td></tr>
<tr class="even" valign="top"><td>X11</td><td>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.</td></tr>
<tr class="odd" valign="top"><td>Mac OS X</td><td>NSSound is used. All formats that NSSound supports, including QuickTime formats, are supported by Qt for Mac OS X.</td></tr>
<tr class="even" valign="top"><td>Qt for Embedded Linux</td><td>A built-in mixing sound server is used, accessing <tt>/dev/dsp</tt> directly. Only the WAVE format is supported.</td></tr>
<tr class="odd" valign="top"><td>Symbian</td><td>CMdaAudioPlayerUtility is used. All formats that Symbian OS or devices support are supported also by Qt.</td></tr>
</table></p>
<p>Note that QSound does not support <a href="resources.html">resources</a>. This might be fixed in a future Qt version.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QSound" />QSound.__init__ (<i>self</i>, QString, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a <a href="qsound.html">QSound</a> object from the file specified by the given <i>filename</i> and with the given <i>parent</i>.</p>
<p>This may use more memory than the static <a href="qsound.html#play">play</a>() function, but it may also play more immediately (depending on the underlying platform audio facilities).</p>
<p>See also <a href="qsound.html#play">play</a>().</p>
<a name="//apple_ref/cpp/instm/QSound/~QSound" />
<h3 class="fn"><a name="fileName" />QString QSound.fileName (<i>self</i>)</h3><p>Returns the filename associated with this <a href="qsound.html">QSound</a> object.</p>
<p>See also <a href="qsound.html#QSound">QSound</a>().</p>
<a name="//apple_ref/cpp/clm/QSound/isAvailable" />
<h3 class="fn"><a name="isAvailable" />bool QSound.isAvailable ()</h3><p>Returns true if sound facilities exist on the platform; otherwise returns false.</p>
<p>If no sound is available, all <a href="qsound.html">QSound</a> operations work silently and quickly. 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>
<p>Note: On Windows this always returns true because some sound card drivers do not implement a way to find out whether it is available or not.</p>
<a name="//apple_ref/cpp/instm/QSound/isFinished" />
<h3 class="fn"><a name="isFinished" />bool QSound.isFinished (<i>self</i>)</h3><p>Returns true if the sound has finished playing; otherwise returns false.</p>
<p><b>Warning:</b> On Windows this function always returns true for unlooped sounds.</p>
<a name="//apple_ref/cpp/instm/QSound/loops" />
<h3 class="fn"><a name="loops" />int QSound.loops (<i>self</i>)</h3><p>Returns the number of times the sound will play.</p>
<p>See also <a href="qsound.html#loopsRemaining">loopsRemaining</a>() and <a href="qsound.html#setLoops">setLoops</a>().</p>
<a name="//apple_ref/cpp/instm/QSound/loopsRemaining" />
<h3 class="fn"><a name="loopsRemaining" />int QSound.loopsRemaining (<i>self</i>)</h3><p>Returns the remaining number of times the sound will loop (this value decreases each time the sound is played).</p>
<p>See also <a href="qsound.html#loops">loops</a>() and <a href="qsound.html#isFinished">isFinished</a>().</p>
<a name="//apple_ref/cpp/clm/QSound/play" />
<h3 class="fn"><a name="play" />QSound.play (QString)</h3><p>Plays the sound stored in the file specified by the given <i>filename</i>.</p>
<p>See also <a href="qsound.html#stop">stop</a>(), <a href="qsound.html#loopsRemaining">loopsRemaining</a>(), and <a href="qsound.html#isFinished">isFinished</a>().</p>
<h3 class="fn"><a name="play-2" />QSound.play (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void play()</tt>.</p><p>This is an overloaded function.</p>
<p>Starts playing the sound specified by this <a href="qsound.html">QSound</a> object.</p>
<p>The function returns immediately. Depending on the platform audio facilities, other sounds may stop or be mixed with the new sound. The sound can be played again at any time, possibly mixing or replacing previous plays of the sound.</p>
<p>See also <a href="qsound.html#fileName">fileName</a>().</p>
<a name="//apple_ref/cpp/instm/QSound/setLoops" />
<h3 class="fn"><a name="setLoops" />QSound.setLoops (<i>self</i>, int)</h3><p>Sets the sound to repeat the given <i>number</i> of times when it is played.</p>
<p>Note that passing the value -1 will cause the sound to loop indefinitely.</p>
<p>See also <a href="qsound.html#loops">loops</a>().</p>
<a name="//apple_ref/cpp/instm/QSound/stop" />
<h3 class="fn"><a name="stop" />QSound.stop (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void stop()</tt>.</p><p>Stops the sound playing.</p>
<p>Note that on Windows the current loop will finish if a sound is played in a loop.</p>
<p>See also <a href="qsound.html#play">play</a>().</p>
<p /><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.7.4 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt&#160;4.6.3</td></tr></table></div></address></body></html>