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

Side by Side Diff: chrome/browser/chromeos/audio/audio_mixer_alsa.h

Issue 11358083: Decouple c/b/cros/audio from c/b/speech. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_AUDIO_MIXER_ALSA_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_AUDIO_AUDIO_MIXER_ALSA_H_
6 #define CHROME_BROWSER_CHROMEOS_AUDIO_AUDIO_MIXER_ALSA_H_ 6 #define CHROME_BROWSER_CHROMEOS_AUDIO_AUDIO_MIXER_ALSA_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 10 matching lines...) Expand all
21 namespace chromeos { 21 namespace chromeos {
22 22
23 // Simple wrapper around ALSA's mixer functions. 23 // Simple wrapper around ALSA's mixer functions.
24 // Interaction with ALSA takes place on a background thread. 24 // Interaction with ALSA takes place on a background thread.
25 class AudioMixerAlsa : public AudioMixer { 25 class AudioMixerAlsa : public AudioMixer {
26 public: 26 public:
27 AudioMixerAlsa(); 27 AudioMixerAlsa();
28 virtual ~AudioMixerAlsa(); 28 virtual ~AudioMixerAlsa();
29 29
30 // AudioMixer implementation. 30 // AudioMixer implementation.
31 virtual void Init() OVERRIDE; 31 virtual void Init(const base::Closure& on_connected) OVERRIDE;
32 virtual double GetVolumePercent() OVERRIDE; 32 virtual double GetVolumePercent() OVERRIDE;
33 virtual void SetVolumePercent(double percent) OVERRIDE; 33 virtual void SetVolumePercent(double percent) OVERRIDE;
34 virtual bool IsMuted() OVERRIDE; 34 virtual bool IsMuted() OVERRIDE;
35 virtual void SetMuted(bool mute) OVERRIDE; 35 virtual void SetMuted(bool mute) OVERRIDE;
36 virtual bool IsMuteLocked() OVERRIDE; 36 virtual bool IsMuteLocked() OVERRIDE;
37 virtual void SetMuteLocked(bool locked) OVERRIDE; 37 virtual void SetMuteLocked(bool locked) OVERRIDE;
38 virtual bool IsCaptureMuted() OVERRIDE; 38 virtual bool IsCaptureMuted() OVERRIDE;
39 virtual void SetCaptureMuted(bool mute) OVERRIDE; 39 virtual void SetCaptureMuted(bool mute) OVERRIDE;
40 virtual bool IsCaptureMuteLocked() OVERRIDE; 40 virtual bool IsCaptureMuteLocked() OVERRIDE;
41 virtual void SetCaptureMuteLocked(bool locked) OVERRIDE; 41 virtual void SetCaptureMuteLocked(bool locked) OVERRIDE;
42 42
43 private: 43 private:
44 // Tries to connect to ALSA. On failure, posts a delayed Connect() task to 44 // Tries to connect to ALSA. On failure, posts a delayed Connect() task to
45 // try again. 45 // try again.
46 void Connect(); 46 void Connect(const base::Closure& on_connected);
47 47
48 // Helper method called by Connect(). On success, initializes 48 // Helper method called by Connect(). On success, initializes
49 // |min_volume_db_|, |max_volume_db_|, |alsa_mixer_|, and |element_*| and 49 // |min_volume_db_|, |max_volume_db_|, |alsa_mixer_|, and |element_*| and
50 // returns true. 50 // returns true.
51 bool ConnectInternal(); 51 bool ConnectInternal(const base::Closure& on_connected);
52 52
53 // Disconnects from ALSA if currently connected and signals 53 // Disconnects from ALSA if currently connected and signals
54 // |disconnected_event_|. 54 // |disconnected_event_|.
55 void Disconnect(); 55 void Disconnect();
56 56
57 // Updates |alsa_mixer_| for current values of |volume_db_| and |is_muted_|. 57 // Updates |alsa_mixer_| for current values of |volume_db_| and |is_muted_|.
58 // No-op if not connected. 58 // No-op if not connected.
59 void ApplyState(); 59 void ApplyState();
60 60
61 // Finds the element named |element_name|. Returns NULL on failure. 61 // Finds the element named |element_name|. Returns NULL on failure.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // Number of times that we've attempted to connect to ALSA. Just used to keep 142 // Number of times that we've attempted to connect to ALSA. Just used to keep
143 // us from spamming the logs. 143 // us from spamming the logs.
144 int num_connection_attempts_; 144 int num_connection_attempts_;
145 145
146 DISALLOW_COPY_AND_ASSIGN(AudioMixerAlsa); 146 DISALLOW_COPY_AND_ASSIGN(AudioMixerAlsa);
147 }; 147 };
148 148
149 } // namespace chromeos 149 } // namespace chromeos
150 150
151 #endif // CHROME_BROWSER_CHROMEOS_AUDIO_AUDIO_MIXER_ALSA_H_ 151 #endif // CHROME_BROWSER_CHROMEOS_AUDIO_AUDIO_MIXER_ALSA_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/audio/audio_mixer.h ('k') | chrome/browser/chromeos/audio/audio_mixer_alsa.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698