<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>Wt: Wt::WSound Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { searchBox.OnSelectItem(0); }); </script> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">Wt  <span id="projectnumber">3.2.3</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.7.5.1 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="inherits.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespaceWt.html">Wt</a> </li> <li class="navelem"><a class="el" href="classWt_1_1WSound.html">WSound</a> </li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> </div> <div class="headertitle"> <div class="title">Wt::WSound Class Reference</div> </div> </div> <div class="contents"> <!-- doxytag: class="Wt::WSound" --><!-- doxytag: inherits="Wt::WObject" --> <p>A value class to play a sound effect. <a href="classWt_1_1WSound.html#details">More...</a></p> <p><code>#include <Wt/WSound></code></p> <div class="dynheader"> Inheritance diagram for Wt::WSound:</div> <div class="dyncontent"> <div class="center"><img src="classWt_1_1WSound__inherit__graph.png" border="0" usemap="#Wt_1_1WSound_inherit__map" alt="Inheritance graph"/></div> <map name="Wt_1_1WSound_inherit__map" id="Wt_1_1WSound_inherit__map"> <area shape="rect" href="classWt_1_1WObject.html" title="A base class for objects that participate in the signal/slot system." alt="" coords="5,5,101,32"/></map> <center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div> <p><a href="classWt_1_1WSound-members.html">List of all members.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSound.html#ae26e36590aaf75d0a5a346ac59594afc">WSound</a> (const std::string &url, <a class="el" href="classWt_1_1WObject.html">WObject</a> *parent=0)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Constructs a sound object that will play the given URL. <a href="#ae26e36590aaf75d0a5a346ac59594afc"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSound.html#ad2b9aa6ce656708845c21aff965e02ea">~WSound</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#ad2b9aa6ce656708845c21aff965e02ea"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">const std::string & </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSound.html#a1cf98567462319d880ddf3459bc8c8cb">url</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the sound url. <a href="#a1cf98567462319d880ddf3459bc8c8cb"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSound.html#a6cf72578210c7a6ff345372afa85d198">setLoops</a> (int number)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the amount of times the sound has to be repeated. <a href="#a6cf72578210c7a6ff345372afa85d198"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSound.html#a47126fa920874bfccf12c65ace9c9473">loops</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the configured number of repeats. <a href="#a47126fa920874bfccf12c65ace9c9473"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSound.html#a6ca6b48ebc9e49ee6745228961df3817">play</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Start asynchronous playback of the sound. <a href="#a6ca6b48ebc9e49ee6745228961df3817"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSound.html#a7c3ce5dc7204f5c156bffd71487e3f72">stop</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Stops playback of the sound. <a href="#a7c3ce5dc7204f5c156bffd71487e3f72"></a><br/></td></tr> </table> <hr/><a name="details" id="details"></a><h2>Detailed Description</h2> <div class="textblock"><p>A value class to play a sound effect. </p> <p>This class provides a way to play an MP3 sound asynchonously (if the browser supports this). It is intended as a simple way to play event sounds (not quite for a media center).</p> <p>This class uses a <a class="el" href="classWt_1_1WMediaPlayer.html" title="A media player.">WMediaPlayer</a> to play the sound (using HTML <audio> or a flash player).</p> <p>Usage example: </p> <div class="fragment"><pre class="fragment"> <a class="code" href="classWt_1_1WSound.html#ae26e36590aaf75d0a5a346ac59594afc" title="Constructs a sound object that will play the given URL.">WSound</a> *s = <span class="keyword">new</span> <a class="code" href="classWt_1_1WSound.html#ae26e36590aaf75d0a5a346ac59594afc" title="Constructs a sound object that will play the given URL.">WSound</a>(<span class="stringliteral">"djing.mp3"</span>, parent); s->setLoops(3); s->play(); playButton->clicked().connect(s, &<a class="code" href="classWt_1_1WSound.html#a6ca6b48ebc9e49ee6745228961df3817" title="Start asynchronous playback of the sound.">WSound::play</a>); stopButton->clicked().connect(s, &<a class="code" href="classWt_1_1WSound.html#a7c3ce5dc7204f5c156bffd71487e3f72" title="Stops playback of the sound.">WSound::stop</a>); </pre></div> </div><hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="ae26e36590aaf75d0a5a346ac59594afc"></a><!-- doxytag: member="Wt::WSound::WSound" ref="ae26e36590aaf75d0a5a346ac59594afc" args="(const std::string &url, WObject *parent=0)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">Wt::WSound::WSound </td> <td>(</td> <td class="paramtype">const std::string & </td> <td class="paramname"><em>url</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classWt_1_1WObject.html">WObject</a> * </td> <td class="paramname"><em>parent</em> = <code>0</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Constructs a sound object that will play the given URL. </p> <dl class="note"><dt><b>Note:</b></dt><dd>As of Wt 3.1.10, the <code>url</code> must specify an MP3 file. </dd></dl> </div> </div> <a class="anchor" id="ad2b9aa6ce656708845c21aff965e02ea"></a><!-- doxytag: member="Wt::WSound::~WSound" ref="ad2b9aa6ce656708845c21aff965e02ea" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">Wt::WSound::~WSound </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Destructor. </p> <p>Deleting a sound also stops it (if it was playing). </p> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a47126fa920874bfccf12c65ace9c9473"></a><!-- doxytag: member="Wt::WSound::loops" ref="a47126fa920874bfccf12c65ace9c9473" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int Wt::WSound::loops </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p>Returns the configured number of repeats. </p> <p><em><a class="el" href="classWt_1_1WSound.html#a6cf72578210c7a6ff345372afa85d198" title="Sets the amount of times the sound has to be repeated.">setLoops()</a></em> </p> </div> </div> <a class="anchor" id="a6ca6b48ebc9e49ee6745228961df3817"></a><!-- doxytag: member="Wt::WSound::play" ref="a6ca6b48ebc9e49ee6745228961df3817" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void Wt::WSound::play </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Start asynchronous playback of the sound. </p> <p>This method returns immediately. It will cause the sound to be played for the configured amount of <a class="el" href="classWt_1_1WSound.html#a47126fa920874bfccf12c65ace9c9473" title="Returns the configured number of repeats.">loops()</a>.</p> <p>The behavior of <a class="el" href="classWt_1_1WSound.html#a6ca6b48ebc9e49ee6745228961df3817" title="Start asynchronous playback of the sound.">play()</a> when a sound is already playing is undefind: it may be intermixed, sequentially queued, or a current playing sound may be stopped. It is recommended to call <a class="el" href="classWt_1_1WSound.html#a7c3ce5dc7204f5c156bffd71487e3f72" title="Stops playback of the sound.">stop()</a> before <a class="el" href="classWt_1_1WSound.html#a6ca6b48ebc9e49ee6745228961df3817" title="Start asynchronous playback of the sound.">play()</a> if you want to avoid mixing multiple instances of a single <a class="el" href="classWt_1_1WSound.html" title="A value class to play a sound effect.">WSound</a> object. </p> </div> </div> <a class="anchor" id="a6cf72578210c7a6ff345372afa85d198"></a><!-- doxytag: member="Wt::WSound::setLoops" ref="a6cf72578210c7a6ff345372afa85d198" args="(int number)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void Wt::WSound::setLoops </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"><em>number</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Sets the amount of times the sound has to be repeated. </p> <p>A call to <a class="el" href="classWt_1_1WSound.html#a6ca6b48ebc9e49ee6745228961df3817" title="Start asynchronous playback of the sound.">play()</a> will play the sound <code>number</code> of times. The default value is 1 (no repeats). </p> </div> </div> <a class="anchor" id="a7c3ce5dc7204f5c156bffd71487e3f72"></a><!-- doxytag: member="Wt::WSound::stop" ref="a7c3ce5dc7204f5c156bffd71487e3f72" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void Wt::WSound::stop </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Stops playback of the sound. </p> <p>This method returns immediately. It causes the current playback (if any) of the sound to be stopped. </p> </div> </div> <a class="anchor" id="a1cf98567462319d880ddf3459bc8c8cb"></a><!-- doxytag: member="Wt::WSound::url" ref="a1cf98567462319d880ddf3459bc8c8cb" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const std::string & Wt::WSound::url </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p>Returns the sound url. </p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WSound.html#ae26e36590aaf75d0a5a346ac59594afc" title="Constructs a sound object that will play the given URL.">WSound()</a> </dd></dl> </div> </div> </div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Enumerator</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <hr size="1"><address style="text-align: right; margin: 3px"><small> Generated on Thu Nov 1 2012 for <a href="http://www.webtoolkit.eu/wt">the C++ Web Toolkit (Wt)</a> by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" border="0" style="vertical-align: middle; display: inline-block; height: 2em"></a> 1.7.5.1</small></address> </body> </html>