OLD | NEW |
---|---|
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 /* From ppb_audio.idl modified Wed Oct 5 14:06:02 2011. */ | 6 /* From ppb_audio.idl modified Wed Jan 25 11:39:19 2012. */ |
7 | 7 |
8 #ifndef PPAPI_C_PPB_AUDIO_H_ | 8 #ifndef PPAPI_C_PPB_AUDIO_H_ |
9 #define PPAPI_C_PPB_AUDIO_H_ | 9 #define PPAPI_C_PPB_AUDIO_H_ |
10 | 10 |
11 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
12 #include "ppapi/c/pp_instance.h" | 12 #include "ppapi/c/pp_instance.h" |
13 #include "ppapi/c/pp_macros.h" | 13 #include "ppapi/c/pp_macros.h" |
14 #include "ppapi/c/pp_resource.h" | 14 #include "ppapi/c/pp_resource.h" |
15 #include "ppapi/c/pp_stdint.h" | 15 #include "ppapi/c/pp_stdint.h" |
16 | 16 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 * The <code>PPB_Audio</code> interface contains pointers to several functions | 49 * The <code>PPB_Audio</code> interface contains pointers to several functions |
50 * for handling audio resources. Please refer to the | 50 * for handling audio resources. Please refer to the |
51 * <a href="/chrome/nativeclient/docs/audio.html">Pepper | 51 * <a href="/chrome/nativeclient/docs/audio.html">Pepper |
52 * Audio API</a> for information on using this interface. | 52 * Audio API</a> for information on using this interface. |
53 * Please see descriptions for each <code>PPB_Audio</code> and | 53 * Please see descriptions for each <code>PPB_Audio</code> and |
54 * <code>PPB_AudioConfig</code> function for more details. A C example using | 54 * <code>PPB_AudioConfig</code> function for more details. A C example using |
55 * <code>PPB_Audio</code> and <code>PPB_AudioConfig</code> follows. | 55 * <code>PPB_Audio</code> and <code>PPB_AudioConfig</code> follows. |
56 * | 56 * |
57 * <strong>Example: </strong> | 57 * <strong>Example: </strong> |
58 * | 58 * |
59 * <code> | 59 * @code |
60 * void audio_callback(void* sample_buffer, | 60 * void audio_callback(void* sample_buffer, |
61 * uint32_t buffer_size_in_bytes, | 61 * uint32_t buffer_size_in_bytes, |
62 * void* user_data) { | 62 * void* user_data) { |
63 * ... quickly fill in the buffer with samples and return to caller ... | 63 * ... quickly fill in the buffer with samples and return to caller ... |
64 * } | 64 * } |
65 * | 65 * |
66 * ...Assume the application has cached the audio configuration interface in | 66 * ...Assume the application has cached the audio configuration interface in |
67 * <code>audio_config_interface</code> and the audio interface in | 67 * <code>audio_config_interface</code> and the audio interface in |
68 * <code>audio_interface</code>... | 68 * <code>audio_interface</code>... |
cstefansen
2012/02/21 18:43:37
Will it render? (The <code> tags.)
jond
2012/02/24 20:44:27
Removed.
On 2012/02/21 18:43:37, cstefansen wrote
cstefansen
2012/02/24 21:09:10
Hmm, I still see <code> tags here...?
On 2012/02/
jond
2012/02/27 20:31:49
Done.
| |
69 * | 69 * |
70 * uint32_t count = audio_config_interface->RecommendSampleFrameCount( | 70 * uint32_t count = audio_config_interface->RecommendSampleFrameCount( |
71 * PP_AUDIOSAMPLERATE_44100, 4096); | 71 * PP_AUDIOSAMPLERATE_44100, 4096); |
72 * PP_Resource pp_audio_config = audio_config_interface->CreateStereo16Bit( | 72 * PP_Resource pp_audio_config = audio_config_interface->CreateStereo16Bit( |
73 * pp_instance, PP_AUDIOSAMPLERATE_44100, count); | 73 * pp_instance, PP_AUDIOSAMPLERATE_44100, count); |
74 * PP_Resource pp_audio = audio_interface->Create(pp_instance, pp_audio_config, | 74 * PP_Resource pp_audio = audio_interface->Create(pp_instance, pp_audio_config, |
75 * audio_callback, NULL); | 75 * audio_callback, NULL); |
76 * audio_interface->StartPlayback(pp_audio); | 76 * audio_interface->StartPlayback(pp_audio); |
77 * | 77 * |
78 * ...audio_callback() will now be periodically invoked on a separate thread... | 78 * ...audio_callback() will now be periodically invoked on a separate thread... |
79 * </code> | 79 * @endcode |
80 */ | 80 */ |
81 struct PPB_Audio_1_0 { | 81 struct PPB_Audio_1_0 { |
82 /** | 82 /** |
83 * Create() creates an audio resource. No sound will be heard until | 83 * Create() creates an audio resource. No sound will be heard until |
84 * StartPlayback() is called. The callback is called with the buffer address | 84 * StartPlayback() is called. The callback is called with the buffer address |
85 * and given user data whenever the buffer needs to be filled. From within the | 85 * and given user data whenever the buffer needs to be filled. From within the |
86 * callback, you should not call <code>PPB_Audio</code> functions. The | 86 * callback, you should not call <code>PPB_Audio</code> functions. The |
87 * callback will be called on a different thread than the one which created | 87 * callback will be called on a different thread than the one which created |
88 * the interface. For performance-critical applications (i.e. low-latency | 88 * the interface. For performance-critical applications (i.e. low-latency |
89 * audio), the callback should avoid blocking or calling functions that can | 89 * audio), the callback should avoid blocking or calling functions that can |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 PP_Bool (*StopPlayback)(PP_Resource audio); | 157 PP_Bool (*StopPlayback)(PP_Resource audio); |
158 }; | 158 }; |
159 | 159 |
160 typedef struct PPB_Audio_1_0 PPB_Audio; | 160 typedef struct PPB_Audio_1_0 PPB_Audio; |
161 /** | 161 /** |
162 * @} | 162 * @} |
163 */ | 163 */ |
164 | 164 |
165 #endif /* PPAPI_C_PPB_AUDIO_H_ */ | 165 #endif /* PPAPI_C_PPB_AUDIO_H_ */ |
166 | 166 |
OLD | NEW |