OLD | NEW |
1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 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 #ifndef PPAPI_C_PPB_AUDIO_H_ | 5 #ifndef PPAPI_C_PPB_AUDIO_H_ |
6 #define PPAPI_C_PPB_AUDIO_H_ | 6 #define PPAPI_C_PPB_AUDIO_H_ |
7 | 7 |
8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
9 #include "ppapi/c/pp_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
10 #include "ppapi/c/pp_module.h" | 10 #include "ppapi/c/pp_module.h" |
11 #include "ppapi/c/pp_resource.h" | 11 #include "ppapi/c/pp_resource.h" |
12 #include "ppapi/c/pp_stdint.h" | 12 #include "ppapi/c/pp_stdint.h" |
13 | 13 |
14 #define PPB_AUDIO_INTERFACE "PPB_Audio;0.5" | 14 #define PPB_AUDIO_INTERFACE "PPB_Audio;0.6" |
15 | 15 |
16 /** | 16 /** |
17 * @file | 17 * @file |
18 * This file defines the PPB_Audio interface for handling audio resources on | 18 * This file defines the PPB_Audio interface for handling audio resources on |
19 * the browser. Refer to the | 19 * the browser. Refer to the |
20 * <a href="/chrome/nativeclient/docs/audio.html">Pepper Audio API Code | 20 * <a href="/chrome/nativeclient/docs/audio.html">Pepper Audio API Code |
21 * Walkthrough</a> for information on using this interface. | 21 * Walkthrough</a> for information on using this interface. |
22 */ | 22 */ |
23 | 23 |
24 /** | 24 /** |
25 * @addtogroup Typedefs | 25 * @addtogroup Typedefs |
26 * @{ | 26 * @{ |
27 */ | 27 */ |
28 | 28 |
29 /** | 29 /** |
30 * PPB_Audio_Callback defines the type of an audio callback function used to | 30 * PPB_Audio_Callback defines the type of an audio callback function used to |
31 * fill the audio buffer with data. | 31 * fill the audio buffer with data. |
32 */ | 32 */ |
33 typedef void (*PPB_Audio_Callback)(void* sample_buffer, | 33 typedef void (*PPB_Audio_Callback)(void* sample_buffer, |
34 size_t buffer_size_in_bytes, | 34 uint32_t buffer_size_in_bytes, |
35 void* user_data); | 35 void* user_data); |
36 /** | 36 /** |
37 * @} | 37 * @} |
38 */ | 38 */ |
39 | 39 |
40 /** | 40 /** |
41 * @addtogroup Interfaces | 41 * @addtogroup Interfaces |
42 * @{ | 42 * @{ |
43 */ | 43 */ |
44 /** | 44 /** |
45 * The PPB_Audio interface contains pointers to several functions for handling | 45 * The PPB_Audio interface contains pointers to several functions for handling |
46 * audio resources on the browser. This interface is a callback-based audio | 46 * audio resources on the browser. This interface is a callback-based audio |
47 * interface. Users of audio must set the callback that will be called each time | 47 * interface. Users of audio must set the callback that will be called each time |
48 * that the buffer needs to be filled. | 48 * that the buffer needs to be filled. |
49 * | 49 * |
50 * A C++ example: | 50 * A C++ example: |
51 * | 51 * |
52 * void audio_callback(void* sample_buffer, | 52 * void audio_callback(void* sample_buffer, |
53 * size_t buffer_size_in_bytes, | 53 * uint32_t buffer_size_in_bytes, |
54 * void* user_data) { | 54 * void* user_data) { |
55 * ... fill in the buffer with samples ... | 55 * ... fill in the buffer with samples ... |
56 * } | 56 * } |
57 * | 57 * |
58 * uint32_t obtained; | 58 * uint32_t obtained; |
59 * AudioConfig config(PP_AUDIOSAMPLERATE_44100, 4096, &obtained); | 59 * AudioConfig config(PP_AUDIOSAMPLERATE_44100, 4096, &obtained); |
60 * Audio audio(config, audio_callback, NULL); | 60 * Audio audio(config, audio_callback, NULL); |
61 * audio.StartPlayback(); | 61 * audio.StartPlayback(); |
62 */ | 62 */ |
63 struct PPB_Audio { | 63 struct PPB_Audio { |
64 /** | 64 /** |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 * callback completes. | 124 * callback completes. |
125 */ | 125 */ |
126 PP_Bool (*StopPlayback)(PP_Resource audio); | 126 PP_Bool (*StopPlayback)(PP_Resource audio); |
127 }; | 127 }; |
128 /** | 128 /** |
129 * @} | 129 * @} |
130 */ | 130 */ |
131 | 131 |
132 #endif /* PPAPI_C_PPB_DEVICE_CONTEXT_AUDIO_H_ */ | 132 #endif /* PPAPI_C_PPB_DEVICE_CONTEXT_AUDIO_H_ */ |
133 | 133 |
OLD | NEW |