OLD | NEW |
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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 } | 208 } |
209 | 209 |
210 void PCMWaveOutAudioOutputStream::GetVolume(double* left_level, | 210 void PCMWaveOutAudioOutputStream::GetVolume(double* left_level, |
211 double* right_level) { | 211 double* right_level) { |
212 if (!waveout_) | 212 if (!waveout_) |
213 return; | 213 return; |
214 *left_level = volume_; | 214 *left_level = volume_; |
215 *right_level = volume_; | 215 *right_level = volume_; |
216 } | 216 } |
217 | 217 |
218 size_t PCMWaveOutAudioOutputStream::GetNumBuffers() { | |
219 return kNumBuffers; | |
220 } | |
221 | |
222 void PCMWaveOutAudioOutputStream::HandleError(MMRESULT error) { | 218 void PCMWaveOutAudioOutputStream::HandleError(MMRESULT error) { |
223 DLOG(WARNING) << "PCMWaveOutAudio error " << error; | 219 DLOG(WARNING) << "PCMWaveOutAudio error " << error; |
224 callback_->OnError(this, error); | 220 callback_->OnError(this, error); |
225 } | 221 } |
226 | 222 |
227 void PCMWaveOutAudioOutputStream::QueueNextPacket(WAVEHDR *buffer) { | 223 void PCMWaveOutAudioOutputStream::QueueNextPacket(WAVEHDR *buffer) { |
228 // Call the source which will fill our buffer with pleasant sounds and | 224 // Call the source which will fill our buffer with pleasant sounds and |
229 // return to us how many bytes were used. | 225 // return to us how many bytes were used. |
230 // TODO(fbarchard): Handle used 0 by queueing more. | 226 // TODO(fbarchard): Handle used 0 by queueing more. |
231 size_t used = callback_->OnMoreData(this, buffer->lpData, buffer_size_); | 227 size_t used = callback_->OnMoreData(this, buffer->lpData, buffer_size_); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 if (result != MMSYSERR_NOERROR) | 271 if (result != MMSYSERR_NOERROR) |
276 obj->HandleError(result); | 272 obj->HandleError(result); |
277 | 273 |
278 } else if (msg == WOM_CLOSE) { | 274 } else if (msg == WOM_CLOSE) { |
279 // We can be closed before calling Start, so it is possible to have a | 275 // We can be closed before calling Start, so it is possible to have a |
280 // null callback at this point. | 276 // null callback at this point. |
281 if (obj->callback_) | 277 if (obj->callback_) |
282 obj->callback_->OnClose(obj); | 278 obj->callback_->OnClose(obj); |
283 } | 279 } |
284 } | 280 } |
OLD | NEW |