chromium/native_client_sdk/doc_generated/pepper_beta/c/struct_p_p_b___audio_config__1__1.html

{{+bindTo:partials.standard_nacl_api}}
<h1>PPB_AudioConfig Struct 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="PPB_AudioConfig" --><h2>
Data Fields</h2><table class="memberdecls">

<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___audio_config__1__1.html#a541f636cd6818dbf09ff3680701753ae">CreateStereo16Bit</a> )(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, <a class="el" href="group___enums.html#gaee750c350655f2fb0fe04c04029e0ff8">PP_AudioSampleRate</a> sample_rate, uint32_t sample_frame_count)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___audio_config__1__1.html#ad8e61c620a5b2081302e741c94aef921">RecommendSampleFrameCount</a> )(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, <a class="el" href="group___enums.html#gaee750c350655f2fb0fe04c04029e0ff8">PP_AudioSampleRate</a> sample_rate, uint32_t requested_sample_frame_count)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___audio_config__1__1.html#a51282d6afa187ef1fc3a3a559735e209">IsAudioConfig</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#gaee750c350655f2fb0fe04c04029e0ff8">PP_AudioSampleRate</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___audio_config__1__1.html#a3e9e2d57f89f78d5373f09e9a6bcac72">GetSampleRate</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> config)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___audio_config__1__1.html#a743a6033adee1e3e8e4822d72e0ccc68">GetSampleFrameCount</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> config)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#gaee750c350655f2fb0fe04c04029e0ff8">PP_AudioSampleRate</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___audio_config__1__1.html#a7c6808dbbfba59c85facd85548a0199c">RecommendSampleRate</a> )(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance)</td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>The <code>PPB_AudioConfig</code> interface contains pointers to several functions for establishing your audio configuration within the browser. </p>
<p>This interface only supports 16-bit stereo output.</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>Field Documentation</h2>
<a class="anchor" id="a541f636cd6818dbf09ff3680701753ae"></a><!-- doxytag: member="PPB_AudioConfig::CreateStereo16Bit" ref="a541f636cd6818dbf09ff3680701753ae" args=")(PP_Instance instance, PP_AudioSampleRate sample_rate, uint32_t sample_frame_count)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(* <a class="el" href="struct_p_p_b___audio_config__1__1.html#a541f636cd6818dbf09ff3680701753ae">PPB_AudioConfig::CreateStereo16Bit</a>)(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, <a class="el" href="group___enums.html#gaee750c350655f2fb0fe04c04029e0ff8">PP_AudioSampleRate</a> sample_rate, uint32_t sample_frame_count)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>CreateStereo16bit() creates a 16 bit audio configuration resource. </p>
<p>The <code>sample_rate</code> should be the result of calling <code>RecommendSampleRate</code> and <code>sample_frame_count</code> should be the result of calling <code>RecommendSampleFrameCount</code>. If the sample frame count or bit rate isn't supported, this function will fail and return a null resource.</p>
<p>A single sample frame on a stereo device means one value for the left channel and one value for the right channel.</p>
<p>Buffer layout for a stereo int16 configuration: <code>int16_t *buffer16;</code> <code>buffer16[0]</code> is the first left channel sample. <code>buffer16[1]</code> is the first right channel sample. <code>buffer16[2]</code> is the second left channel sample. <code>buffer16[3]</code> is the second right channel sample. ... <code>buffer16[2 * (sample_frame_count - 1)]</code> is the last left channel sample. <code>buffer16[2 * (sample_frame_count - 1) + 1]</code> is the last right channel sample. Data will always be in the native endian format of the platform.</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>A <code>PP_Instance</code> identifying one instance of a module. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">sample_rate</td><td>A <code>PP_AudioSampleRate</code> which is either <code>PP_AUDIOSAMPLERATE_44100</code> or <code>PP_AUDIOSAMPLERATE_48000</code>. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">sample_frame_count</td><td>A <code>uint32_t</code> frame count returned from the <code>RecommendSampleFrameCount</code> function.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_Resource</code> containing the <code>PPB_Audio_Config</code> if successful or a null resource if the sample frame count or bit rate are not supported. </dd></dl>
</div>
</div>
<a class="anchor" id="a743a6033adee1e3e8e4822d72e0ccc68"></a><!-- doxytag: member="PPB_AudioConfig::GetSampleFrameCount" ref="a743a6033adee1e3e8e4822d72e0ccc68" args=")(PP_Resource config)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t(* <a class="el" href="struct_p_p_b___audio_config__1__1.html#a743a6033adee1e3e8e4822d72e0ccc68">PPB_AudioConfig::GetSampleFrameCount</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> config)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___audio_config__1__1.html#a743a6033adee1e3e8e4822d72e0ccc68" title="GetSampleFrameCount() returns the sample frame count for the given PPB_Audio_Config.">GetSampleFrameCount()</a> returns the sample frame count for the given <code>PPB_Audio_Config</code>. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">config</td><td>A <code>PP_Resource</code> corresponding to an audio config resource.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>uint32_t</code> containing sample frame count or 0 if the resource is invalid. Refer to <a class="el" href="struct_p_p_b___audio_config__1__1.html#ad8e61c620a5b2081302e741c94aef921" title="RecommendSampleFrameCount() returns the supported sample frame count closest to the requested count...">RecommendSampleFrameCount()</a> for more on sample frame counts. </dd></dl>
</div>
</div>
<a class="anchor" id="a3e9e2d57f89f78d5373f09e9a6bcac72"></a><!-- doxytag: member="PPB_AudioConfig::GetSampleRate" ref="a3e9e2d57f89f78d5373f09e9a6bcac72" args=")(PP_Resource config)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#gaee750c350655f2fb0fe04c04029e0ff8">PP_AudioSampleRate</a>(* <a class="el" href="struct_p_p_b___audio_config__1__1.html#a3e9e2d57f89f78d5373f09e9a6bcac72">PPB_AudioConfig::GetSampleRate</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> config)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___audio_config__1__1.html#a3e9e2d57f89f78d5373f09e9a6bcac72" title="GetSampleRate() returns the sample rate for the given PPB_Audio_Config.">GetSampleRate()</a> returns the sample rate for the given <code>PPB_Audio_Config</code>. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">config</td><td>A <code>PP_Resource</code> corresponding to a <code>PPB_Audio_Config</code>.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_AudioSampleRate</code> containing sample rate or <code>PP_AUDIOSAMPLERATE_NONE</code> if the resource is invalid. </dd></dl>
</div>
</div>
<a class="anchor" id="a51282d6afa187ef1fc3a3a559735e209"></a><!-- doxytag: member="PPB_AudioConfig::IsAudioConfig" ref="a51282d6afa187ef1fc3a3a559735e209" args=")(PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___audio_config__1__1.html#a51282d6afa187ef1fc3a3a559735e209">PPB_AudioConfig::IsAudioConfig</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___audio_config__1__1.html#a51282d6afa187ef1fc3a3a559735e209" title="IsAudioConfig() determines if the given resource is a PPB_Audio_Config.">IsAudioConfig()</a> determines if the given resource is a <code>PPB_Audio_Config</code>. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to an audio config resource.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given resource is an <code>AudioConfig</code> resource, otherwise <code>PP_FALSE</code>. </dd></dl>
</div>
</div>
<a class="anchor" id="ad8e61c620a5b2081302e741c94aef921"></a><!-- doxytag: member="PPB_AudioConfig::RecommendSampleFrameCount" ref="ad8e61c620a5b2081302e741c94aef921" args=")(PP_Instance instance, PP_AudioSampleRate sample_rate, uint32_t requested_sample_frame_count)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t(* <a class="el" href="struct_p_p_b___audio_config__1__1.html#ad8e61c620a5b2081302e741c94aef921">PPB_AudioConfig::RecommendSampleFrameCount</a>)(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, <a class="el" href="group___enums.html#gaee750c350655f2fb0fe04c04029e0ff8">PP_AudioSampleRate</a> sample_rate, uint32_t requested_sample_frame_count)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___audio_config__1__1.html#ad8e61c620a5b2081302e741c94aef921" title="RecommendSampleFrameCount() returns the supported sample frame count closest to the requested count...">RecommendSampleFrameCount()</a> returns the supported sample frame count closest to the requested count. </p>
<p>The sample frame count determines the overall latency of audio. Since one "frame" is always buffered in advance, smaller frame counts will yield lower latency, but higher CPU utilization.</p>
<p>Supported sample frame counts will vary by hardware and system (consider that the local system might be anywhere from a cell phone or a high-end audio workstation). Sample counts less than <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> and greater than <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> are never supported on any system, but values in between aren't necessarily valid. This function will return a supported count closest to the requested frame count.</p>
<p><a class="el" href="struct_p_p_b___audio_config__1__1.html#ad8e61c620a5b2081302e741c94aef921" title="RecommendSampleFrameCount() returns the supported sample frame count closest to the requested count...">RecommendSampleFrameCount()</a> result is intended for audio output devices.</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></td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">sample_rate</td><td>A <code>PP_AudioSampleRate</code> which is either <code>PP_AUDIOSAMPLERATE_44100</code> or <code>PP_AUDIOSAMPLERATE_48000.</code> </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">requested_sample_frame_count</td><td>A <code>uint_32t</code> requested frame count.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>uint32_t</code> containing the recommended sample frame count if successful. </dd></dl>
</div>
</div>
<a class="anchor" id="a7c6808dbbfba59c85facd85548a0199c"></a><!-- doxytag: member="PPB_AudioConfig::RecommendSampleRate" ref="a7c6808dbbfba59c85facd85548a0199c" args=")(PP_Instance instance)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#gaee750c350655f2fb0fe04c04029e0ff8">PP_AudioSampleRate</a>(* <a class="el" href="struct_p_p_b___audio_config__1__1.html#a7c6808dbbfba59c85facd85548a0199c">PPB_AudioConfig::RecommendSampleRate</a>)(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___audio_config__1__1.html#a7c6808dbbfba59c85facd85548a0199c" title="RecommendSampleRate() returns the native sample rate that the browser is using in the backend...">RecommendSampleRate()</a> returns the native sample rate that the browser is using in the backend. </p>
<p>Applications that use the recommended sample rate will have potentially better latency and fidelity. The return value is intended for audio output devices. If the output sample rate cannot be determined, this function can return PP_AUDIOSAMPLERATE_NONE.</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></td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>uint32_t</code> containing the recommended sample frame count if successful. </dd></dl>
</div>
</div>
<hr />The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="ppb__audio__config_8h.html">ppb_audio_config.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}