Пример #1
0
    async def volume_get_all_chans(self, obj):
        # Purpose of this func can be a bit confusing, being here next to set/change ones
        '''Get "flat" volume float value for info-object as a mean of all channel values.
			Note that this DOES NOT query any kind of updated values from libpulse,
				and simply returns value(s) stored in passed object, i.e. same ones for same object.'''
        assert_pulse_object(obj)
        return obj.volume.value_flat
Пример #2
0
 async def port_set(self, obj, port):
     assert_pulse_object(obj)
     method = {
         PulseSinkInfo: self.sink_port_set,
         PulseSourceInfo: self.source_port_set
     }.get(type(obj))
     if not method: raise NotImplementedError(type(obj))
     await method(obj.index, port)
     obj.port_active = port
Пример #3
0
 async def default_set(self, obj):
     'Set passed sink or source to be used as default one by pulseaudio server.'
     assert_pulse_object(obj)
     method = {
         PulseSinkInfo: self.sink_default_set,
         PulseSourceInfo: self.source_default_set
     }.get(type(obj))
     if not method: raise NotImplementedError(type(obj))
     await method(obj)
Пример #4
0
 async def volume_set(self, obj, vol):
     assert_pulse_object(obj)
     method = {
         PulseSinkInfo: self.sink_volume_set,
         PulseSinkInputInfo: self.sink_input_volume_set,
         PulseSourceInfo: self.source_volume_set,
         PulseSourceOutputInfo: self.source_output_volume_set
     }.get(type(obj))
     if not method: raise NotImplementedError(type(obj))
     await method(obj.index, vol)
     obj.volume = vol
Пример #5
0
 async def card_profile_set(self, card, profile):
     assert_pulse_object(card)
     if is_str(profile):
         profile_dict = dict((p.name, p) for p in card.profile_list)
         if profile not in profile_dict:
             raise PulseIndexError(
                 'Card does not have'
                 ' profile with specified name: {!r}'.format(profile))
         profile = profile_dict[profile]
     await self.card_profile_set_by_index(card.index, profile.name)
     card.profile_active = profile
Пример #6
0
 async def mute(self, obj, mute=True):
     assert_pulse_object(obj)
     method = {
         PulseSinkInfo: self.sink_mute,
         PulseSinkInputInfo: self.sink_input_mute,
         PulseSourceInfo: self.source_mute,
         PulseSourceOutputInfo: self.source_output_mute
     }.get(type(obj))
     if not method: raise NotImplementedError(type(obj))
     await method(obj.index, mute)
     obj.mute = mute
Пример #7
0
 async def volume_change_all_chans(self, obj, inc):
     assert_pulse_object(obj)
     obj.volume.values = [max(0, v + inc) for v in obj.volume.values]
     await self.volume_set(obj, obj.volume)
Пример #8
0
 async def volume_set_all_chans(self, obj, vol):
     assert_pulse_object(obj)
     obj.volume.value_flat = vol
     await self.volume_set(obj, obj.volume)