| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/chromeos/audio_mixer_alsa.h" | 5 #include "chrome/browser/chromeos/audio_mixer_alsa.h" |
| 6 | 6 |
| 7 #include <alsa/asoundlib.h> | 7 #include <alsa/asoundlib.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 base::AutoLock lock(mixer_state_lock_); | 161 base::AutoLock lock(mixer_state_lock_); |
| 162 // If we think it's ready, verify it is actually so. | 162 // If we think it's ready, verify it is actually so. |
| 163 if ((mixer_state_ == READY) && (alsa_mixer_ == NULL)) | 163 if ((mixer_state_ == READY) && (alsa_mixer_ == NULL)) |
| 164 mixer_state_ = IN_ERROR; | 164 mixer_state_ = IN_ERROR; |
| 165 return mixer_state_; | 165 return mixer_state_; |
| 166 } | 166 } |
| 167 | 167 |
| 168 // static | 168 // static |
| 169 void AudioMixerAlsa::RegisterPrefs(PrefService* local_state) { | 169 void AudioMixerAlsa::RegisterPrefs(PrefService* local_state) { |
| 170 if (!local_state->FindPreference(prefs::kAudioVolume)) | 170 if (!local_state->FindPreference(prefs::kAudioVolume)) |
| 171 local_state->RegisterRealPref(prefs::kAudioVolume, kPrefVolumeInvalid); | 171 local_state->RegisterDoublePref(prefs::kAudioVolume, kPrefVolumeInvalid); |
| 172 if (!local_state->FindPreference(prefs::kAudioMute)) | 172 if (!local_state->FindPreference(prefs::kAudioMute)) |
| 173 local_state->RegisterIntegerPref(prefs::kAudioMute, kPrefMuteInvalid); | 173 local_state->RegisterIntegerPref(prefs::kAudioMute, kPrefMuteInvalid); |
| 174 } | 174 } |
| 175 | 175 |
| 176 //////////////////////////////////////////////////////////////////////////////// | 176 //////////////////////////////////////////////////////////////////////////////// |
| 177 // Private functions follow | 177 // Private functions follow |
| 178 | 178 |
| 179 void AudioMixerAlsa::DoInit(InitDoneCallback* callback) { | 179 void AudioMixerAlsa::DoInit(InitDoneCallback* callback) { |
| 180 bool success = InitializeAlsaMixer(); | 180 bool success = InitializeAlsaMixer(); |
| 181 | 181 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 | 441 |
| 442 void AudioMixerAlsa::SetElementMuted_Locked(snd_mixer_elem_t* elem, bool mute) { | 442 void AudioMixerAlsa::SetElementMuted_Locked(snd_mixer_elem_t* elem, bool mute) { |
| 443 int enabled = mute ? 0 : 1; | 443 int enabled = mute ? 0 : 1; |
| 444 snd_mixer_selem_set_playback_switch_all(elem, enabled); | 444 snd_mixer_selem_set_playback_switch_all(elem, enabled); |
| 445 | 445 |
| 446 VLOG(1) << "Set playback switch " << snd_mixer_selem_get_name(elem) | 446 VLOG(1) << "Set playback switch " << snd_mixer_selem_get_name(elem) |
| 447 << " to " << enabled; | 447 << " to " << enabled; |
| 448 } | 448 } |
| 449 | 449 |
| 450 } // namespace chromeos | 450 } // namespace chromeos |
| OLD | NEW |