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 | 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 |
11 label Chrome { | 11 label Chrome { |
12 M14 = 1.0 | 12 M14 = 1.0, |
13 M18 = 1.1 | |
viettrungluu
2012/02/22 19:17:12
This is wrong, unless you merged it into M18 (whic
| |
13 }; | 14 }; |
14 | 15 |
15 /** | 16 /** |
16 * This enumeration contains audio frame count constants. | 17 * This enumeration contains audio frame count constants. |
17 * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> is the minimum possible frame | 18 * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> is the minimum possible frame |
18 * count. <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> is the maximum possible | 19 * count. <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> is the maximum possible |
19 * frame count. | 20 * frame count. |
20 */ | 21 */ |
21 [unnamed] enum PP_AudioFrameSize { | 22 [unnamed] enum PP_AudioFrameSize { |
22 PP_AUDIOMINSAMPLEFRAMECOUNT = 64, | 23 PP_AUDIOMINSAMPLEFRAMECOUNT = 64, |
(...skipping 21 matching lines...) Expand all Loading... | |
44 * This interface only supports 16-bit stereo output. | 45 * This interface only supports 16-bit stereo output. |
45 * | 46 * |
46 * Refer to the | 47 * Refer to the |
47 * <a href="/chrome/nativeclient/docs/audio.html">Pepper | 48 * <a href="/chrome/nativeclient/docs/audio.html">Pepper |
48 * Audio API</a> for information on using this interface. | 49 * Audio API</a> for information on using this interface. |
49 */ | 50 */ |
50 [macro="PPB_AUDIO_CONFIG_INTERFACE"] | 51 [macro="PPB_AUDIO_CONFIG_INTERFACE"] |
51 interface PPB_AudioConfig { | 52 interface PPB_AudioConfig { |
52 /** | 53 /** |
53 * CreateStereo16bit() creates a 16 bit audio configuration resource. The | 54 * CreateStereo16bit() creates a 16 bit audio configuration resource. The |
54 * <code>sample_frame_count</code> should be the result of calling | 55 * <code>sample_rate</code> should be the result of calling |
55 * <code>RecommendSampleFrameCount</code>. If the sample frame count or bit | 56 * <code>RecommendSampleRate</code> and <code>sample_frame_count</code> should |
56 * rate isn't supported, this function will fail and return a null resource. | 57 * be the result of calling <code>RecommendSampleFrameCount</code>. If the |
58 * sample frame count or bit rate isn't supported, this function will fail and | |
59 * return a null resource. | |
57 * | 60 * |
58 * A single sample frame on a stereo device means one value for the left | 61 * A single sample frame on a stereo device means one value for the left |
59 * channel and one value for the right channel. | 62 * channel and one value for the right channel. |
60 * | 63 * |
61 * Buffer layout for a stereo int16 configuration: | 64 * Buffer layout for a stereo int16 configuration: |
62 * <code>int16_t *buffer16;</code> | 65 * <code>int16_t *buffer16;</code> |
63 * <code>buffer16[0]</code> is the first left channel sample. | 66 * <code>buffer16[0]</code> is the first left channel sample. |
64 * <code>buffer16[1]</code> is the first right channel sample. | 67 * <code>buffer16[1]</code> is the first right channel sample. |
65 * <code>buffer16[2]</code> is the second left channel sample. | 68 * <code>buffer16[2]</code> is the second left channel sample. |
66 * <code>buffer16[3]</code> is the second right channel sample. | 69 * <code>buffer16[3]</code> is the second right channel sample. |
(...skipping 15 matching lines...) Expand all Loading... | |
82 * @return A <code>PP_Resource</code> containing the | 85 * @return A <code>PP_Resource</code> containing the |
83 * <code>PPB_Audio_Config</code> if successful or a null resource if the | 86 * <code>PPB_Audio_Config</code> if successful or a null resource if the |
84 * sample frame count or bit rate are not supported. | 87 * sample frame count or bit rate are not supported. |
85 */ | 88 */ |
86 PP_Resource CreateStereo16Bit( | 89 PP_Resource CreateStereo16Bit( |
87 [in] PP_Instance instance, | 90 [in] PP_Instance instance, |
88 [in] PP_AudioSampleRate sample_rate, | 91 [in] PP_AudioSampleRate sample_rate, |
89 [in] uint32_t sample_frame_count); | 92 [in] uint32_t sample_frame_count); |
90 | 93 |
91 /** | 94 /** |
95 * This comment block applies to version 1.0, which is deprecated in favor of | |
96 * the same function but with slightly different signature and behavior. | |
97 * | |
98 * RecommendSampleFrameCount() returns the supported sample frame count | |
99 * closest to the requested count. The sample frame count determines the | |
100 * overall latency of audio. Since one "frame" is always buffered in advance, | |
101 * smaller frame counts will yield lower latency, but higher CPU utilization. | |
102 * For best audio performance, use the value returned by RecommendSampleRate | |
103 * as the input sample rate, then use the RecommendSampleFrameCount return | |
104 * value when creating the audio configuration resource. | |
105 * | |
106 * Sample counts less than | |
107 * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> and greater than | |
108 * <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> are never supported on any | |
109 * system, but values in between aren't necessarily glitch-free. | |
110 * | |
111 * @param[in] sample_rate A <code>PP_AudioSampleRate</code> which is either | |
112 * <code>PP_AUDIOSAMPLERATE_44100</code> or | |
113 * <code>PP_AUDIOSAMPLERATE_48000.</code> | |
114 * @param[in] requested_sample_frame_count A <code>uint_32t</code> requested | |
115 * frame count. | |
116 * | |
117 * @return A <code>uint32_t</code> containing the recommended sample frame | |
118 * count if successful. | |
119 */ | |
120 [deprecate=1.1] | |
121 uint32_t RecommendSampleFrameCount( | |
122 [in] PP_AudioSampleRate sample_rate, | |
123 [in] uint32_t requested_sample_frame_count); | |
124 | |
125 /** | |
92 * RecommendSampleFrameCount() returns the supported sample frame count | 126 * RecommendSampleFrameCount() returns the supported sample frame count |
93 * closest to the requested count. The sample frame count determines the | 127 * closest to the requested count. The sample frame count determines the |
94 * overall latency of audio. Since one "frame" is always buffered in advance, | 128 * overall latency of audio. Since one "frame" is always buffered in advance, |
95 * smaller frame counts will yield lower latency, but higher CPU utilization. | 129 * smaller frame counts will yield lower latency, but higher CPU utilization. |
96 * | 130 * |
97 * Supported sample frame counts will vary by hardware and system (consider | 131 * Supported sample frame counts will vary by hardware and system (consider |
98 * that the local system might be anywhere from a cell phone or a high-end | 132 * that the local system might be anywhere from a cell phone or a high-end |
99 * audio workstation). Sample counts less than | 133 * audio workstation). Sample counts less than |
100 * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> and greater than | 134 * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> and greater than |
101 * <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> are never supported on any | 135 * <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> are never supported on any |
102 * system, but values in between aren't necessarily valid. This function | 136 * system, but values in between aren't necessarily valid. This function |
103 * will return a supported count closest to the requested value. | 137 * will return a supported count closest to the requested value. |
104 * | 138 * |
139 * RecommendSampleFrameCount() result is intended for audio output devices. | |
140 * | |
141 * @param[in] instance | |
105 * @param[in] sample_rate A <code>PP_AudioSampleRate</code> which is either | 142 * @param[in] sample_rate A <code>PP_AudioSampleRate</code> which is either |
106 * <code>PP_AUDIOSAMPLERATE_44100</code> or | 143 * <code>PP_AUDIOSAMPLERATE_44100</code> or |
107 * <code>PP_AUDIOSAMPLERATE_48000.</code> | 144 * <code>PP_AUDIOSAMPLERATE_48000.</code> |
108 * @param[in] requested_sample_frame_count A <code>uint_32t</code> requested | 145 * @param[in] requested_sample_frame_count A <code>uint_32t</code> requested |
109 * frame count. | 146 * frame count. |
110 * | 147 * |
111 * @return A <code>uint32_t</code> containing the recommended sample frame | 148 * @return A <code>uint32_t</code> containing the recommended sample frame |
112 * count if successful. | 149 * count if successful. |
113 */ | 150 */ |
151 [version=1.1] | |
114 uint32_t RecommendSampleFrameCount( | 152 uint32_t RecommendSampleFrameCount( |
153 [in] PP_Instance instance, | |
115 [in] PP_AudioSampleRate sample_rate, | 154 [in] PP_AudioSampleRate sample_rate, |
116 [in] uint32_t requested_sample_frame_count); | 155 [in] uint32_t requested_sample_frame_count); |
117 | 156 |
118 /** | 157 /** |
119 * IsAudioConfig() determines if the given resource is a | 158 * IsAudioConfig() determines if the given resource is a |
120 * <code>PPB_Audio_Config</code>. | 159 * <code>PPB_Audio_Config</code>. |
121 * | 160 * |
122 * @param[in] resource A <code>PP_Resource</code> corresponding to an audio | 161 * @param[in] resource A <code>PP_Resource</code> corresponding to an audio |
123 * config resource. | 162 * config resource. |
124 * | 163 * |
(...skipping 23 matching lines...) Expand all Loading... | |
148 * | 187 * |
149 * @param[in] config A <code>PP_Resource</code> corresponding to an audio | 188 * @param[in] config A <code>PP_Resource</code> corresponding to an audio |
150 * config resource. | 189 * config resource. |
151 * | 190 * |
152 * @return A <code>uint32_t</code> containing sample frame count or | 191 * @return A <code>uint32_t</code> containing sample frame count or |
153 * 0 if the resource is invalid. Refer to | 192 * 0 if the resource is invalid. Refer to |
154 * RecommendSampleFrameCount() for more on sample frame counts. | 193 * RecommendSampleFrameCount() for more on sample frame counts. |
155 */ | 194 */ |
156 uint32_t GetSampleFrameCount( | 195 uint32_t GetSampleFrameCount( |
157 [in] PP_Resource config); | 196 [in] PP_Resource config); |
197 | |
198 /** | |
199 * RecommendSampleRate() returns the native sample rate that the browser | |
200 * is using in the backend. Applications that use the recommended sample | |
201 * rate will have potentially better latency and fidelity. The return value | |
202 * is indended for audio output devices. | |
203 * | |
204 * @param[in] instance | |
205 * | |
206 * @return A <code>uint32_t</code> containing the recommended sample frame | |
207 * count if successful. | |
208 */ | |
209 [version=1.1] | |
210 PP_AudioSampleRate RecommendSampleRate( | |
211 [in] PP_Instance instance); | |
212 | |
158 }; | 213 }; |
159 | 214 |
OLD | NEW |