Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > 8e6051afcdb111a0317a58fb64c2abf5 > files > 4863

qt4-doc-4.6.3-0.2mdv2010.2.i586.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- qsound.cpp -->
<head>
  <title>Qt 4.6: QSound Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a name="//apple_ref/cpp/cl//QSound"></a>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">All&nbsp;Functions</font></a>&nbsp;&middot; <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">QSound Class Reference<br /><span class="small-subtitle">[<a href="qtgui.html">QtGui</a> module]</span>
</h1>
<p>The QSound class provides access to the platform audio facilities. <a href="#details">More...</a></p>
<pre> #include &lt;QSound&gt;</pre><p>Inherits <a href="qobject.html">QObject</a>.</p>
<ul>
<li><a href="qsound-members.html">List of all members, including inherited members</a></li>
<li><a href="qsound-qt3.html">Qt 3 support members</a></li>
</ul>
<hr />
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qsound.html#QSound">QSound</a></b> ( const QString &amp; <i>filename</i>, QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qsound.html#dtor.QSound">~QSound</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsound.html#fileName">fileName</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsound.html#isFinished">isFinished</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qsound.html#loops">loops</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qsound.html#loopsRemaining">loopsRemaining</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsound.html#setLoops">setLoops</a></b> ( int <i>number</i> )</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<hr />
<a name="public-slots"></a>
<h2>Public Slots</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsound.html#play-2">play</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsound.html#stop">stop</a></b> ()</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<hr />
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsound.html#isAvailable">isAvailable</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsound.html#play">play</a></b> ( const QString &amp; <i>filename</i> )</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"></div>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li><div class="fn"></div>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li><div class="fn"></div>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<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(&quot;mysounds/bells.wav&quot;);</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(&quot;mysounds/bells.wav&quot;);
 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&#x2e; 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 class="generic" align="center" cellpadding="2" cellspacing="1" border="0">
<thead><tr valign="top" class="qt-style"><th>Platform</th><th>Audio Facility</th></tr></thead>
<tr valign="top" class="odd"><td>Microsoft Windows</td><td>The underlying multimedia system is used; only WAVE format sound files are supported.</td></tr>
<tr valign="top" class="even"><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 valign="top" class="odd"><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 valign="top" class="even"><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 valign="top" class="odd"><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>Member Function Documentation</h2>
<a name="//apple_ref/cpp/instm/QSound/QSound"></a>
<h3 class="fn"><a name="QSound"></a>QSound::QSound ( const <a href="qstring.html">QString</a> &amp; <i>filename</i>, <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
<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"></a>
<h3 class="fn"><a name="dtor.QSound"></a>QSound::~QSound ()</h3>
<p>Destroys this sound object. If the sound is not finished playing, the <a href="qsound.html#stop">stop</a>() function is called before the sound object is destructed.</p>
<p>See also <a href="qsound.html#stop">stop</a>() and <a href="qsound.html#isFinished">isFinished</a>().</p>
<a name="//apple_ref/cpp/instm/QSound/fileName"></a>
<h3 class="fn"><a name="fileName"></a><a href="qstring.html">QString</a> QSound::fileName () const</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"></a>
<h3 class="fn"><a name="isAvailable"></a>bool QSound::isAvailable ()&nbsp;&nbsp;<tt> [static]</tt></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"></a>
<h3 class="fn"><a name="isFinished"></a>bool QSound::isFinished () const</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"></a>
<h3 class="fn"><a name="loops"></a>int QSound::loops () const</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"></a>
<h3 class="fn"><a name="loopsRemaining"></a>int QSound::loopsRemaining () const</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"></a>
<h3 class="fn"><a name="play"></a>void QSound::play ( const <a href="qstring.html">QString</a> &amp; <i>filename</i> )&nbsp;&nbsp;<tt> [static]</tt></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"></a>void QSound::play ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
<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"></a>
<h3 class="fn"><a name="setLoops"></a>void QSound::setLoops ( int <i>number</i> )</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"></a>
<h3 class="fn"><a name="stop"></a>void QSound::stop ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
<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 width="100%" cellspacing="0" border="0"><tr class="address">
<td width="40%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="40%" align="right"><div align="right">Qt 4.6.3</div></td>
</tr></table></div></address></body>
</html>