| 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 | 5 |
| 6 /** | 6 /** |
| 7 * This file defines the PPB_AudioConfig interface for establishing an | 7 * This file defines the PPB_AudioConfig interface for establishing an |
| 8 * audio configuration resource within the browser. | 8 * audio configuration resource within the browser. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 * <code>buffer16[1]</code> is the first right channel sample. | 64 * <code>buffer16[1]</code> is the first right channel sample. |
| 65 * <code>buffer16[2]</code> is the second left channel sample. | 65 * <code>buffer16[2]</code> is the second left channel sample. |
| 66 * <code>buffer16[3]</code> is the second right channel sample. | 66 * <code>buffer16[3]</code> is the second right channel sample. |
| 67 * ... | 67 * ... |
| 68 * <code>buffer16[2 * (sample_frame_count - 1)]</code> is the last left | 68 * <code>buffer16[2 * (sample_frame_count - 1)]</code> is the last left |
| 69 * channel sample. | 69 * channel sample. |
| 70 * <code>buffer16[2 * (sample_frame_count - 1) + 1]</code> is the last | 70 * <code>buffer16[2 * (sample_frame_count - 1) + 1]</code> is the last |
| 71 * right channel sample. | 71 * right channel sample. |
| 72 * Data will always be in the native endian format of the platform. | 72 * Data will always be in the native endian format of the platform. |
| 73 * | 73 * |
| 74 * @param[in] instance A <code>PP_Instance indentifying</code> one instance | 74 * @param[in] instance A <code>PP_Instance</code> identifying one instance |
| 75 * of a module. | 75 * of a module. |
| 76 * @param[in] sample_rate A P<code>P_AudioSampleRate</code> which is either | 76 * @param[in] sample_rate A P<code>P_AudioSampleRate</code> which is either |
| 77 * <code>PP_AUDIOSAMPLERATE_44100</code> or | 77 * <code>PP_AUDIOSAMPLERATE_44100</code> or |
| 78 * <code>PP_AUDIOSAMPLERATE_48000</code>. | 78 * <code>PP_AUDIOSAMPLERATE_48000</code>. |
| 79 * @param[in] sample_frame_count A <code>uint32_t</code> frame count returned | 79 * @param[in] sample_frame_count A <code>uint32_t</code> frame count returned |
| 80 * from the <code>RecommendSampleFrameCount</code> function. | 80 * from the <code>RecommendSampleFrameCount</code> function. |
| 81 * |
| 81 * @return A <code>PP_Resource</code> containing the | 82 * @return A <code>PP_Resource</code> containing the |
| 82 * <code>PPB_Audio_Config</code> if successful or a null resource if the | 83 * <code>PPB_Audio_Config</code> if successful or a null resource if the |
| 83 * sample frame count or bit rate are not supported. | 84 * sample frame count or bit rate are not supported. |
| 84 */ | 85 */ |
| 85 PP_Resource CreateStereo16Bit( | 86 PP_Resource CreateStereo16Bit( |
| 86 [in] PP_Instance instance, | 87 [in] PP_Instance instance, |
| 87 [in] PP_AudioSampleRate sample_rate, | 88 [in] PP_AudioSampleRate sample_rate, |
| 88 [in] uint32_t sample_frame_count); | 89 [in] uint32_t sample_frame_count); |
| 89 | 90 |
| 90 /** | 91 /** |
| 91 * RecommendSampleFrameCount() returns the supported sample frame count | 92 * RecommendSampleFrameCount() returns the supported sample frame count |
| 92 * closest to the requested count. The sample frame count determines the | 93 * closest to the requested count. The sample frame count determines the |
| 93 * overall latency of audio. Since one "frame" is always buffered in advance, | 94 * overall latency of audio. Since one "frame" is always buffered in advance, |
| 94 * smaller frame counts will yield lower latency, but higher CPU utilization. | 95 * smaller frame counts will yield lower latency, but higher CPU utilization. |
| 95 * | 96 * |
| 96 * Supported sample frame counts will vary by hardware and system (consider | 97 * Supported sample frame counts will vary by hardware and system (consider |
| 97 * that the local system might be anywhere from a cell phone or a high-end | 98 * that the local system might be anywhere from a cell phone or a high-end |
| 98 * audio workstation). Sample counts less than | 99 * audio workstation). Sample counts less than |
| 99 * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> and greater than | 100 * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> and greater than |
| 100 * <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> are never supported on any | 101 * <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> are never supported on any |
| 101 * system, but values in between aren't necessarily valid. This function | 102 * system, but values in between aren't necessarily valid. This function |
| 102 * will return a supported count closest to the requested value. | 103 * will return a supported count closest to the requested value. |
| 103 * | 104 * |
| 104 * @param[in] sample_rate A <code>PP_AudioSampleRate</code> which is either | 105 * @param[in] sample_rate A <code>PP_AudioSampleRate</code> which is either |
| 105 * <code>PP_AUDIOSAMPLERATE_44100</code> or | 106 * <code>PP_AUDIOSAMPLERATE_44100</code> or |
| 106 * <code>PP_AUDIOSAMPLERATE_48000.</code> | 107 * <code>PP_AUDIOSAMPLERATE_48000.</code> |
| 107 * @param[in] requested_sample_frame_count A <code>uint_32t</code> requested | 108 * @param[in] requested_sample_frame_count A <code>uint_32t</code> requested |
| 108 * frame count. | 109 * frame count. |
| 110 * |
| 109 * @return A <code>uint32_t</code> containing the recommended sample frame | 111 * @return A <code>uint32_t</code> containing the recommended sample frame |
| 110 * count if successful. | 112 * count if successful. |
| 111 */ | 113 */ |
| 112 uint32_t RecommendSampleFrameCount( | 114 uint32_t RecommendSampleFrameCount( |
| 113 [in] PP_AudioSampleRate sample_rate, | 115 [in] PP_AudioSampleRate sample_rate, |
| 114 [in] uint32_t requested_sample_frame_count); | 116 [in] uint32_t requested_sample_frame_count); |
| 115 | 117 |
| 116 /** | 118 /** |
| 117 * IsAudioConfig() determines if the given resource is a | 119 * IsAudioConfig() determines if the given resource is a |
| 118 * <code>PPB_Audio_Config</code>. | 120 * <code>PPB_Audio_Config</code>. |
| 119 * | 121 * |
| 120 * @param[in] resource A <code>PP_Resource</code> containing the audio config | 122 * @param[in] resource A <code>PP_Resource</code> corresponding to an audio |
| 121 * resource. | 123 * config resource. |
| 122 * @return A <code>PP_BOOL</code> containing <code>PP_TRUE</code> if the given | 124 * |
| 125 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given |
| 123 * resource is an <code>AudioConfig</code> resource, otherwise | 126 * resource is an <code>AudioConfig</code> resource, otherwise |
| 124 * <code>PP_FALSE</code>. | 127 * <code>PP_FALSE</code>. |
| 125 */ | 128 */ |
| 126 PP_Bool IsAudioConfig( | 129 PP_Bool IsAudioConfig( |
| 127 [in] PP_Resource resource); | 130 [in] PP_Resource resource); |
| 128 | 131 |
| 129 /** | 132 /** |
| 130 * GetSampleRate() returns the sample rate for the given | 133 * GetSampleRate() returns the sample rate for the given |
| 131 * <code>PPB_Audio_Config</code>. | 134 * <code>PPB_Audio_Config</code>. |
| 132 * | 135 * |
| 133 * @param[in] config A <code>PP_Resource</code> containing the | 136 * @param[in] config A <code>PP_Resource</code> corresponding to a |
| 134 * <code>PPB_Audio_Config</code>. | 137 * <code>PPB_Audio_Config</code>. |
| 138 * |
| 135 * @return A <code>PP_AudioSampleRate</code> containing sample rate or | 139 * @return A <code>PP_AudioSampleRate</code> containing sample rate or |
| 136 * <code>PP_AUDIOSAMPLERATE_NONE</code> if the resource is invalid. | 140 * <code>PP_AUDIOSAMPLERATE_NONE</code> if the resource is invalid. |
| 137 */ | 141 */ |
| 138 PP_AudioSampleRate GetSampleRate( | 142 PP_AudioSampleRate GetSampleRate( |
| 139 [in] PP_Resource config); | 143 [in] PP_Resource config); |
| 140 | 144 |
| 141 /** | 145 /** |
| 142 * GetSampleFrameCount() returns the sample frame count for the given | 146 * GetSampleFrameCount() returns the sample frame count for the given |
| 143 * <code>PPB_Audio_Config</code>. | 147 * <code>PPB_Audio_Config</code>. |
| 144 * | 148 * |
| 145 * @param[in] config A <code>PP_Resource</code> containing the audio config | 149 * @param[in] config A <code>PP_Resource</code> corresponding to an audio |
| 146 * resource. | 150 * config resource. |
| 151 * |
| 147 * @return A <code>uint32_t</code> containing sample frame count or | 152 * @return A <code>uint32_t</code> containing sample frame count or |
| 148 * 0 if the resource is invalid. See <code>RecommendSampleFrameCount</code> | 153 * 0 if the resource is invalid. Refer to |
| 149 * for more on sample frame counts. | 154 * RecommendSampleFrameCount() for more on sample frame counts. |
| 150 */ | 155 */ |
| 151 uint32_t GetSampleFrameCount( | 156 uint32_t GetSampleFrameCount( |
| 152 [in] PP_Resource config); | 157 [in] PP_Resource config); |
| 153 }; | 158 }; |
| 154 | 159 |
| OLD | NEW |