Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 6377

qt4-doc-4.8.7-26.2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qsound.cpp -->
  <title>Qt 4.8: QSound Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QSound</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QSound Class Reference</h1>
<!-- $$$QSound-brief -->
<p>The QSound class provides access to the platform audio facilities. <a href="#details">More...</a></p>
<!-- @@@QSound -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QSound&gt;</span></pre><p><b>Inherits: </b><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>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsound.html#dtor.QSound">~QSound</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qsound.html#fileName">fileName</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsound.html#isFinished">isFinished</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsound.html#loops">loops</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsound.html#loopsRemaining">loopsRemaining</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsound.html#setLoops">setLoops</a></b> ( int <i>number</i> )</td></tr>
</table>
<ul>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<a name="public-slots"></a>
<h2>Public Slots</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsound.html#play-2">play</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsound.html#stop">stop</a></b> ()</td></tr>
</table>
<ul>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsound.html#isAvailable">isAvailable</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsound.html#play">play</a></b> ( const QString &amp; <i>filename</i> )</td></tr>
</table>
<ul>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QSound-description -->
<div class="descr">
<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 class="cpp"> <span class="type">QSound</span><span class="operator">::</span><a href="qsound.html#play">play</a>(<span class="string">&quot;mysounds/bells.wav&quot;</span>);</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 class="cpp"> <span class="type">QSound</span> bells(<span class="string">&quot;mysounds/bells.wav&quot;</span>);
 bells<span class="operator">.</span><a href="qsound.html#play">play</a>();</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>
<table class="generic">
<thead><tr 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>Note that QSound does not support <a href="resources.html">resources</a>. This might be fixed in a future Qt version.</p>
</div>
<!-- @@@QSound -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QSound[overload1]$$$QSoundconstQString&QObject* -->
<h3 class="fn"><a name="QSound"></a>QSound::<span class="name">QSound</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>filename</i>, <span class="type"><a href="qobject.html">QObject</a></span> * <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><b>See also </b><a href="qsound.html#play">play</a>().</p>
<!-- @@@QSound -->
<!-- $$$~QSound[overload1]$$$~QSound -->
<h3 class="fn"><a name="dtor.QSound"></a>QSound::<span class="name">~QSound</span> ()</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><b>See also </b><a href="qsound.html#stop">stop</a>() and <a href="qsound.html#isFinished">isFinished</a>().</p>
<!-- @@@~QSound -->
<!-- $$$fileName[overload1]$$$fileName -->
<h3 class="fn"><a name="fileName"></a><span class="type"><a href="qstring.html">QString</a></span> QSound::<span class="name">fileName</span> () const</h3>
<p>Returns the filename associated with this <a href="qsound.html">QSound</a> object.</p>
<p><b>See also </b><a href="qsound.html#QSound">QSound</a>().</p>
<!-- @@@fileName -->
<!-- $$$isAvailable[overload1]$$$isAvailable -->
<h3 class="fn"><a name="isAvailable"></a><span class="type">bool</span> QSound::<span class="name">isAvailable</span> ()<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>
<!-- @@@isAvailable -->
<!-- $$$isFinished[overload1]$$$isFinished -->
<h3 class="fn"><a name="isFinished"></a><span class="type">bool</span> QSound::<span class="name">isFinished</span> () 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>
<!-- @@@isFinished -->
<!-- $$$loops[overload1]$$$loops -->
<h3 class="fn"><a name="loops"></a><span class="type">int</span> QSound::<span class="name">loops</span> () const</h3>
<p>Returns the number of times the sound will play.</p>
<p><b>See also </b><a href="qsound.html#loopsRemaining">loopsRemaining</a>() and <a href="qsound.html#setLoops">setLoops</a>().</p>
<!-- @@@loops -->
<!-- $$$loopsRemaining[overload1]$$$loopsRemaining -->
<h3 class="fn"><a name="loopsRemaining"></a><span class="type">int</span> QSound::<span class="name">loopsRemaining</span> () const</h3>
<p>Returns the remaining number of times the sound will loop (this value decreases each time the sound is played).</p>
<p><b>See also </b><a href="qsound.html#loops">loops</a>() and <a href="qsound.html#isFinished">isFinished</a>().</p>
<!-- @@@loopsRemaining -->
<!-- $$$play[overload1]$$$playconstQString& -->
<h3 class="fn"><a name="play"></a><span class="type">void</span> QSound::<span class="name">play</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>filename</i> )<tt> [static]</tt></h3>
<p>Plays the sound stored in the file specified by the given <i>filename</i>.</p>
<p><b>See also </b><a href="qsound.html#stop">stop</a>(), <a href="qsound.html#loopsRemaining">loopsRemaining</a>(), and <a href="qsound.html#isFinished">isFinished</a>().</p>
<!-- @@@play -->
<!-- $$$play$$$play -->
<h3 class="fn"><a name="play-2"></a><span class="type">void</span> QSound::<span class="name">play</span> ()<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><b>See also </b><a href="qsound.html#fileName">fileName</a>().</p>
<!-- @@@play -->
<!-- $$$setLoops[overload1]$$$setLoopsint -->
<h3 class="fn"><a name="setLoops"></a><span class="type">void</span> QSound::<span class="name">setLoops</span> ( <span class="type">int</span> <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><b>See also </b><a href="qsound.html#loops">loops</a>().</p>
<!-- @@@setLoops -->
<!-- $$$stop[overload1]$$$stop -->
<h3 class="fn"><a name="stop"></a><span class="type">void</span> QSound::<span class="name">stop</span> ()<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><b>See also </b><a href="qsound.html#play">play</a>().</p>
<!-- @@@stop -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
      Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Qt and respective logos are trademarks of The Qt Company Ltd 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>