chromium/native_client_sdk/doc_generated/pepper_stable/cpp/classpp_1_1_audio.html

{{+bindTo:partials.standard_nacl_api}}
<h1>pp::Audio Class Reference</h1>
<div id="doxygen-ref">
{{- dummy div to appease doxygen -}}
  <div>
<!-- Generated by Doxygen 1.7.6.1 -->



</div>
<!--header-->
<div class="contents">
<!-- doxytag: class="pp::Audio" --><!-- doxytag: inherits="pp::Resource" --><div class="dynheader">
Inheritance diagram for pp::Audio:</div>
<div class="dyncontent">
<div class="center"><img src="classpp_1_1_audio__inherit__graph.png" border="0" usemap="#pp_1_1_audio_inherit__map" alt="Inheritance graph" /></div>
<map name="pp_1_1_audio_inherit__map" id="pp_1_1_audio_inherit__map">
<area shape="rect" id="node2" href="classpp_1_1_resource.html" title="A reference counted module resource." alt="" coords="5,5,109,32"></area></map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<p><a href="classpp_1_1_audio-members.html">List of all members.</a></p>
<h2>
Public Member Functions</h2><table class="memberdecls">

<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio.html#abcb6131f91a53e36f9626843d86e8109">Audio</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio.html#af597f4db73cfa15c3dd7eae9b7307fd2">Audio</a> (const <a class="el" href="classpp_1_1_instance_handle.html">InstanceHandle</a> &amp;instance, const <a class="el" href="classpp_1_1_audio_config.html">AudioConfig</a> &amp;<a class="el" href="classpp_1_1_audio.html#a750898b5f065621e86472cf1799401bb">config</a>, PPB_Audio_Callback callback, void *user_data)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio.html#a856666bd5087947481ac2728bcd26c60">Audio</a> (const <a class="el" href="classpp_1_1_instance_handle.html">InstanceHandle</a> &amp;instance, const <a class="el" href="classpp_1_1_audio_config.html">AudioConfig</a> &amp;<a class="el" href="classpp_1_1_audio.html#a750898b5f065621e86472cf1799401bb">config</a>, PPB_Audio_Callback callback, void *user_data)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classpp_1_1_audio_config.html">AudioConfig</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio.html#a750898b5f065621e86472cf1799401bb">config</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classpp_1_1_audio_config.html">AudioConfig</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio.html#a51dffc59dc1d654d23c7f8730c87552a">config</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio.html#aa8311c20bbeffd9e22ba21218695f6e4">StartPlayback</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio.html#ae71f91edd576129f8c82db997bd1f163">StopPlayback</a> ()</td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>An audio resource. </p>
<p>Refer to the <a href="/native-client/devguide/coding/audio.html">Audio</a> chapter in the Developer's Guide for information on using this interface. </p>
</div><hr /><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="abcb6131f91a53e36f9626843d86e8109"></a><!-- doxytag: member="pp::Audio::Audio" ref="abcb6131f91a53e36f9626843d86e8109" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_audio.html#abcb6131f91a53e36f9626843d86e8109">pp::Audio::Audio</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>An empty constructor for an <a class="el" href="classpp_1_1_audio.html" title="An audio resource.">Audio</a> resource. </p>
</div>
</div>
<a class="anchor" id="af597f4db73cfa15c3dd7eae9b7307fd2"></a><!-- doxytag: member="pp::Audio::Audio" ref="af597f4db73cfa15c3dd7eae9b7307fd2" args="(const InstanceHandle &amp;instance, const AudioConfig &amp;config, PPB_Audio_Callback callback, void *user_data)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_audio.html#abcb6131f91a53e36f9626843d86e8109">pp::Audio::Audio</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_instance_handle.html">InstanceHandle</a> &amp;&#160;</td>
<td class="paramname"><em>instance</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classpp_1_1_audio_config.html">AudioConfig</a> &amp;&#160;</td>
<td class="paramname"><em>config</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PPB_Audio_Callback&#160;</td>
<td class="paramname"><em>callback</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>user_data</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A constructor that creates an <a class="el" href="classpp_1_1_audio.html" title="An audio resource.">Audio</a> resource. </p>
<p>No sound will be heard until <a class="el" href="classpp_1_1_audio.html#aa8311c20bbeffd9e22ba21218695f6e4" title="StartPlayback() starts playback of audio.">StartPlayback()</a> is called. The callback is called with the buffer address and given user data whenever the buffer needs to be filled. From within the callback, you should not call <code>PPB_Audio</code> functions. The callback will be called on a different thread than the one which created the interface. For performance-critical applications (such as low-latency audio), the callback should avoid blocking or calling functions that can obtain locks, such as malloc. The layout and the size of the buffer passed to the audio callback will be determined by the device configuration and is specified in the <code><a class="el" href="classpp_1_1_audio_config.html" title="A 16 bit stereo AudioConfig resource.">AudioConfig</a></code> documentation.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>The instance with which this resource will be associated. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">config</td><td>An <code><a class="el" href="classpp_1_1_audio_config.html" title="A 16 bit stereo AudioConfig resource.">AudioConfig</a></code> containing the audio config resource. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code>PPB_Audio_Callback</code> callback function that the browser calls when it needs more samples to play. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">user_data</td><td>A pointer to user data used in the callback function. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a856666bd5087947481ac2728bcd26c60"></a><!-- doxytag: member="pp::Audio::Audio" ref="a856666bd5087947481ac2728bcd26c60" args="(const InstanceHandle &amp;instance, const AudioConfig &amp;config, PPB_Audio_Callback callback, void *user_data)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_audio.html#abcb6131f91a53e36f9626843d86e8109">pp::Audio::Audio</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_instance_handle.html">InstanceHandle</a> &amp;&#160;</td>
<td class="paramname"><em>instance</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classpp_1_1_audio_config.html">AudioConfig</a> &amp;&#160;</td>
<td class="paramname"><em>config</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PPB_Audio_Callback_1_0&#160;</td>
<td class="paramname"><em>callback</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>user_data</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A constructor that creates an <a class="el" href="classpp_1_1_audio.html" title="An audio resource.">Audio</a> resource. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>The instance with which this resource will be associated. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">config</td><td>An <code><a class="el" href="classpp_1_1_audio_config.html" title="A 16 bit stereo AudioConfig resource.">AudioConfig</a></code> containing the audio config resource. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code>PPB_Audio_Callback</code> callback function that the browser calls when it needs more samples to play. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">user_data</td><td>A pointer to user data used in the callback function. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr /><h2>Member Function Documentation</h2>
<a class="anchor" id="a750898b5f065621e86472cf1799401bb"></a><!-- doxytag: member="pp::Audio::config" ref="a750898b5f065621e86472cf1799401bb" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_audio_config.html">AudioConfig</a>&amp; <a class="el" href="classpp_1_1_audio.html#a750898b5f065621e86472cf1799401bb">pp::Audio::config</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Getter function for returning the internal <code>PPB_AudioConfig</code> struct. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>A mutable reference to the PPB_AudioConfig struct. </dd></dl>
</div>
</div>
<a class="anchor" id="a51dffc59dc1d654d23c7f8730c87552a"></a><!-- doxytag: member="pp::Audio::config" ref="a51dffc59dc1d654d23c7f8730c87552a" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const <a class="el" href="classpp_1_1_audio_config.html">AudioConfig</a>&amp; <a class="el" href="classpp_1_1_audio.html#a750898b5f065621e86472cf1799401bb">pp::Audio::config</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Getter function for returning the internal <code>PPB_AudioConfig</code> struct. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>A const reference to the internal <code>PPB_AudioConfig</code> struct. </dd></dl>
</div>
</div>
<a class="anchor" id="aa8311c20bbeffd9e22ba21218695f6e4"></a><!-- doxytag: member="pp::Audio::StartPlayback" ref="aa8311c20bbeffd9e22ba21218695f6e4" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool <a class="el" href="classpp_1_1_audio.html#aa8311c20bbeffd9e22ba21218695f6e4">pp::Audio::StartPlayback</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="classpp_1_1_audio.html#aa8311c20bbeffd9e22ba21218695f6e4" title="StartPlayback() starts playback of audio.">StartPlayback()</a> starts playback of audio. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>true if successful, otherwise false. </dd></dl>
</div>
</div>
<a class="anchor" id="ae71f91edd576129f8c82db997bd1f163"></a><!-- doxytag: member="pp::Audio::StopPlayback" ref="ae71f91edd576129f8c82db997bd1f163" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool <a class="el" href="classpp_1_1_audio.html#ae71f91edd576129f8c82db997bd1f163">pp::Audio::StopPlayback</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>StopPlayback stops playback of audio. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>true if successful, otherwise false. </dd></dl>
</div>
</div>
<hr />The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="audio_8h.html">audio.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}