@@ -24,12 +24,13 @@ def ensure_data_index_valid(data, fallback):
2424 if not isinstance (index , int ) or index < 1 or index > Profile .NUM_PROFILES :
2525 data ['index' ] = fallback
2626
27- def apply_mixer_values (values , platform ):
27+ def apply_mixer_values (values ):
2828 if not os .path .exists ("/usr/bin/mod-amixer" ):
2929 return
30- if os .getenv ("MOD_SOUNDCARD" , None ) is None :
30+ soundcard = os .getenv ("MOD_SOUNDCARD" , None )
31+ if soundcard is None :
3132 return
32- if platform == "duo " :
33+ if soundcard == "MODDUO " :
3334 os .system ("/usr/bin/mod-amixer in 1 dvol %f" % values ['input1volume' ])
3435 os .system ("/usr/bin/mod-amixer in 2 dvol %f" % values ['input2volume' ])
3536 os .system ("/usr/bin/mod-amixer out 1 dvol %f" % values ['output1volume' ])
@@ -38,7 +39,7 @@ def apply_mixer_values(values, platform):
3839 os .system ("/usr/bin/mod-amixer hp byp %s" % Profile .value_to_string ('headphoneBypass' ,
3940 values ['headphoneBypass' ]))
4041 return
41- if platform == "duox " :
42+ if soundcard == "DUOX " :
4243 os .system ("/usr/bin/mod-amixer in 1 xvol %f" % values ['input1volume' ])
4344 os .system ("/usr/bin/mod-amixer in 2 xvol %f" % values ['input2volume' ])
4445 os .system ("/usr/bin/mod-amixer out 1 xvol %f" % values ['output1volume' ])
@@ -48,24 +49,25 @@ def apply_mixer_values(values, platform):
4849 os .system ("/usr/bin/mod-amixer cvexp %s" % Profile .value_to_string ('inputMode' , values ['inputMode' ]))
4950 os .system ("/usr/bin/mod-amixer exppedal %s" % Profile .value_to_string ('expPedalMode' , values ['expPedalMode' ]))
5051 return
51- if platform == "dwarf " :
52+ if soundcard == "DWARF " :
5253 os .system ("/usr/bin/mod-amixer in 1 xvol %f" % values ['input1volume' ])
5354 os .system ("/usr/bin/mod-amixer in 2 xvol %f" % values ['input2volume' ])
5455 os .system ("/usr/bin/mod-amixer out 1 xvol %f" % values ['output1volume' ])
5556 os .system ("/usr/bin/mod-amixer out 2 xvol %f" % values ['output2volume' ])
5657 os .system ("/usr/bin/mod-amixer hp xvol %f" % values ['headphoneVolume' ])
5758 return
58- if platform is None :
59- logging .error ("[profile] apply_mixer_values called without platform " )
59+ if soundcard is None :
60+ logging .error ("[profile] apply_mixer_values called without soundcard " )
6061 else :
61- logging .error ("[profile] apply_mixer_values called with unknown platform %s" , platform )
62+ logging .error ("[profile] apply_mixer_values called with unknown soundcard %s" , soundcard )
6263
63- def fill_in_mixer_values (data , platform ):
64+ def fill_in_mixer_values (data ):
6465 if not os .path .exists ("/usr/bin/mod-amixer" ):
6566 return
66- if os .getenv ("MOD_SOUNDCARD" , None ) is None :
67+ soundcard = os .getenv ("MOD_SOUNDCARD" , None )
68+ if soundcard is None :
6769 return
68- if platform == "duo " :
70+ if soundcard == "MODDUO " :
6971 data ['input1volume' ] = float (getoutput ("/usr/bin/mod-amixer in 1 dvol" ).strip ())
7072 data ['input2volume' ] = float (getoutput ("/usr/bin/mod-amixer in 2 dvol" ).strip ())
7173 data ['output1volume' ] = float (getoutput ("/usr/bin/mod-amixer out 1 dvol" ).strip ())
@@ -74,7 +76,7 @@ def fill_in_mixer_values(data, platform):
7476 data ['headphoneBypass' ] = Profile .string_to_value ('headphoneBypass' ,
7577 getoutput ("/usr/bin/mod-amixer hp byp" ).strip ())
7678 return
77- if platform == "duox " :
79+ if soundcard == "DUOX " :
7880 data ['input1volume' ] = float (getoutput ("/usr/bin/mod-amixer in 1 xvol" ).strip ())
7981 data ['input2volume' ] = float (getoutput ("/usr/bin/mod-amixer in 2 xvol" ).strip ())
8082 data ['output1volume' ] = float (getoutput ("/usr/bin/mod-amixer out 1 xvol" ).strip ())
@@ -85,17 +87,17 @@ def fill_in_mixer_values(data, platform):
8587 data ['expPedalMode' ] = Profile .string_to_value ('expPedalMode' ,
8688 getoutput ("/usr/bin/mod-amixer exppedal" ).strip ())
8789 return
88- if platform == "dwarf " :
90+ if soundcard == "DWARF " :
8991 data ['input1volume' ] = float (getoutput ("/usr/bin/mod-amixer in 1 xvol" ).strip ())
9092 data ['input2volume' ] = float (getoutput ("/usr/bin/mod-amixer in 2 xvol" ).strip ())
9193 data ['output1volume' ] = float (getoutput ("/usr/bin/mod-amixer out 1 xvol" ).strip ())
9294 data ['output1volume' ] = float (getoutput ("/usr/bin/mod-amixer out 2 xvol" ).strip ())
9395 data ['headphoneVolume' ] = float (getoutput ("/usr/bin/mod-amixer hp xvol" ).strip ())
9496 return
95- if platform is None :
96- logging .error ("[profile] fill_in_mixer_values called without platform " )
97+ if soundcard is None :
98+ logging .error ("[profile] fill_in_mixer_values called without soundcard " )
9799 else :
98- logging .error ("[profile] fill_in_mixer_values called with unknown platform %s" , platform )
100+ logging .error ("[profile] fill_in_mixer_values called with unknown soundcard %s" , soundcard )
99101
100102# The user profile models environmental context.
101103# That is all settings that are related to the physical hookup of the device.
@@ -225,10 +227,9 @@ def value_to_string(cls, key, value):
225227 return ""
226228
227229 def __init__ (self , applyFn , hwdescriptor ):
228- self .applyFn = applyFn
229- self .platform = hwdescriptor .get ("platform" , None )
230- self .changed = False
231- self .values = self .DEFAULTS .copy ()
230+ self .applyFn = applyFn
231+ self .changed = False
232+ self .values = self .DEFAULTS .copy ()
232233
233234 if os .path .exists (self .INTERMEDIATE_PROFILE_PATH ):
234235 data = safe_json_load (self .INTERMEDIATE_PROFILE_PATH , dict )
@@ -241,7 +242,7 @@ def __init__(self, applyFn, hwdescriptor):
241242 except IOError :
242243 pass
243244
244- fill_in_mixer_values (self .values , self . platform )
245+ fill_in_mixer_values (self .values )
245246 IOLoop .instance ().add_callback (self .apply_first )
246247
247248 # -----------------------------------------------------------------------------------------------------------------
@@ -411,7 +412,7 @@ def store(self, index):
411412 self .values ['index' ] = index
412413
413414 # request and store mixer values
414- fill_in_mixer_values (self .values , self . platform )
415+ fill_in_mixer_values (self .values )
415416
416417 # save intermediate file first
417418 with TextFileFlusher (self .INTERMEDIATE_PROFILE_PATH ) as fh :
0 commit comments