예제 #1
0
 /**
  * RecommendSampleFrameCount() returns the supported sample frame count
  * closest to the requested count. 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.
  *
  * 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.
  *
  * RecommendSampleFrameCount() result is intended for audio output devices.
  *
  * @param[in] instance
  * @param[in] sample_rate A <code>PP_AudioSampleRate</code> which is either
  * <code>PP_AUDIOSAMPLERATE_44100</code> or
  * <code>PP_AUDIOSAMPLERATE_48000.</code>
  * @param[in] requested_sample_frame_count A <code>uint_32t</code> requested
  * frame count.
  *
  * @return A <code>uint32_t</code> containing the recommended sample frame
  * count if successful.
  */
 public static uint RecommendSampleFrameCount(
     PPInstance instance,
     PPAudioSampleRate sample_rate,
     uint requested_sample_frame_count)
 {
     return(_RecommendSampleFrameCount(instance,
                                       sample_rate,
                                       requested_sample_frame_count));
 }
예제 #2
0
 extern static PPResource _CreateStereo16Bit(PPInstance instance,
                                             PPAudioSampleRate sample_rate,
                                             uint sample_frame_count);
예제 #3
0
 extern static uint _RecommendSampleFrameCount(
     PPInstance instance,
     PPAudioSampleRate sample_rate,
     uint requested_sample_frame_count);
예제 #4
0
 /**
  * CreateStereo16bit() creates a 16 bit audio configuration resource. 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.
  *
  * A single sample frame on a stereo device means one value for the left
  * channel and one value for the right channel.
  *
  * 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.
  *
  * @param[in] instance A <code>PP_Instance</code> identifying one instance
  * of a module.
  * @param[in] sample_rate A <code>PP_AudioSampleRate</code> which is either
  * <code>PP_AUDIOSAMPLERATE_44100</code> or
  * <code>PP_AUDIOSAMPLERATE_48000</code>.
  * @param[in] sample_frame_count A <code>uint32_t</code> frame count returned
  * from the <code>RecommendSampleFrameCount</code> function.
  *
  * @return 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.
  */
 public static PPResource CreateStereo16Bit(PPInstance instance,
                                            PPAudioSampleRate sample_rate,
                                            uint sample_frame_count)
 {
     return(_CreateStereo16Bit(instance, sample_rate, sample_frame_count));
 }