diff options
author | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 22:25:18 +0000 |
---|---|---|
committer | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 22:25:18 +0000 |
commit | 3ee84160f356ad78f48639b4e26eebee9a88b9c1 (patch) | |
tree | 41cdcce0762674b9eb5893d0585673d91bea53e2 /media/audio/mac | |
parent | 3da33567fb3c69351d74ccb11d884e4ea9f9a21e (diff) | |
download | chromium_src-3ee84160f356ad78f48639b4e26eebee9a88b9c1.zip chromium_src-3ee84160f356ad78f48639b4e26eebee9a88b9c1.tar.gz chromium_src-3ee84160f356ad78f48639b4e26eebee9a88b9c1.tar.bz2 |
SetVolume and GetVolume take one volume instead of separate left and right volumes.
BUG=26660
TEST=no visible difference. Make sure volume still works. Code size should go down marginally.
Review URL: http://codereview.chromium.org/357004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31018 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/mac')
-rw-r--r-- | media/audio/mac/audio_output_mac.cc | 13 | ||||
-rw-r--r-- | media/audio/mac/audio_output_mac.h | 4 | ||||
-rw-r--r-- | media/audio/mac/audio_output_mac_unittest.cc | 14 |
3 files changed, 12 insertions, 19 deletions
diff --git a/media/audio/mac/audio_output_mac.cc b/media/audio/mac/audio_output_mac.cc index 42e80a1..24dc86b 100644 --- a/media/audio/mac/audio_output_mac.cc +++ b/media/audio/mac/audio_output_mac.cc @@ -146,25 +146,22 @@ void PCMQueueOutAudioOutputStream::Stop() { HandleError(err); } -void PCMQueueOutAudioOutputStream::SetVolume(double left_level, - double ) { +void PCMQueueOutAudioOutputStream::SetVolume(double volume) { if (!audio_queue_) return; - volume_ = static_cast<float>(left_level); + volume_ = static_cast<float>(volume); OSStatus err = AudioQueueSetParameter(audio_queue_, kAudioQueueParam_Volume, - left_level); + volume); if (err != noErr) { HandleError(err); } } -void PCMQueueOutAudioOutputStream::GetVolume(double* left_level, - double* right_level) { +void PCMQueueOutAudioOutputStream::GetVolume(double* volume) { if (!audio_queue_) return; - *left_level = volume_; - *right_level = volume_; + *volume = volume_; } // Reorder PCM from AAC layout to Core Audio layout. diff --git a/media/audio/mac/audio_output_mac.h b/media/audio/mac/audio_output_mac.h index 14afff7..10fc229 100644 --- a/media/audio/mac/audio_output_mac.h +++ b/media/audio/mac/audio_output_mac.h @@ -33,8 +33,8 @@ class PCMQueueOutAudioOutputStream : public AudioOutputStream { virtual void Close(); virtual void Start(AudioSourceCallback* callback); virtual void Stop(); - virtual void SetVolume(double left_level, double right_level); - virtual void GetVolume(double* left_level, double* right_level); + virtual void SetVolume(double volume); + virtual void GetVolume(double* volume); private: // The audio is double buffered. diff --git a/media/audio/mac/audio_output_mac_unittest.cc b/media/audio/mac/audio_output_mac_unittest.cc index a517e95..985ca45 100644 --- a/media/audio/mac/audio_output_mac_unittest.cc +++ b/media/audio/mac/audio_output_mac_unittest.cc @@ -92,19 +92,15 @@ TEST(MacAudioTest, PCMWaveStreamPlay200HzTone44KssMono) { EXPECT_TRUE(oas->Open(bytes_100_ms)); - oas->SetVolume(0.5, 0.5); + oas->SetVolume(0.5); oas->Start(&source); usleep(1500000); // Test that the volume is within the set limits. - double left_volume = 0.0; - double right_volume = 0.0; - oas->GetVolume(&left_volume, &right_volume); - EXPECT_LT(left_volume, 0.51); - EXPECT_GT(left_volume, 0.49); - EXPECT_LT(right_volume, 0.51); - EXPECT_GT(right_volume, 0.49); - + double volume = 0.0; + oas->GetVolume(&volume); + EXPECT_LT(volume, 0.51); + EXPECT_GT(volume, 0.49); oas->Stop(); oas->Close(); } |