summaryrefslogtreecommitdiffstats
path: root/chromeos/audio
diff options
context:
space:
mode:
authorrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-10 01:27:20 +0000
committerrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-10 01:27:20 +0000
commit688603a37e7d3ebbdf4c299600b754b960bb99ab (patch)
tree1d3406b1360471bf0fe64e365243af3ea47b02d5 /chromeos/audio
parent7e6e146900c0d0fb60ebffcf480527c312cdce60 (diff)
downloadchromium_src-688603a37e7d3ebbdf4c299600b754b960bb99ab.zip
chromium_src-688603a37e7d3ebbdf4c299600b754b960bb99ab.tar.gz
chromium_src-688603a37e7d3ebbdf4c299600b754b960bb99ab.tar.bz2
Set mute correctly from the audio API.
Currently audio.setProperties is ignoring the mute value passed in by the user. This CL fixes it. Reviews requested, hshi@ - general mpcomplete - OWNERS for audio_service_chromeos.cc R=hshi@chromium.org BUG=239562 Review URL: https://chromiumcodereview.appspot.com/14773020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199325 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/audio')
-rw-r--r--chromeos/audio/cras_audio_handler.cc11
-rw-r--r--chromeos/audio/cras_audio_handler.h5
2 files changed, 15 insertions, 1 deletions
diff --git a/chromeos/audio/cras_audio_handler.cc b/chromeos/audio/cras_audio_handler.cc
index 1117832..7dc5132 100644
--- a/chromeos/audio/cras_audio_handler.cc
+++ b/chromeos/audio/cras_audio_handler.cc
@@ -237,6 +237,17 @@ void CrasAudioHandler::SetVolumeGainPercentForDevice(uint64 device_id,
audio_pref_handler_->SetVolumeGainValue(device_id, value);
}
+void CrasAudioHandler::SetMuteForDevice(uint64 device_id, bool mute_on) {
+ if (device_id == active_output_node_id_) {
+ SetOutputMute(mute_on);
+ return;
+ } else if (device_id == active_input_node_id_) {
+ SetInputMute(mute_on);
+ return;
+ }
+ audio_pref_handler_->SetMuteValue(device_id, mute_on);
+}
+
CrasAudioHandler::CrasAudioHandler(
scoped_refptr<AudioDevicesPrefHandler> audio_pref_handler)
: audio_pref_handler_(audio_pref_handler),
diff --git a/chromeos/audio/cras_audio_handler.h b/chromeos/audio/cras_audio_handler.h
index da45268..2d2a8af 100644
--- a/chromeos/audio/cras_audio_handler.h
+++ b/chromeos/audio/cras_audio_handler.h
@@ -145,9 +145,12 @@ class CHROMEOS_EXPORT CrasAudioHandler : public CrasAudioClient::Observer,
// Sets the active audio input node to the node with |node_id|.
virtual void SetActiveInputNode(uint64 node_id);
- // Sets volume/gain level from a device.
+ // Sets volume/gain level for a device.
virtual void SetVolumeGainPercentForDevice(uint64 device_id, int value);
+ // Sets the mute for device.
+ virtual void SetMuteForDevice(uint64 device_id, bool mute_on);
+
protected:
explicit CrasAudioHandler(
scoped_refptr<AudioDevicesPrefHandler> audio_pref_handler);