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 // Utility methods for the Core Audio API on Windows. | 5 // Utility methods for the Core Audio API on Windows. |
6 // Always ensure that Core Audio is supported before using these methods. | 6 // Always ensure that Core Audio is supported before using these methods. |
7 // Use media::CoreAudioUtil::IsSupported() for this purpose. | 7 // Use media::CoreAudioUtil::IsSupported() for this purpose. |
8 // Also, all methods must be called on a valid COM thread. This can be done | 8 // Also, all methods must be called on a valid COM thread. This can be done |
9 // by using the base::win::ScopedCOMInitializer helper class. | 9 // by using the base::win::ScopedCOMInitializer helper class. |
10 | 10 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 EDataFlow data_flow); | 193 EDataFlow data_flow); |
194 | 194 |
195 // After activating an IAudioClient interface on an audio endpoint device, | 195 // After activating an IAudioClient interface on an audio endpoint device, |
196 // the client must initialize it once, and only once, to initialize the audio | 196 // the client must initialize it once, and only once, to initialize the audio |
197 // stream between the client and the device. In shared mode, the client | 197 // stream between the client and the device. In shared mode, the client |
198 // connects indirectly through the audio engine which does the mixing. | 198 // connects indirectly through the audio engine which does the mixing. |
199 // In exclusive mode, the client connects directly to the audio hardware. | 199 // In exclusive mode, the client connects directly to the audio hardware. |
200 // If a valid event is provided in |event_handle|, the client will be | 200 // If a valid event is provided in |event_handle|, the client will be |
201 // initialized for event-driven buffer handling. If |event_handle| is set to | 201 // initialized for event-driven buffer handling. If |event_handle| is set to |
202 // NULL, event-driven buffer handling is not utilized. | 202 // NULL, event-driven buffer handling is not utilized. |
203 // This function will initialize the audio client as part of the default | |
204 // audio session. | |
203 static HRESULT SharedModeInitialize(IAudioClient* client, | 205 static HRESULT SharedModeInitialize(IAudioClient* client, |
no longer working on chromium
2014/07/08 10:42:35
it seems that this method is not used in productio
tommi (sloooow) - chröme
2014/07/08 12:30:56
I removed it and renamed the other one to SharedMo
| |
204 const WAVEFORMATPCMEX* format, | 206 const WAVEFORMATPCMEX* format, |
205 HANDLE event_handle, | 207 HANDLE event_handle, |
206 uint32* endpoint_buffer_size); | 208 uint32* endpoint_buffer_size); |
209 | |
210 // Same as SharedModeInitialize with the addition of being able to specify | |
211 // a specific audio session to initialize the audio client as part of. | |
212 // NULL can be passed for |session_guid| which represents the default session. | |
213 static HRESULT SharedModeInitializeWithSession(IAudioClient* client, | |
214 const WAVEFORMATPCMEX* format, | |
215 HANDLE event_handle, | |
216 uint32* endpoint_buffer_size, | |
217 const GUID* session_guid); | |
207 // TODO(henrika): add ExclusiveModeInitialize(...) | 218 // TODO(henrika): add ExclusiveModeInitialize(...) |
208 | 219 |
209 // Create an IAudioRenderClient client for an existing IAudioClient given by | 220 // Create an IAudioRenderClient client for an existing IAudioClient given by |
210 // |client|. The IAudioRenderClient interface enables a client to write | 221 // |client|. The IAudioRenderClient interface enables a client to write |
211 // output data to a rendering endpoint buffer. | 222 // output data to a rendering endpoint buffer. |
212 static ScopedComPtr<IAudioRenderClient> CreateRenderClient( | 223 static ScopedComPtr<IAudioRenderClient> CreateRenderClient( |
213 IAudioClient* client); | 224 IAudioClient* client); |
214 | 225 |
215 // Create an IAudioCaptureClient client for an existing IAudioClient given by | 226 // Create an IAudioCaptureClient client for an existing IAudioClient given by |
216 // |client|. The IAudioCaptureClient interface enables a client to read | 227 // |client|. The IAudioCaptureClient interface enables a client to read |
217 // input data from a capture endpoint buffer. | 228 // input data from a capture endpoint buffer. |
218 static ScopedComPtr<IAudioCaptureClient> CreateCaptureClient( | 229 static ScopedComPtr<IAudioCaptureClient> CreateCaptureClient( |
219 IAudioClient* client); | 230 IAudioClient* client); |
220 | 231 |
221 // Fills up the endpoint rendering buffer with silence for an existing | 232 // Fills up the endpoint rendering buffer with silence for an existing |
222 // IAudioClient given by |client| and a corresponding IAudioRenderClient | 233 // IAudioClient given by |client| and a corresponding IAudioRenderClient |
223 // given by |render_client|. | 234 // given by |render_client|. |
224 static bool FillRenderEndpointBufferWithSilence( | 235 static bool FillRenderEndpointBufferWithSilence( |
225 IAudioClient* client, IAudioRenderClient* render_client); | 236 IAudioClient* client, IAudioRenderClient* render_client); |
226 | 237 |
227 private: | 238 private: |
228 CoreAudioUtil() {} | 239 CoreAudioUtil() {} |
229 ~CoreAudioUtil() {} | 240 ~CoreAudioUtil() {} |
230 DISALLOW_COPY_AND_ASSIGN(CoreAudioUtil); | 241 DISALLOW_COPY_AND_ASSIGN(CoreAudioUtil); |
231 }; | 242 }; |
232 | 243 |
244 // The special audio session identifier we use when opening up the default | |
245 // communication device. This has the effect that a separate volume control | |
246 // will be shown in the system's volume mixer and control over ducking and | |
247 // visually observing the behavior of ducking, is easier. | |
248 // Use with |SharedModeInitializeWithSession|. | |
249 extern const GUID kCommunicationsSessionId; | |
250 | |
233 } // namespace media | 251 } // namespace media |
234 | 252 |
235 #endif // MEDIA_AUDIO_WIN_CORE_AUDIO_UTIL_WIN_H_ | 253 #endif // MEDIA_AUDIO_WIN_CORE_AUDIO_UTIL_WIN_H_ |
OLD | NEW |