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 #include <windows.h> | 5 #include <windows.h> |
6 #include <mmsystem.h> | 6 #include <mmsystem.h> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 int channels() const { | 146 int channels() const { |
147 return ChannelLayoutToChannelCount(channel_layout_); | 147 return ChannelLayoutToChannelCount(channel_layout_); |
148 } | 148 } |
149 int bits_per_sample() const { return bits_per_sample_; } | 149 int bits_per_sample() const { return bits_per_sample_; } |
150 int sample_rate() const { return sample_rate_; } | 150 int sample_rate() const { return sample_rate_; } |
151 int samples_per_packet() const { return samples_per_packet_; } | 151 int samples_per_packet() const { return samples_per_packet_; } |
152 | 152 |
153 private: | 153 private: |
154 AudioInputStream* CreateInputStream() { | 154 AudioInputStream* CreateInputStream() { |
155 AudioInputStream* ais = audio_man_->MakeAudioInputStream( | 155 AudioInputStream* ais = audio_man_->MakeAudioInputStream( |
156 AudioParameters(format_, channel_layout_, sample_rate_, | 156 AudioParameters(format_, false, channel_layout_, sample_rate_, |
157 bits_per_sample_, samples_per_packet_), | 157 bits_per_sample_, samples_per_packet_), |
158 AudioManagerBase::kDefaultDeviceId); | 158 AudioManagerBase::kDefaultDeviceId); |
159 EXPECT_TRUE(ais); | 159 EXPECT_TRUE(ais); |
160 return ais; | 160 return ais; |
161 } | 161 } |
162 | 162 |
163 ScopedCOMInitializer com_init_; | 163 ScopedCOMInitializer com_init_; |
164 AudioManager* audio_man_; | 164 AudioManager* audio_man_; |
165 AudioParameters::Format format_; | 165 AudioParameters::Format format_; |
166 ChannelLayout channel_layout_; | 166 ChannelLayout channel_layout_; |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 383 |
384 LOG(INFO) << ">> Sample rate: " << aisw.sample_rate() << " [Hz]"; | 384 LOG(INFO) << ">> Sample rate: " << aisw.sample_rate() << " [Hz]"; |
385 WriteToFileAudioSink file_sink(file_name); | 385 WriteToFileAudioSink file_sink(file_name); |
386 LOG(INFO) << ">> Speak into the default microphone while recording."; | 386 LOG(INFO) << ">> Speak into the default microphone while recording."; |
387 ais->Start(&file_sink); | 387 ais->Start(&file_sink); |
388 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); | 388 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); |
389 ais->Stop(); | 389 ais->Stop(); |
390 LOG(INFO) << ">> Recording has stopped."; | 390 LOG(INFO) << ">> Recording has stopped."; |
391 ais->Close(); | 391 ais->Close(); |
392 } | 392 } |
OLD | NEW |