Пример #1
0
 def cmd_decrease_volume(self, value=2):
     volume_level = int(value * self.default_sink['base_volume'] / 100)
     if not volume_level and max(self.default_sink['values']) == 0:
         # can't be lower than zero
         return
     volume = ffi.new('pa_cvolume *', {
         'channels': self.default_sink['channels'],
         'values': self.default_sink['values'],
     })
     lib.pa_cvolume_dec(volume, volume_level)
     self.change_volume(volume)
Пример #2
0
 def cmd_decrease_vol(self, value=None):
     if value is None:
         value = self.step
     volume_level = int(value * self.default_sink["base_volume"] / 100)
     if not volume_level and max(self.default_sink["values"]) == 0:
         # can't be lower than zero
         return
     volume = ffi.new(
         "pa_cvolume *",
         {
             "channels": self.default_sink["channels"],
             "values": self.default_sink["values"],
         },
     )
     lib.pa_cvolume_dec(volume, volume_level)
     self.change_volume(volume)