Created
August 16, 2016 14:29
-
-
Save ivanovs-4/9a4c91cfd2c91426ed6b8d7ab639a43c to your computer and use it in GitHub Desktop.
FastTrack setup alsamixer routing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sudo apt-get install python-alsaaudio | |
import alsaaudio as a | |
def eq(q, p): | |
return q == p | |
def one2one(text): | |
return eq(*[int(v.strip()[-1]) for v in text.split('-')]) | |
card = 2 | |
mm = [ | |
(name, a.Mixer(name, cardindex=card)) | |
for name in a.mixers(card) | |
if 'Playback Volume' in a.Mixer(name, cardindex=card).volumecap() | |
] | |
for n, m in mm: | |
m.setvolume(100 if one2one(n) else 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment