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 // Implementation of AudioInputStream for Windows using Windows Core Audio | 5 // Implementation of AudioInputStream for Windows using Windows Core Audio |
6 // WASAPI for low latency capturing. | 6 // WASAPI for low latency capturing. |
7 // | 7 // |
8 // Overview of operation: | 8 // Overview of operation: |
9 // | 9 // |
10 // - An object of WASAPIAudioInputStream is created by the AudioManager | 10 // - An object of WASAPIAudioInputStream is created by the AudioManager |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // the audio manager who is creating this object. | 88 // the audio manager who is creating this object. |
89 WASAPIAudioInputStream(AudioManagerWin* manager, | 89 WASAPIAudioInputStream(AudioManagerWin* manager, |
90 const AudioParameters& params, | 90 const AudioParameters& params, |
91 const std::string& device_id); | 91 const std::string& device_id); |
92 | 92 |
93 // The dtor is typically called by the AudioManager only and it is usually | 93 // The dtor is typically called by the AudioManager only and it is usually |
94 // triggered by calling AudioInputStream::Close(). | 94 // triggered by calling AudioInputStream::Close(). |
95 virtual ~WASAPIAudioInputStream(); | 95 virtual ~WASAPIAudioInputStream(); |
96 | 96 |
97 // Implementation of AudioInputStream. | 97 // Implementation of AudioInputStream. |
98 virtual bool Open() OVERRIDE; | 98 virtual bool Open() override; |
99 virtual void Start(AudioInputCallback* callback) OVERRIDE; | 99 virtual void Start(AudioInputCallback* callback) override; |
100 virtual void Stop() OVERRIDE; | 100 virtual void Stop() override; |
101 virtual void Close() OVERRIDE; | 101 virtual void Close() override; |
102 virtual double GetMaxVolume() OVERRIDE; | 102 virtual double GetMaxVolume() override; |
103 virtual void SetVolume(double volume) OVERRIDE; | 103 virtual void SetVolume(double volume) override; |
104 virtual double GetVolume() OVERRIDE; | 104 virtual double GetVolume() override; |
105 | 105 |
106 bool started() const { return started_; } | 106 bool started() const { return started_; } |
107 | 107 |
108 // Returns the default hardware audio parameters of the specific device. | 108 // Returns the default hardware audio parameters of the specific device. |
109 static AudioParameters GetInputStreamParameters(const std::string& device_id); | 109 static AudioParameters GetInputStreamParameters(const std::string& device_id); |
110 | 110 |
111 private: | 111 private: |
112 // DelegateSimpleThread::Delegate implementation. | 112 // DelegateSimpleThread::Delegate implementation. |
113 virtual void Run() OVERRIDE; | 113 virtual void Run() override; |
114 | 114 |
115 // Issues the OnError() callback to the |sink_|. | 115 // Issues the OnError() callback to the |sink_|. |
116 void HandleError(HRESULT err); | 116 void HandleError(HRESULT err); |
117 | 117 |
118 // The Open() method is divided into these sub methods. | 118 // The Open() method is divided into these sub methods. |
119 HRESULT SetCaptureDevice(); | 119 HRESULT SetCaptureDevice(); |
120 HRESULT ActivateCaptureDevice(); | 120 HRESULT ActivateCaptureDevice(); |
121 HRESULT GetAudioEngineStreamFormat(); | 121 HRESULT GetAudioEngineStreamFormat(); |
122 bool DesiredFormatIsSupported(); | 122 bool DesiredFormatIsSupported(); |
123 HRESULT InitializeAudioEngine(); | 123 HRESULT InitializeAudioEngine(); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // Extra audio bus used for storage of deinterleaved data for the OnData | 217 // Extra audio bus used for storage of deinterleaved data for the OnData |
218 // callback. | 218 // callback. |
219 scoped_ptr<media::AudioBus> audio_bus_; | 219 scoped_ptr<media::AudioBus> audio_bus_; |
220 | 220 |
221 DISALLOW_COPY_AND_ASSIGN(WASAPIAudioInputStream); | 221 DISALLOW_COPY_AND_ASSIGN(WASAPIAudioInputStream); |
222 }; | 222 }; |
223 | 223 |
224 } // namespace media | 224 } // namespace media |
225 | 225 |
226 #endif // MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_INPUT_WIN_H_ | 226 #endif // MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_INPUT_WIN_H_ |
OLD | NEW |