pyqt4, функция Mute/Unmute микрофона, а также динамиков [PJSIP]

Здравствуйте друзья и коллеги

Я пытаюсь сделать функцию отключения/включения звука микрофона, а также динамиков для моего программного софтфона на pyt4 и с использованием библиотеки PJSIP

Я нашел это в коде pjsip

пишип:

    def conf_set_tx_level(self, slot, level):
        """Adjust the signal level to be transmitted from the bridge to 
        the specified port by making it louder or quieter.

        Keyword arguments:
        slot        -- integer to identify the conference slot number.
        level       -- Signal level adjustment. Value 1.0 means no level
                       adjustment, while value 0 means to mute the port.
        """
        lck = self.auto_lock()
        err = _pjsua.conf_set_tx_level(slot, level)
        self._err_check("conf_set_tx_level()", self, err)

    def conf_set_rx_level(self, slot, level):
        """Adjust the signal level to be received from the specified port
        (to the bridge) by making it louder or quieter.

        Keyword arguments:
        slot        -- integer to identify the conference slot number.
        level       -- Signal level adjustment. Value 1.0 means no level
                       adjustment, while value 0 means to mute the port.
        """
        lck = self.auto_lock()
        err = _pjsua.conf_set_rx_level(slot, level)
        self._err_check("conf_set_rx_level()", self, err)

ну я так понимаю нужно передать параметр 0, но как это сделать?
И вернуть обратно работу звукового устройства и микрофона.
Может это """""pjsua_conf_adjust_tx_level(slot_number, 0 )" """"


person Andrew Zhuk    schedule 09.09.2012    source источник


Ответы (1)


сам себе ответ :-)

в моем случае было так

        # call window

        ################ 
        self.MuteMic = False
        self.MuteSpeaker = False
        ################


        #btn signals
        self.connect(self.MuteUnmuteMicButton, QtCore.SIGNAL("clicked()"), self.MuteUnmuteMic)
        self.connect(self.MuteUnmuteSpeakerButton, QtCore.SIGNAL("clicked()"), self.MuteUnmuteSpeaker)




    def MuteUnmuteMic(self):
        try:
            if self.MuteMic:
                self.MuteMic = False
                self.parent().unmute_mic()
            else:
                self.MuteMic = True
                self.parent().mute_mic()

        except:
                debug ("ошибка при вызове функции включение или отключение микрофона (call Window).")

    def MuteUnmuteSpeaker(self):
        try:
            if self.MuteSpeaker:
                self.MuteSpeaker = False
                self.parent().unmute_speaker()
            else:
                self.MuteSpeaker = True
                self.parent().mute_speaker()

        except:
                debug ("ошибка при вызове функции включение или отключение микрофона (call Window).")

# other code


----------


# ----------------------core of the my app 
# ---import PJUA lib----

        def mute_mic(self):
            #this that you need in my case my app connected to pjua "self.lib"
            self.lib.conf_set_rx_level(0,0)

            debug ("вызвана функция выключение микрофона")
        def unmute_mic(self):
            self.lib.conf_set_rx_level(0,1)

        debug ("вызвана функция включение микрофона")
        def mute_speaker(self):         
            self.lib.conf_set_tx_level(0,0)

            debug ("вызвана функция выключение динамиков")
        def unmute_speaker(self):
            self.lib.conf_set_tx_level(0,1)

        debug ("вызвана функция включение динамиков")

person Andrew Zhuk    schedule 14.09.2012