Ejemplo n.º 1
0
    def set_sink_input_volume(self, idx, audio_channels, value):
        cvolume = p.pa_cvolume()
        cvolume.channels = audio_channels

        raw_value = int(p.PA_VOLUME_NORM * value / 100)

        cvolume_ptr = p.pa_cvolume_set(p.get_pointer(cvolume), audio_channels,
                                       raw_value)

        p.pa_context_set_sink_input_volume(self.ctx, idx, cvolume_ptr,
                                           self.ctx_success_cb, None)
Ejemplo n.º 2
0
    def set_source_output_volume(self, idx, audio_channels, value):
        cvolume = p.pa_cvolume()
        cvolume.channels = audio_channels

        raw_value = int(p.PA_VOLUME_NORM * value / 100)

        cvolume_ptr = p.pa_cvolume_set(p.get_ref(cvolume), audio_channels,
                                       raw_value)

        user_data = p.ctx_success_cb_data()

        user_data.operation = 'set_source_output_volume'.encode('utf-8')

        p.pa_context_set_source_output_volume(self.ctx, idx, cvolume_ptr,
                                              self.ctx_success_cb,
                                              p.get_ref(user_data))