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.5" |
15 | 15 |
| 16 /** |
| 17 * @addtogroup Typedefs |
| 18 * @{ |
| 19 */ |
16 // Callback function type for SetCallback. | 20 // Callback function type for SetCallback. |
17 typedef void (*PPB_Audio_Callback)(void* sample_buffer, | 21 typedef void (*PPB_Audio_Callback)(void* sample_buffer, |
18 size_t buffer_size_in_bytes, | 22 size_t buffer_size_in_bytes, |
19 void* user_data); | 23 void* user_data); |
| 24 /** |
| 25 * @} |
| 26 */ |
20 | 27 |
| 28 /** |
| 29 * @addtogroup Structs |
| 30 * @{ |
| 31 */ |
21 // Callback-based audio interface. User of audio must set the callback that will | 32 // Callback-based audio interface. User of audio must set the callback that will |
22 // be called each time that the buffer needs to be filled. | 33 // be called each time that the buffer needs to be filled. |
23 // | 34 // |
24 // A C++ example: | 35 // A C++ example: |
25 // | 36 // |
26 // void audio_callback(void* sample_buffer, | 37 // void audio_callback(void* sample_buffer, |
27 // size_t buffer_size_in_bytes, | 38 // size_t buffer_size_in_bytes, |
28 // void* user_data) { | 39 // void* user_data) { |
29 // ... fill in the buffer with samples ... | 40 // ... fill in the buffer with samples ... |
30 // } | 41 // } |
(...skipping 30 matching lines...) Expand all Loading... |
61 // Start the playback. Begin periodically calling the callback. If called | 72 // Start the playback. Begin periodically calling the callback. If called |
62 // while playback is already in progress, will return PP_TRUE and be a no-op. | 73 // while playback is already in progress, will return PP_TRUE and be a no-op. |
63 // On error, return PP_FALSE. | 74 // On error, return PP_FALSE. |
64 PP_Bool (*StartPlayback)(PP_Resource audio); | 75 PP_Bool (*StartPlayback)(PP_Resource audio); |
65 | 76 |
66 // Stop the playback. If playback is already stopped, this is a no-op and | 77 // Stop the playback. If playback is already stopped, this is a no-op and |
67 // returns PP_TRUE. On error, returns PP_FALSE. If a callback is in progress, | 78 // returns PP_TRUE. On error, returns PP_FALSE. If a callback is in progress, |
68 // StopPlayback will block until callback completes. | 79 // StopPlayback will block until callback completes. |
69 PP_Bool (*StopPlayback)(PP_Resource audio); | 80 PP_Bool (*StopPlayback)(PP_Resource audio); |
70 }; | 81 }; |
| 82 /** |
| 83 * @} |
| 84 */ |
71 | 85 |
72 #endif /* PPAPI_C_PPB_DEVICE_CONTEXT_AUDIO_H_ */ | 86 #endif /* PPAPI_C_PPB_DEVICE_CONTEXT_AUDIO_H_ */ |
73 | 87 |
OLD | NEW |