コード例 #1
0
ファイル: __init__.py プロジェクト: uditDasari/susi_installer
 def softvolume(self, val, pl):
     if (val is None):
         absvol = mixer.volume(None)
         sf = pl.audio_get_volume()
         # sometimes the softvolume is bigger than 100 while hw volume is 100, catch that
         return min( 100, int(sf * 100 / absvol) )
     elif ((isinstance(val, int) or val.isdigit()) and (int(val) <= 100) and (int(val) >= 0)):
         p = int(val)
         absvol = mixer.volume(None)
         softvol = min(absvol, round(absvol * p / 100))
         pl.audio_set_volume(softvol)
         return(softvol)
     else:
         raise Exception('Invalid argument to softvolume: ' + str(val))
コード例 #2
0
 def restore_hardvolume(self):
     if (self.saved_hardvolume >= 0):
         mixer.volume(self.saved_hardvolume)
     return self.saved_hardvolume
コード例 #3
0
 def save_hardvolume(self):
     self.saved_hardvolume = mixer.volume(None)
     return self.saved_hardvolume
コード例 #4
0
 def volume(self, val):
     return mixer.volume(val)