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 MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ |
6 #define MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ | 6 #define MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "base/atomicops.h" | 9 #include "base/atomicops.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // Sets the capture volume of the input stream. The value 0.0 corresponds | 220 // Sets the capture volume of the input stream. The value 0.0 corresponds |
221 // to muted and 1.0 to maximum volume. | 221 // to muted and 1.0 to maximum volume. |
222 virtual void SetVolume(double volume); | 222 virtual void SetVolume(double volume); |
223 | 223 |
224 // Sets the Automatic Gain Control (AGC) state of the input stream. | 224 // Sets the Automatic Gain Control (AGC) state of the input stream. |
225 // Changing the AGC state is not supported while recording is active. | 225 // Changing the AGC state is not supported while recording is active. |
226 virtual void SetAutomaticGainControl(bool enabled); | 226 virtual void SetAutomaticGainControl(bool enabled); |
227 | 227 |
228 // AudioInputCallback implementation. Threading details depends on the | 228 // AudioInputCallback implementation. Threading details depends on the |
229 // device-specific implementation. | 229 // device-specific implementation. |
230 virtual void OnData(AudioInputStream* stream, | 230 void OnData(AudioInputStream* stream, |
231 const AudioBus* source, | 231 const AudioBus* source, |
232 uint32 hardware_delay_bytes, | 232 uint32 hardware_delay_bytes, |
233 double volume) override; | 233 double volume) override; |
234 virtual void OnError(AudioInputStream* stream) override; | 234 void OnError(AudioInputStream* stream) override; |
235 | 235 |
236 bool SharedMemoryAndSyncSocketMode() const { return sync_writer_ != NULL; } | 236 bool SharedMemoryAndSyncSocketMode() const { return sync_writer_ != NULL; } |
237 | 237 |
238 protected: | 238 protected: |
239 friend class base::RefCountedThreadSafe<AudioInputController>; | 239 friend class base::RefCountedThreadSafe<AudioInputController>; |
240 | 240 |
241 // Internal state of the source. | 241 // Internal state of the source. |
242 enum State { | 242 enum State { |
243 CREATED, | 243 CREATED, |
244 RECORDING, | 244 RECORDING, |
(...skipping 16 matching lines...) Expand all Loading... |
261 SILENCE_STATE_ONLY_AUDIO = 1, | 261 SILENCE_STATE_ONLY_AUDIO = 1, |
262 SILENCE_STATE_ONLY_SILENCE = 2, | 262 SILENCE_STATE_ONLY_SILENCE = 2, |
263 SILENCE_STATE_AUDIO_AND_SILENCE = 3, | 263 SILENCE_STATE_AUDIO_AND_SILENCE = 3, |
264 SILENCE_STATE_MAX = SILENCE_STATE_AUDIO_AND_SILENCE | 264 SILENCE_STATE_MAX = SILENCE_STATE_AUDIO_AND_SILENCE |
265 }; | 265 }; |
266 #endif | 266 #endif |
267 | 267 |
268 AudioInputController(EventHandler* handler, | 268 AudioInputController(EventHandler* handler, |
269 SyncWriter* sync_writer, | 269 SyncWriter* sync_writer, |
270 UserInputMonitor* user_input_monitor); | 270 UserInputMonitor* user_input_monitor); |
271 virtual ~AudioInputController(); | 271 ~AudioInputController() override; |
272 | 272 |
273 // Methods called on the audio thread (owned by the AudioManager). | 273 // Methods called on the audio thread (owned by the AudioManager). |
274 void DoCreate(AudioManager* audio_manager, | 274 void DoCreate(AudioManager* audio_manager, |
275 const AudioParameters& params, | 275 const AudioParameters& params, |
276 const std::string& device_id); | 276 const std::string& device_id); |
277 void DoCreateForLowLatency(AudioManager* audio_manager, | 277 void DoCreateForLowLatency(AudioManager* audio_manager, |
278 const AudioParameters& params, | 278 const AudioParameters& params, |
279 const std::string& device_id); | 279 const std::string& device_id); |
280 void DoCreateForStream(AudioInputStream* stream_to_control); | 280 void DoCreateForStream(AudioInputStream* stream_to_control); |
281 void DoRecord(); | 281 void DoRecord(); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 369 |
370 // Time when a low-latency stream is created. | 370 // Time when a low-latency stream is created. |
371 base::TimeTicks low_latency_create_time_; | 371 base::TimeTicks low_latency_create_time_; |
372 | 372 |
373 DISALLOW_COPY_AND_ASSIGN(AudioInputController); | 373 DISALLOW_COPY_AND_ASSIGN(AudioInputController); |
374 }; | 374 }; |
375 | 375 |
376 } // namespace media | 376 } // namespace media |
377 | 377 |
378 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ | 378 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ |
OLD | NEW |