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

Unified Diff: chrome/browser/chromeos/audio_handler.h

Issue 5859003: Add ALSA support to volume keys (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/chromeos
Patch Set: fix comment Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/audio_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/audio_handler.h
diff --git a/chrome/browser/chromeos/audio_handler.h b/chrome/browser/chromeos/audio_handler.h
index 59e9d70eec711c59ee6b8e1609138680ae0eded9..b835f5a07ac0b907ef791233e7f9ee9d65872d5c 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/threading/thread.h"
template <typename T> struct DefaultSingletonTraits;
namespace chromeos {
-class PulseAudioMixer;
+class AudioMixer;
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);
@@ -43,10 +44,20 @@ class AudioHandler {
void SetMute(bool do_mute);
private:
+ enum MixerType {
+ MIXER_TYPE_PULSEAUDIO = 0,
+ MIXER_TYPE_ALSA,
+ MIXER_TYPE_NONE,
+ };
+
// Defines the delete on exit Singleton traits we like. Best to have this
// and constructor/destructor private as recommended for Singletons.
friend struct DefaultSingletonTraits<AudioHandler>;
+ // Connect to the current mixer_type_.
+ bool TryToConnect(bool async);
+ void UseNextMixer();
+
void OnMixerInitialized(bool success);
AudioHandler();
@@ -54,17 +65,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<AudioMixer> 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, ALSA or none.
+ MixerType mixer_type_;
+
DISALLOW_COPY_AND_ASSIGN(AudioHandler);
};
} // namespace chromeos
+DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::AudioHandler);
+
#endif // CHROME_BROWSER_CHROMEOS_AUDIO_HANDLER_H_
« no previous file with comments | « no previous file | chrome/browser/chromeos/audio_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698