| 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_WIN_WAVEIN_INPUT_WIN_H_ | 5 #ifndef MEDIA_AUDIO_WIN_WAVEIN_INPUT_WIN_H_ |
| 6 #define MEDIA_AUDIO_WIN_WAVEIN_INPUT_WIN_H_ | 6 #define MEDIA_AUDIO_WIN_WAVEIN_INPUT_WIN_H_ |
| 7 | 7 |
| 8 #include <string> |
| 9 |
| 8 #include <windows.h> | 10 #include <windows.h> |
| 9 #include <mmsystem.h> | 11 #include <mmsystem.h> |
| 10 | 12 |
| 11 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 13 #include "base/win/scoped_handle.h" | 15 #include "base/win/scoped_handle.h" |
| 14 #include "media/audio/audio_io.h" | 16 #include "media/audio/audio_io.h" |
| 15 #include "media/audio/audio_parameters.h" | 17 #include "media/audio/audio_parameters.h" |
| 16 | 18 |
| 17 class AudioManagerWin; | 19 class AudioManagerWin; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 29 | 31 |
| 30 // Implementation of AudioInputStream. | 32 // Implementation of AudioInputStream. |
| 31 virtual bool Open() OVERRIDE; | 33 virtual bool Open() OVERRIDE; |
| 32 virtual void Start(AudioInputCallback* callback) OVERRIDE; | 34 virtual void Start(AudioInputCallback* callback) OVERRIDE; |
| 33 virtual void Stop() OVERRIDE; | 35 virtual void Stop() OVERRIDE; |
| 34 virtual void Close() OVERRIDE; | 36 virtual void Close() OVERRIDE; |
| 35 // TODO(henrika): Add volume support using the Audio Mixer API. | 37 // TODO(henrika): Add volume support using the Audio Mixer API. |
| 36 virtual double GetMaxVolume() OVERRIDE; | 38 virtual double GetMaxVolume() OVERRIDE; |
| 37 virtual void SetVolume(double volume) OVERRIDE; | 39 virtual void SetVolume(double volume) OVERRIDE; |
| 38 virtual double GetVolume() OVERRIDE; | 40 virtual double GetVolume() OVERRIDE; |
| 41 virtual void SetAutomaticGainControl(bool enabled) OVERRIDE; |
| 42 virtual bool GetAutomaticGainControl() OVERRIDE; |
| 39 | 43 |
| 40 private: | 44 private: |
| 41 enum State { | 45 enum State { |
| 42 kStateEmpty, // Initial state. | 46 kStateEmpty, // Initial state. |
| 43 kStateReady, // Device obtained and ready to record. | 47 kStateReady, // Device obtained and ready to record. |
| 44 kStateRecording, // Recording audio. | 48 kStateRecording, // Recording audio. |
| 45 kStateStopping, // Trying to stop, waiting for callback to finish. | 49 kStateStopping, // Trying to stop, waiting for callback to finish. |
| 46 kStateStopped, // Stopped. Device was reset. | 50 kStateStopped, // Stopped. Device was reset. |
| 47 kStateClosed // Device has been released. | 51 kStateClosed // Device has been released. |
| 48 }; | 52 }; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // Pointer to the first allocated audio buffer. This object owns it. | 111 // Pointer to the first allocated audio buffer. This object owns it. |
| 108 WAVEHDR* buffer_; | 112 WAVEHDR* buffer_; |
| 109 | 113 |
| 110 // An event that is signaled when the callback thread is ready to stop. | 114 // An event that is signaled when the callback thread is ready to stop. |
| 111 base::win::ScopedHandle stopped_event_; | 115 base::win::ScopedHandle stopped_event_; |
| 112 | 116 |
| 113 DISALLOW_COPY_AND_ASSIGN(PCMWaveInAudioInputStream); | 117 DISALLOW_COPY_AND_ASSIGN(PCMWaveInAudioInputStream); |
| 114 }; | 118 }; |
| 115 | 119 |
| 116 #endif // MEDIA_AUDIO_WIN_WAVEIN_INPUT_WIN_H_ | 120 #endif // MEDIA_AUDIO_WIN_WAVEIN_INPUT_WIN_H_ |
| OLD | NEW |