| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_CHROMEOS_AUDIO_MIXER_ALSA_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_AUDIO_MIXER_ALSA_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_AUDIO_MIXER_ALSA_H_ | 6 #define CHROME_BROWSER_CHROMEOS_AUDIO_MIXER_ALSA_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback_old.h" | 12 #include "base/callback_old.h" |
| 13 #include "base/compiler_specific.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 15 #include "base/synchronization/waitable_event.h" | 16 #include "base/synchronization/waitable_event.h" |
| 16 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 17 #include "chrome/browser/chromeos/audio_mixer.h" | 18 #include "chrome/browser/chromeos/audio_mixer.h" |
| 18 | 19 |
| 19 class PrefService; | 20 class PrefService; |
| 20 | 21 |
| 21 struct _snd_mixer_elem; | 22 struct _snd_mixer_elem; |
| 22 struct _snd_mixer; | 23 struct _snd_mixer; |
| 23 | 24 |
| 24 namespace chromeos { | 25 namespace chromeos { |
| 25 | 26 |
| 26 // Simple wrapper around ALSA's mixer functions. | 27 // Simple wrapper around ALSA's mixer functions. |
| 27 // Interaction with ALSA takes place on a background thread. | 28 // Interaction with ALSA takes place on a background thread. |
| 28 class AudioMixerAlsa : public AudioMixer { | 29 class AudioMixerAlsa : public AudioMixer { |
| 29 public: | 30 public: |
| 30 AudioMixerAlsa(); | 31 AudioMixerAlsa(); |
| 31 virtual ~AudioMixerAlsa(); | 32 virtual ~AudioMixerAlsa(); |
| 32 | 33 |
| 33 // AudioMixer implementation. | 34 // AudioMixer implementation. |
| 34 virtual void Init(); | 35 virtual void Init() OVERRIDE; |
| 35 virtual bool IsInitialized(); | 36 virtual bool IsInitialized() OVERRIDE; |
| 36 virtual void GetVolumeLimits(double* min_volume_db, double* max_volume_db); | 37 virtual void GetVolumeLimits(double* min_volume_db, |
| 37 virtual double GetVolumeDb(); | 38 double* max_volume_db) OVERRIDE; |
| 38 virtual void SetVolumeDb(double volume_db); | 39 virtual double GetVolumeDb() OVERRIDE; |
| 39 virtual bool IsMuted(); | 40 virtual void SetVolumeDb(double volume_db) OVERRIDE; |
| 40 virtual void SetMuted(bool muted); | 41 virtual bool IsMuted() OVERRIDE; |
| 42 virtual void SetMuted(bool muted) OVERRIDE; |
| 41 | 43 |
| 42 // Registers volume and mute preferences. | 44 // Registers volume and mute preferences. |
| 43 // TODO(derat): Move prefs into AudioHandler. | 45 // TODO(derat): Move prefs into AudioHandler. |
| 44 static void RegisterPrefs(PrefService* local_state); | 46 static void RegisterPrefs(PrefService* local_state); |
| 45 | 47 |
| 46 private: | 48 private: |
| 47 // Tries to connect to ALSA. On failure, posts a delayed Connect() task to | 49 // Tries to connect to ALSA. On failure, posts a delayed Connect() task to |
| 48 // try again. | 50 // try again. |
| 49 void Connect(); | 51 void Connect(); |
| 50 | 52 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 int num_connection_attempts_; | 123 int num_connection_attempts_; |
| 122 | 124 |
| 123 DISALLOW_COPY_AND_ASSIGN(AudioMixerAlsa); | 125 DISALLOW_COPY_AND_ASSIGN(AudioMixerAlsa); |
| 124 }; | 126 }; |
| 125 | 127 |
| 126 } // namespace chromeos | 128 } // namespace chromeos |
| 127 | 129 |
| 128 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::AudioMixerAlsa); | 130 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::AudioMixerAlsa); |
| 129 | 131 |
| 130 #endif // CHROME_BROWSER_CHROMEOS_AUDIO_MIXER_ALSA_H_ | 132 #endif // CHROME_BROWSER_CHROMEOS_AUDIO_MIXER_ALSA_H_ |
| OLD | NEW |