aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/alsa.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/alsa.py')
-rw-r--r--src/plugins/alsa.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/plugins/alsa.py b/src/plugins/alsa.py
index b955130..e9f144f 100644
--- a/src/plugins/alsa.py
+++ b/src/plugins/alsa.py
@@ -67,7 +67,7 @@ class ALSA:
def set_volume(self, volume, channel = -1):
'''
- set the volume for a channel on the mixer
+ Set the volume for a channel on the mixer
@param volume:int? The [0, 100] volume for the channel, `None` to mute the channel
@param channel:int The index of the channel, `ALSA.ALL_CHANNELS` (-1) for all channels
@@ -82,6 +82,29 @@ class ALSA:
pass # some mixers do not have mute switch
+ def get_mute(self):
+ '''
+ Get the mute status for each channel on the mixer
+
+ @return :list<bool> Whether mixer is muted for each channel
+ '''
+ self.mixer = alsaaudio.Mixer(self.mixername, 0, self.cardindex)
+ try:
+ return [m == 1 for m in self.mixer.getmute()]
+ except:
+ return [False] * len(self.mixer.getvolume())
+
+
+ def set_mute(self, mute, channel = -1):
+ '''
+ Set the mute status on the mixer
+
+ @param mute:bool Whether the mixer should be muted on the channel
+ @param channel:int The index of the channel, `ALSA.ALL_CHANNELS` (-1) for all channels
+ '''
+ self.mixer.setmute(mute, channel)
+
+
@staticmethod
def get_cards():
'''