Example #1
0
	def _output_vol(self, context, sink_info):
		vol = sink_info.volume

		self.ret_vol += self.vol_delta
		_lib.pa_cvolume_set(vol, vol.channels, _lib.pa_sw_volume_from_linear(self.ret_vol))

		op = _lib.pa_context_set_sink_volume_by_index(context, sink_info.index, vol, self._finished_ref_callback, None)
		_lib.pa_operation_unref(op)
Example #2
0
	def _context_state_callback(self, context, userdata):
		state = _lib.pa_context_get_state(context)
		# print 'Context state change: %i' % (state)
		if state == _lib.PA_CONTEXT_READY:
			if self.app_name:
				op = _lib.pa_context_get_sink_input_info_list(context, self._sink_input_info_callback, None)
			else:
				op = _lib.pa_context_get_sink_info_list(context, self._sink_info_callback, None)
			_lib.pa_operation_unref(op)
Example #3
0
    def _output_vol(self, context, sink_info):
        vol = sink_info.volume

        self.ret_vol += self.vol_delta
        _lib.pa_cvolume_set(vol, vol.channels,
                            _lib.pa_sw_volume_from_linear(self.ret_vol))

        op = _lib.pa_context_set_sink_volume_by_index(
            context, sink_info.index, vol, self._finished_ref_callback, None)
        _lib.pa_operation_unref(op)
Example #4
0
 def _context_state_callback(self, context, userdata):
     state = _lib.pa_context_get_state(context)
     # print 'Context state change: %i' % (state)
     if state == _lib.PA_CONTEXT_READY:
         if self.app_name:
             op = _lib.pa_context_get_sink_input_info_list(
                 context, self._sink_input_info_callback, None)
         else:
             op = _lib.pa_context_get_sink_info_list(
                 context, self._sink_info_callback, None)
         _lib.pa_operation_unref(op)
Example #5
0
    def context_notify_cb(self, context, _):
        state = pa.pa_context_get_state(context)

        if state == pa.PA_CONTEXT_READY:
            logger.debug("Pulseaudio connection ready")
            # Connected to Pulseaudio. Now request that source_info_cb
            # be called with information about the available sources.
            o = pa.pa_context_get_source_info_list(context, self._source_info_cb, None)
            pa.pa_operation_unref(o)

        elif state == pa.PA_CONTEXT_FAILED:
            logger.error("Pulseaudio connection failed")

        elif state == pa.PA_CONTEXT_TERMINATED:
            logger.info("Pulseaudio connection terminated")
Example #6
0
    def context_notify_cb(self, context, _):
        state = P.pa_context_get_state(context)

        if state == P.PA_CONTEXT_READY:
            log.info("Pulseaudio connection ready...")
            # Connected to Pulseaudio. Now request that source_info_cb
            # be called with information about the available sources.
            o = P.pa_context_get_source_info_list(context, self._source_info_cb, None)
            P.pa_operation_unref(o)

        elif state == P.PA_CONTEXT_FAILED :
            log.error("Connection failed")
            os.abort()

        elif state == P.PA_CONTEXT_TERMINATED:
            log.error("Connection terminated")
            os.abort()

        else:
            log.info('context_notify_cb state=%r', state)
    def context_notify_cb(self, context, _):
        state = P.pa_context_get_state(context)

        if state == P.PA_CONTEXT_READY:
            log.info("Pulseaudio connection ready...")
            # Connected to Pulseaudio. Now request that source_info_cb
            # be called with information about the available sources.
            o = P.pa_context_get_source_info_list(context, self._source_info_cb, None)
            P.pa_operation_unref(o)

        elif state == P.PA_CONTEXT_FAILED :
            log.error("Connection failed")
            os.abort()

        elif state == P.PA_CONTEXT_TERMINATED:
            log.error("Connection terminated")
            os.abort()

        else:
            log.info('context_notify_cb state=%r', state)
Example #8
0
	def _output_mute(self, context, sink_info, mute):
		self.ret_mute = mute
		op = _lib.pa_context_set_sink_mute_by_index(context, sink_info.index, mute, self._finished_ref_callback, None)
		_lib.pa_operation_unref(op)
Example #9
0
 def _output_mute(self, context, sink_info, mute):
     self.ret_mute = mute
     op = _lib.pa_context_set_sink_mute_by_index(
         context, sink_info.index, mute, self._finished_ref_callback, None)
     _lib.pa_operation_unref(op)