Chromium Code Reviews| Index: chrome/browser/chromeos/audio_handler.h |
| diff --git a/chrome/browser/chromeos/audio_handler.h b/chrome/browser/chromeos/audio_handler.h |
| index ca1a83b2c27e8e26f8369af37e203bb2affeaaf1..9290bc628fc1b73cea82af130877cbff8da967ca 100644 |
| --- a/chrome/browser/chromeos/audio_handler.h |
| +++ b/chrome/browser/chromeos/audio_handler.h |
| @@ -8,12 +8,13 @@ |
| #include "base/basictypes.h" |
| #include "base/scoped_ptr.h" |
| +#include "base/thread.h" |
| template <typename T> struct DefaultSingletonTraits; |
| namespace chromeos { |
| -class PulseAudioMixer; |
| +class AudioMixerBase; |
| class AudioHandler { |
| public: |
| @@ -30,7 +31,7 @@ class AudioHandler { |
| // as the percentage gets lower, and then switches to silence at 0%. |
| void SetVolumePercent(double volume_percent); |
| - // Adust volume up (positive percentage) or down (negative percentage), |
| + // Adjust volume up (positive percentage) or down (negative percentage), |
| // capping at 100%. GetVolumePercent() will be accurate after this |
| // blocking call. |
| void AdjustVolumeByPercent(double adjust_by_percent); |
| @@ -47,6 +48,9 @@ class AudioHandler { |
| // and constructor/destructor private as recommended for Singletons. |
| friend struct DefaultSingletonTraits<AudioHandler>; |
| + // Connect to the current using_mixer_. |
| + bool TryToConnect(bool async); |
| + |
| void OnMixerInitialized(bool success); |
| AudioHandler(); |
| @@ -54,17 +58,28 @@ class AudioHandler { |
| bool VerifyMixerConnection(); |
| // Conversion between our internal scaling (0-100%) and decibels. |
| - static double VolumeDbToPercent(double volume_db); |
| - static double PercentToVolumeDb(double volume_percent); |
| + double VolumeDbToPercent(double volume_db) const; |
| + double PercentToVolumeDb(double volume_percent) const; |
| + |
| + scoped_ptr<AudioMixerBase> mixer_; |
| - scoped_ptr<PulseAudioMixer> mixer_; |
| bool connected_; |
| int reconnect_tries_; |
| + // The min and max volume in decibels, limited to the maximum range of the |
| + // audio system being used. |
| + double max_volume_db_; |
| + double min_volume_db_; |
| + |
| + // Which mixer is being used, PulseAudio or ALSA |
| + int using_mixer_; |
|
Daniel Erat
2010/12/20 22:01:12
use an enum instead, e.g. MixerType with MIXER_TYP
davejcool
2010/12/21 02:00:21
Funny, I went back and forth on that one... but it
|
| + |
| DISALLOW_COPY_AND_ASSIGN(AudioHandler); |
| }; |
| } // namespace chromeos |
| +DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::AudioHandler); |
| + |
| #endif // CHROME_BROWSER_CHROMEOS_AUDIO_HANDLER_H_ |