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

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

Issue 155471: Refactoring to share MockAudioOutputStream implementations across 3 platforms... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/win/waveout_output_win.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #pragma comment(lib, "winmm.lib") 7 #pragma comment(lib, "winmm.lib")
8 8
9 #include "media/audio/win/waveout_output_win.h" 9 #include "media/audio/win/waveout_output_win.h"
10 10
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 DWORD volume_packed = 0; 222 DWORD volume_packed = 0;
223 MMRESULT res = ::waveOutGetVolume(waveout_, &volume_packed); 223 MMRESULT res = ::waveOutGetVolume(waveout_, &volume_packed);
224 if (res != MMSYSERR_NOERROR) { 224 if (res != MMSYSERR_NOERROR) {
225 HandleError(res); 225 HandleError(res);
226 return; 226 return;
227 } 227 }
228 *left_level = static_cast<double>(LOWORD(volume_packed)) / kMaxVolumeLevel; 228 *left_level = static_cast<double>(LOWORD(volume_packed)) / kMaxVolumeLevel;
229 *right_level = static_cast<double>(HIWORD(volume_packed)) / kMaxVolumeLevel; 229 *right_level = static_cast<double>(HIWORD(volume_packed)) / kMaxVolumeLevel;
230 } 230 }
231 231
232 size_t PCMWaveOutAudioOutputStream::GetNumBuffers() {
233 return kNumBuffers;
234 }
235
236 void PCMWaveOutAudioOutputStream::HandleError(MMRESULT error) { 232 void PCMWaveOutAudioOutputStream::HandleError(MMRESULT error) {
237 DLOG(WARNING) << "PCMWaveOutAudio error " << error; 233 DLOG(WARNING) << "PCMWaveOutAudio error " << error;
238 callback_->OnError(this, error); 234 callback_->OnError(this, error);
239 } 235 }
240 236
241 void PCMWaveOutAudioOutputStream::QueueNextPacket(WAVEHDR *buffer) { 237 void PCMWaveOutAudioOutputStream::QueueNextPacket(WAVEHDR *buffer) {
242 // Call the source which will fill our buffer with pleasant sounds and 238 // Call the source which will fill our buffer with pleasant sounds and
243 // return to us how many bytes were used. 239 // return to us how many bytes were used.
244 // TODO(fbarchard): Handle used 0 by queueing more. 240 // TODO(fbarchard): Handle used 0 by queueing more.
245 size_t used = callback_->OnMoreData(this, buffer->lpData, buffer_size_); 241 size_t used = callback_->OnMoreData(this, buffer->lpData, buffer_size_);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 if (result != MMSYSERR_NOERROR) 281 if (result != MMSYSERR_NOERROR)
286 obj->HandleError(result); 282 obj->HandleError(result);
287 283
288 } else if (msg == WOM_CLOSE) { 284 } else if (msg == WOM_CLOSE) {
289 // We can be closed before calling Start, so it is possible to have a 285 // We can be closed before calling Start, so it is possible to have a
290 // null callback at this point. 286 // null callback at this point.
291 if (obj->callback_) 287 if (obj->callback_)
292 obj->callback_->OnClose(obj); 288 obj->callback_->OnClose(obj);
293 } 289 }
294 } 290 }
OLDNEW
« no previous file with comments | « media/audio/win/waveout_output_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698