| 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_CONFIG_H_ | 5 #ifndef PPAPI_C_PPB_AUDIO_CONFIG_H_ |
| 6 #define PPAPI_C_PPB_AUDIO_CONFIG_H_ | 6 #define PPAPI_C_PPB_AUDIO_CONFIG_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_macros.h" | 10 #include "ppapi/c/pp_macros.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 * right channel sample. | 99 * right channel sample. |
| 100 * Data will always be in the native endian format of the platform. | 100 * Data will always be in the native endian format of the platform. |
| 101 * | 101 * |
| 102 * @param[in] instance A <code>PP_Instance indentifying</code> one instance | 102 * @param[in] instance A <code>PP_Instance indentifying</code> one instance |
| 103 * of a module. | 103 * of a module. |
| 104 * @param[in] sample_rate A P<code>P_AudioSampleRate</code> which is either | 104 * @param[in] sample_rate A P<code>P_AudioSampleRate</code> which is either |
| 105 * <code>PP_AUDIOSAMPLERATE_44100</code> or | 105 * <code>PP_AUDIOSAMPLERATE_44100</code> or |
| 106 * <code>PP_AUDIOSAMPLERATE_48000</code>. | 106 * <code>PP_AUDIOSAMPLERATE_48000</code>. |
| 107 * @param[in] sample_frame_count A <code>uint32_t</code> frame count returned | 107 * @param[in] sample_frame_count A <code>uint32_t</code> frame count returned |
| 108 * from the <code>RecommendSampleFrameCount</code> function. | 108 * from the <code>RecommendSampleFrameCount</code> function. |
| 109 * |
| 109 * @return A <code>PP_Resource</code> containing the | 110 * @return A <code>PP_Resource</code> containing the |
| 110 * <code>PPB_Audio_Config</code> if successful or a null resource if the | 111 * <code>PPB_Audio_Config</code> if successful or a null resource if the |
| 111 * sample frame count or bit rate are not supported. | 112 * sample frame count or bit rate are not supported. |
| 112 */ | 113 */ |
| 113 PP_Resource (*CreateStereo16Bit)(PP_Instance instance, | 114 PP_Resource (*CreateStereo16Bit)(PP_Instance instance, |
| 114 PP_AudioSampleRate sample_rate, | 115 PP_AudioSampleRate sample_rate, |
| 115 uint32_t sample_frame_count); | 116 uint32_t sample_frame_count); |
| 116 | 117 |
| 117 /** | 118 /** |
| 118 * RecommendSampleFrameCount() returns the supported sample frame count | 119 * RecommendSampleFrameCount() returns the supported sample frame count |
| 119 * closest to the requested count. The sample frame count determines the | 120 * closest to the requested count. The sample frame count determines the |
| 120 * overall latency of audio. Since one "frame" is always buffered in advance, | 121 * overall latency of audio. Since one "frame" is always buffered in advance, |
| 121 * smaller frame counts will yield lower latency, but higher CPU utilization. | 122 * smaller frame counts will yield lower latency, but higher CPU utilization. |
| 122 * | 123 * |
| 123 * Supported sample frame counts will vary by hardware and system (consider | 124 * Supported sample frame counts will vary by hardware and system (consider |
| 124 * that the local system might be anywhere from a cell phone or a high-end | 125 * that the local system might be anywhere from a cell phone or a high-end |
| 125 * audio workstation). Sample counts less than | 126 * audio workstation). Sample counts less than |
| 126 * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> and greater than | 127 * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> and greater than |
| 127 * <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> are never supported on any | 128 * <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> are never supported on any |
| 128 * system, but values in between aren't necessarily valid. This function | 129 * system, but values in between aren't necessarily valid. This function |
| 129 * will return a supported count closest to the requested value. | 130 * will return a supported count closest to the requested value. |
| 130 * | 131 * |
| 131 * @param[in] sample_rate A <code>PP_AudioSampleRate which is either | 132 * @param[in] sample_rate A <code>PP_AudioSampleRate which is either |
| 132 * <code>PP_AUDIOSAMPLERATE_44100</code> or | 133 * <code>PP_AUDIOSAMPLERATE_44100</code> or |
| 133 * <code>PP_AUDIOSAMPLERATE_48000.</code> | 134 * <code>PP_AUDIOSAMPLERATE_48000.</code> |
| 134 * @param[in] requested_sample_frame_count A <code>uint_32t</code> requested | 135 * @param[in] requested_sample_frame_count A <code>uint_32t</code> requested |
| 135 * frame count. | 136 * frame count. |
| 137 * |
| 136 * @return A <code>uint32_t</code> containing the recommended sample frame | 138 * @return A <code>uint32_t</code> containing the recommended sample frame |
| 137 * count if successful. | 139 * count if successful. |
| 138 */ | 140 */ |
| 139 uint32_t (*RecommendSampleFrameCount)(PP_AudioSampleRate sample_rate, | 141 uint32_t (*RecommendSampleFrameCount)(PP_AudioSampleRate sample_rate, |
| 140 uint32_t requested_sample_frame_count); | 142 uint32_t requested_sample_frame_count); |
| 141 | 143 |
| 142 /** | 144 /** |
| 143 * IsAudioConfig() determines if the given resource is a | 145 * IsAudioConfig() determines if the given resource is a |
| 144 * <code>PPB_Audio_Config</code>. | 146 * <code>PPB_Audio_Config</code>. |
| 145 * | 147 * |
| 146 * @param[in] resource A <code>PP_Resource</code> containing the audio config | 148 * @param[in] resource A <code>PP_Resource</code> containing the audio config |
| 147 * resource. | 149 * resource. |
| 150 * |
| 148 * @return A <code>PP_BOOL</code> containing <code>PP_TRUE</code> if the given | 151 * @return A <code>PP_BOOL</code> containing <code>PP_TRUE</code> if the given |
| 149 * resource is an <code>AudioConfig</code> resource, otherwise | 152 * resource is an <code>AudioConfig</code> resource, otherwise |
| 150 * <code>PP_FALSE</code>. | 153 * <code>PP_FALSE</code>. |
| 151 */ | 154 */ |
| 152 PP_Bool (*IsAudioConfig)(PP_Resource resource); | 155 PP_Bool (*IsAudioConfig)(PP_Resource resource); |
| 153 | 156 |
| 154 /** | 157 /** |
| 155 * GetSampleRate() returns the sample rate for the given | 158 * GetSampleRate() returns the sample rate for the given |
| 156 * <code>PPB_Audio_Config</code>. | 159 * <code>PPB_Audio_Config</code>. |
| 157 * | 160 * |
| 158 * @param[in] config A <code>PP_Resource</code> containing the | 161 * @param[in] config A <code>PP_Resource</code> containing the |
| 159 * <code>PPB_Audio_Config</code>. | 162 * <code>PPB_Audio_Config</code>. |
| 163 * |
| 160 * @return A <code>PP_AudioSampleRate</code> containing sample rate or | 164 * @return A <code>PP_AudioSampleRate</code> containing sample rate or |
| 161 * <code>PP_AUDIOSAMPLERATE_NONE</code> if the resource is invalid. | 165 * <code>PP_AUDIOSAMPLERATE_NONE</code> if the resource is invalid. |
| 162 */ | 166 */ |
| 163 PP_AudioSampleRate (*GetSampleRate)(PP_Resource config); | 167 PP_AudioSampleRate (*GetSampleRate)(PP_Resource config); |
| 164 | 168 |
| 165 /** | 169 /** |
| 166 * GetSampleFrameCount() returns the sample frame count for the given | 170 * GetSampleFrameCount() returns the sample frame count for the given |
| 167 * <code>PPB_Audio_Config</code>. | 171 * <code>PPB_Audio_Config</code>. |
| 168 * | 172 * |
| 169 * @param[in] config A <code>PP_Resource</code> containing the audio config | 173 * @param[in] config A <code>PP_Resource</code> containing the audio config |
| 170 * resource. | 174 * resource. |
| 175 * |
| 171 * @return A <code>uint32_t</code> containing sample frame count or | 176 * @return A <code>uint32_t</code> containing sample frame count or |
| 172 * 0 if the resource is invalid. See <code>RecommendSampleFrameCount</code> | 177 * 0 if the resource is invalid. See <code>RecommendSampleFrameCount</code> |
| 173 * for more on sample frame counts. | 178 * for more on sample frame counts. |
| 174 */ | 179 */ |
| 175 uint32_t (*GetSampleFrameCount)(PP_Resource config); | 180 uint32_t (*GetSampleFrameCount)(PP_Resource config); |
| 176 }; | 181 }; |
| 177 /** | 182 /** |
| 178 * @} | 183 * @} |
| 179 */ | 184 */ |
| 180 | 185 |
| 181 #endif /* PPAPI_C_PPB_AUDIO_CONFIG_H_ */ | 186 #endif /* PPAPI_C_PPB_AUDIO_CONFIG_H_ */ |
| 182 | 187 |
| OLD | NEW |