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 #ifndef PPAPI_CPP_AUDIO_H_ | 5 #ifndef PPAPI_CPP_AUDIO_H_ |
6 #define PPAPI_CPP_AUDIO_H_ | 6 #define PPAPI_CPP_AUDIO_H_ |
7 | 7 |
8 #include "ppapi/c/pp_stdint.h" | 8 #include "ppapi/c/pp_stdint.h" |
9 #include "ppapi/c/ppb_audio.h" | 9 #include "ppapi/c/ppb_audio.h" |
10 #include "ppapi/cpp/audio_config.h" | 10 #include "ppapi/cpp/audio_config.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 /// functions. The callback will be called on a different thread than the one | 34 /// functions. The callback will be called on a different thread than the one |
35 /// which created the interface. For performance-critical applications (such | 35 /// which created the interface. For performance-critical applications (such |
36 /// as low-latency audio), the callback should avoid blocking or calling | 36 /// as low-latency audio), the callback should avoid blocking or calling |
37 /// functions that can obtain locks, such as malloc. The layout and the size | 37 /// functions that can obtain locks, such as malloc. The layout and the size |
38 /// of the buffer passed to the audio callback will be determined by | 38 /// of the buffer passed to the audio callback will be determined by |
39 /// the device configuration and is specified in the <code>AudioConfig</code> | 39 /// the device configuration and is specified in the <code>AudioConfig</code> |
40 /// documentation. | 40 /// documentation. |
41 /// | 41 /// |
42 /// @param[in] instance The instance with which this resource will be | 42 /// @param[in] instance The instance with which this resource will be |
43 /// associated. | 43 /// associated. |
44 // | |
45 /// @param[in] config An <code>AudioConfig</code> containing the audio config | 44 /// @param[in] config An <code>AudioConfig</code> containing the audio config |
46 /// resource. | 45 /// resource. |
47 // | |
48 /// @param[in] callback A <code>PPB_Audio_Callback</code> callback function | 46 /// @param[in] callback A <code>PPB_Audio_Callback</code> callback function |
49 /// that the browser calls when it needs more samples to play. | 47 /// that the browser calls when it needs more samples to play. |
50 // | |
51 /// @param[in] user_data A pointer to user data used in the callback function. | 48 /// @param[in] user_data A pointer to user data used in the callback function. |
52 Audio(const InstanceHandle& instance, | 49 Audio(const InstanceHandle& instance, |
53 const AudioConfig& config, | 50 const AudioConfig& config, |
54 PPB_Audio_Callback callback, | 51 PPB_Audio_Callback callback, |
55 void* user_data); | 52 void* user_data); |
56 | 53 |
| 54 /// A constructor that creates an Audio resource. |
| 55 /// |
| 56 /// @param[in] instance The instance with which this resource will be |
| 57 /// associated. |
| 58 /// @param[in] config An <code>AudioConfig</code> containing the audio config |
| 59 /// resource. |
| 60 /// @param[in] callback A <code>PPB_Audio_Callback_1_0</code> callback |
| 61 /// function that the browser calls when it needs more samples to play. |
| 62 /// @param[in] user_data A pointer to user data used in the callback function. |
| 63 Audio(const InstanceHandle& instance, |
| 64 const AudioConfig& config, |
| 65 PPB_Audio_Callback_1_0 callback, |
| 66 void* user_data); |
| 67 |
57 /// Getter function for returning the internal <code>PPB_AudioConfig</code> | 68 /// Getter function for returning the internal <code>PPB_AudioConfig</code> |
58 /// struct. | 69 /// struct. |
59 /// | 70 /// |
60 /// @return A mutable reference to the PPB_AudioConfig struct. | 71 /// @return A mutable reference to the PPB_AudioConfig struct. |
61 AudioConfig& config() { return config_; } | 72 AudioConfig& config() { return config_; } |
62 | 73 |
63 /// Getter function for returning the internal <code>PPB_AudioConfig</code> | 74 /// Getter function for returning the internal <code>PPB_AudioConfig</code> |
64 /// struct. | 75 /// struct. |
65 /// | 76 /// |
66 /// @return A const reference to the internal <code>PPB_AudioConfig</code> | 77 /// @return A const reference to the internal <code>PPB_AudioConfig</code> |
(...skipping 11 matching lines...) Expand all Loading... |
78 bool StopPlayback(); | 89 bool StopPlayback(); |
79 | 90 |
80 private: | 91 private: |
81 AudioConfig config_; | 92 AudioConfig config_; |
82 }; | 93 }; |
83 | 94 |
84 } // namespace pp | 95 } // namespace pp |
85 | 96 |
86 #endif // PPAPI_CPP_AUDIO_H_ | 97 #endif // PPAPI_CPP_AUDIO_H_ |
87 | 98 |
OLD | NEW |