OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 state_ = PCMA_CLOSED; | 208 state_ = PCMA_CLOSED; |
209 waveout_ = NULL; | 209 waveout_ = NULL; |
210 FreeBuffers(); | 210 FreeBuffers(); |
211 } | 211 } |
212 // Tell the audio manager that we have been released. This can result in | 212 // Tell the audio manager that we have been released. This can result in |
213 // the manager destroying us in-place so this needs to be the last thing | 213 // the manager destroying us in-place so this needs to be the last thing |
214 // we do on this function. | 214 // we do on this function. |
215 manager_->ReleaseStream(this); | 215 manager_->ReleaseStream(this); |
216 } | 216 } |
217 | 217 |
218 void PCMWaveOutAudioOutputStream::SetVolume(double left_level, | 218 void PCMWaveOutAudioOutputStream::SetVolume(double volume) { |
219 double ) { | |
220 if (!waveout_) | 219 if (!waveout_) |
221 return; | 220 return; |
222 volume_ = static_cast<float>(left_level); | 221 volume_ = static_cast<float>(volume); |
223 } | 222 } |
224 | 223 |
225 void PCMWaveOutAudioOutputStream::GetVolume(double* left_level, | 224 void PCMWaveOutAudioOutputStream::GetVolume(double* volume) { |
226 double* right_level) { | |
227 if (!waveout_) | 225 if (!waveout_) |
228 return; | 226 return; |
229 *left_level = volume_; | 227 *volume = volume_; |
230 *right_level = volume_; | |
231 } | 228 } |
232 | 229 |
233 void PCMWaveOutAudioOutputStream::HandleError(MMRESULT error) { | 230 void PCMWaveOutAudioOutputStream::HandleError(MMRESULT error) { |
234 DLOG(WARNING) << "PCMWaveOutAudio error " << error; | 231 DLOG(WARNING) << "PCMWaveOutAudio error " << error; |
235 callback_->OnError(this, error); | 232 callback_->OnError(this, error); |
236 } | 233 } |
237 | 234 |
238 void PCMWaveOutAudioOutputStream::QueueNextPacket(WAVEHDR *buffer) { | 235 void PCMWaveOutAudioOutputStream::QueueNextPacket(WAVEHDR *buffer) { |
239 // Call the source which will fill our buffer with pleasant sounds and | 236 // Call the source which will fill our buffer with pleasant sounds and |
240 // return to us how many bytes were used. | 237 // return to us how many bytes were used. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 300 |
304 obj->pending_bytes_ += buffer->dwBufferLength; | 301 obj->pending_bytes_ += buffer->dwBufferLength; |
305 | 302 |
306 } else if (msg == WOM_CLOSE) { | 303 } else if (msg == WOM_CLOSE) { |
307 // We can be closed before calling Start, so it is possible to have a | 304 // We can be closed before calling Start, so it is possible to have a |
308 // null callback at this point. | 305 // null callback at this point. |
309 if (obj->callback_) | 306 if (obj->callback_) |
310 obj->callback_->OnClose(obj); | 307 obj->callback_->OnClose(obj); |
311 } | 308 } |
312 } | 309 } |
OLD | NEW |