Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Side by Side Diff: media/audio/win/audio_low_latency_input_win.cc

Issue 731373002: Enable MSVC warning for unused locals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another Windows fix Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "media/audio/win/audio_low_latency_input_win.h" 5 #include "media/audio/win/audio_low_latency_input_win.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "media/audio/win/audio_manager_win.h" 10 #include "media/audio/win/audio_manager_win.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 DCHECK(CalledOnValidThread()); 233 DCHECK(CalledOnValidThread());
234 DCHECK_GE(volume, 0.0); 234 DCHECK_GE(volume, 0.0);
235 DCHECK_LE(volume, 1.0); 235 DCHECK_LE(volume, 1.0);
236 236
237 DLOG_IF(ERROR, !opened_) << "Open() has not been called successfully"; 237 DLOG_IF(ERROR, !opened_) << "Open() has not been called successfully";
238 if (!opened_) 238 if (!opened_)
239 return; 239 return;
240 240
241 // Set a new master volume level. Valid volume levels are in the range 241 // Set a new master volume level. Valid volume levels are in the range
242 // 0.0 to 1.0. Ignore volume-change events. 242 // 0.0 to 1.0. Ignore volume-change events.
243 HRESULT hr = simple_audio_volume_->SetMasterVolume(static_cast<float>(volume), 243 HRESULT hr =
244 NULL); 244 simple_audio_volume_->SetMasterVolume(static_cast<float>(volume), NULL);
245 DLOG_IF(WARNING, FAILED(hr)) << "Failed to set new input master volume."; 245 if (FAILED(hr))
246 DLOG(WARNING) << "Failed to set new input master volume.";
246 247
247 // Update the AGC volume level based on the last setting above. Note that, 248 // Update the AGC volume level based on the last setting above. Note that,
248 // the volume-level resolution is not infinite and it is therefore not 249 // the volume-level resolution is not infinite and it is therefore not
249 // possible to assume that the volume provided as input parameter can be 250 // possible to assume that the volume provided as input parameter can be
250 // used directly. Instead, a new query to the audio hardware is required. 251 // used directly. Instead, a new query to the audio hardware is required.
251 // This method does nothing if AGC is disabled. 252 // This method does nothing if AGC is disabled.
252 UpdateAgcVolume(); 253 UpdateAgcVolume();
253 } 254 }
254 255
255 double WASAPIAudioInputStream::GetVolume() { 256 double WASAPIAudioInputStream::GetVolume() {
256 DCHECK(opened_) << "Open() has not been called successfully"; 257 DCHECK(opened_) << "Open() has not been called successfully";
257 if (!opened_) 258 if (!opened_)
258 return 0.0; 259 return 0.0;
259 260
260 // Retrieve the current volume level. The value is in the range 0.0 to 1.0. 261 // Retrieve the current volume level. The value is in the range 0.0 to 1.0.
261 float level = 0.0f; 262 float level = 0.0f;
262 HRESULT hr = simple_audio_volume_->GetMasterVolume(&level); 263 HRESULT hr = simple_audio_volume_->GetMasterVolume(&level);
263 DLOG_IF(WARNING, FAILED(hr)) << "Failed to get input master volume."; 264 if (FAILED(hr))
265 DLOG(WARNING) << "Failed to get input master volume.";
264 266
265 return static_cast<double>(level); 267 return static_cast<double>(level);
266 } 268 }
267 269
268 bool WASAPIAudioInputStream::IsMuted() { 270 bool WASAPIAudioInputStream::IsMuted() {
269 DCHECK(opened_) << "Open() has not been called successfully"; 271 DCHECK(opened_) << "Open() has not been called successfully";
270 DCHECK(CalledOnValidThread()); 272 DCHECK(CalledOnValidThread());
271 if (!opened_) 273 if (!opened_)
272 return false; 274 return false;
273 275
274 // Retrieves the current muting state for the audio session. 276 // Retrieves the current muting state for the audio session.
275 BOOL is_muted = FALSE; 277 BOOL is_muted = FALSE;
276 HRESULT hr = simple_audio_volume_->GetMute(&is_muted); 278 HRESULT hr = simple_audio_volume_->GetMute(&is_muted);
277 DLOG_IF(WARNING, FAILED(hr)) << "Failed to get input master volume."; 279 if (FAILED(hr))
280 DLOG(WARNING) << "Failed to get input master volume.";
278 281
279 return is_muted != FALSE; 282 return is_muted != FALSE;
280 } 283 }
281 284
282 // static 285 // static
283 AudioParameters WASAPIAudioInputStream::GetInputStreamParameters( 286 AudioParameters WASAPIAudioInputStream::GetInputStreamParameters(
284 const std::string& device_id) { 287 const std::string& device_id) {
285 int sample_rate = 48000; 288 int sample_rate = 48000;
286 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; 289 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
287 290
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 return hr; 762 return hr;
760 763
761 // Obtain a reference to the ISimpleAudioVolume interface which enables 764 // Obtain a reference to the ISimpleAudioVolume interface which enables
762 // us to control the master volume level of an audio session. 765 // us to control the master volume level of an audio session.
763 hr = audio_client_->GetService(__uuidof(ISimpleAudioVolume), 766 hr = audio_client_->GetService(__uuidof(ISimpleAudioVolume),
764 simple_audio_volume_.ReceiveVoid()); 767 simple_audio_volume_.ReceiveVoid());
765 return hr; 768 return hr;
766 } 769 }
767 770
768 } // namespace media 771 } // namespace media
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc ('k') | mojo/public/cpp/system/tests/macros_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698