diff options
author | nfullagar@google.com <nfullagar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-29 21:06:38 +0000 |
---|---|---|
committer | nfullagar@google.com <nfullagar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-29 21:06:38 +0000 |
commit | 21e50e9355d4ad5731cc68d7a944f48767bad07f (patch) | |
tree | 2c03a26be3766908797992b499b0f155f1f2fa50 /ppapi/c/ppb_audio.h | |
parent | 2df4c97ee7115462f39c3782ac8a3f498765b105 (diff) | |
download | chromium_src-21e50e9355d4ad5731cc68d7a944f48767bad07f.zip chromium_src-21e50e9355d4ad5731cc68d7a944f48767bad07f.tar.gz chromium_src-21e50e9355d4ad5731cc68d7a944f48767bad07f.tar.bz2 |
Convert C++ example in the comment to C
test=none
bug=none
Review URL: http://codereview.chromium.org/6693038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79743 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c/ppb_audio.h')
-rw-r--r-- | ppapi/c/ppb_audio.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/ppapi/c/ppb_audio.h b/ppapi/c/ppb_audio.h index 5abb8ec..5a21e8f 100644 --- a/ppapi/c/ppb_audio.h +++ b/ppapi/c/ppb_audio.h @@ -15,8 +15,8 @@ /** * @file - * This file defines the PPB_Audio interface for handling audio resources on - * the browser. Refer to the + * This file defines the PPB_Audio interface, which provides realtime stereo + * audio streaming capabilities. Please refer to the * <a href="/chrome/nativeclient/docs/audio.html">Pepper Audio API Code * Walkthrough</a> for information on using this interface. */ @@ -28,7 +28,8 @@ /** * PPB_Audio_Callback defines the type of an audio callback function used to - * fill the audio buffer with data. + * fill the audio buffer with data. Please see the Create() function in the + * PPB_Audio interface for more details on this callback. */ typedef void (*PPB_Audio_Callback)(void* sample_buffer, uint32_t buffer_size_in_bytes, @@ -43,22 +44,29 @@ typedef void (*PPB_Audio_Callback)(void* sample_buffer, */ /** * The PPB_Audio interface contains pointers to several functions for handling - * audio resources on the browser. This interface is a callback-based audio - * interface. Users of audio must set the callback that will be called each time - * that the buffer needs to be filled. + * audio resources. Please see descriptions for each PPB_Audio and + * PPB_AudioConfig function for more details. * - * A C++ example: + * A C example using PPB_Audio and PPB_AudioConfig: * * void audio_callback(void* sample_buffer, * uint32_t buffer_size_in_bytes, * void* user_data) { - * ... fill in the buffer with samples ... + * ... quickly fill in the buffer with samples and return to caller ... * } * - * uint32_t obtained; - * AudioConfig config(PP_AUDIOSAMPLERATE_44100, 4096, &obtained); - * Audio audio(config, audio_callback, NULL); - * audio.StartPlayback(); + * ...Assume the application has cached the audio configuration interface in + * |audio_config_interface| and the audio interface in |audio_interface|... + * + * uint32_t count = audio_config_interface->RecommendSampleFrameCount( + * PP_AUDIOSAMPLERATE_44100, 4096); + * PP_Resource pp_audio_config = audio_config_interface->CreateStereo16Bit( + * pp_instance, PP_AUDIOSAMPLERATE_44100, count); + * PP_Resource pp_audio = audio_interface->Create(pp_instance, pp_audio_config, + * audio_callback, NULL); + * audio_interface->StartPlayback(pp_audio); + * + * ...audio_callback() will now be periodically invoked on a seperate thread... */ struct PPB_Audio { /** |