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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // A synchronous writer interface used by AudioInputController for | 130 // A synchronous writer interface used by AudioInputController for |
131 // synchronous writing. | 131 // synchronous writing. |
132 class MEDIA_EXPORT SyncWriter { | 132 class MEDIA_EXPORT SyncWriter { |
133 public: | 133 public: |
134 virtual ~SyncWriter() {} | 134 virtual ~SyncWriter() {} |
135 | 135 |
136 // Write certain amount of data from |data|. | 136 // Write certain amount of data from |data|. |
137 virtual void Write(const AudioBus* data, | 137 virtual void Write(const AudioBus* data, |
138 double volume, | 138 double volume, |
139 bool key_pressed, | 139 bool key_pressed, |
140 uint32 hardware_delay_bytes) = 0; | 140 uint32_t hardware_delay_bytes) = 0; |
141 | 141 |
142 // Close this synchronous writer. | 142 // Close this synchronous writer. |
143 virtual void Close() = 0; | 143 virtual void Close() = 0; |
144 }; | 144 }; |
145 | 145 |
146 // AudioInputController::Create() can use the currently registered Factory | 146 // AudioInputController::Create() can use the currently registered Factory |
147 // to create the AudioInputController. Factory is intended for testing only. | 147 // to create the AudioInputController. Factory is intended for testing only. |
148 // |user_input_monitor| is used for typing detection and can be NULL. | 148 // |user_input_monitor| is used for typing detection and can be NULL. |
149 class Factory { | 149 class Factory { |
150 public: | 150 public: |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 virtual void Close(const base::Closure& closed_task); | 218 virtual void Close(const base::Closure& closed_task); |
219 | 219 |
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 // AudioInputCallback implementation. Threading details depends on the | 224 // AudioInputCallback implementation. Threading details depends on the |
225 // device-specific implementation. | 225 // device-specific implementation. |
226 void OnData(AudioInputStream* stream, | 226 void OnData(AudioInputStream* stream, |
227 const AudioBus* source, | 227 const AudioBus* source, |
228 uint32 hardware_delay_bytes, | 228 uint32_t hardware_delay_bytes, |
229 double volume) override; | 229 double volume) override; |
230 void OnError(AudioInputStream* stream) override; | 230 void OnError(AudioInputStream* stream) override; |
231 | 231 |
232 bool SharedMemoryAndSyncSocketMode() const { return sync_writer_ != NULL; } | 232 bool SharedMemoryAndSyncSocketMode() const { return sync_writer_ != NULL; } |
233 | 233 |
234 // Enable debug recording of audio input. | 234 // Enable debug recording of audio input. |
235 void EnableDebugRecording(AudioInputWriter* input_writer); | 235 void EnableDebugRecording(AudioInputWriter* input_writer); |
236 | 236 |
237 // Disbale debug recording of audio input. Must be called before owner of | 237 // Disbale debug recording of audio input. Must be called before owner of |
238 // |input_writer| deletes it. | 238 // |input_writer| deletes it. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 | 385 |
386 // Used for audio debug recordings. Accessed on audio thread. | 386 // Used for audio debug recordings. Accessed on audio thread. |
387 AudioInputWriter* input_writer_; | 387 AudioInputWriter* input_writer_; |
388 | 388 |
389 DISALLOW_COPY_AND_ASSIGN(AudioInputController); | 389 DISALLOW_COPY_AND_ASSIGN(AudioInputController); |
390 }; | 390 }; |
391 | 391 |
392 } // namespace media | 392 } // namespace media |
393 | 393 |
394 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ | 394 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ |
OLD | NEW |