示例#1
0
    def set_status(self, effect):
        """
        Toggle effect processing

        :param Lv2Effect effect: Effect with the status updated
        """
        self.connection.send(ProtocolParser.bypass(effect))
示例#2
0
 def quit(self):
     """
     Quit the connection with mod-host and
     stop the mod-host process
     """
     self.connection.send(ProtocolParser.quit())
     self.close()
示例#3
0
    def disconnect(self, connection):
        """
        Disconnect two effect audio ports

        :param pluginsmanager.model.connection.Connection connection: Connection with the two effect audio ports (output and input)
        """
        self.connection.send(ProtocolParser.disconnect(connection))
示例#4
0
    def set_param_value(self, param):
        """
        Set a value to given control

        :param Lv2Param param: Param that the value will be updated
        """
        self.connection.send(ProtocolParser.param_set(param))
示例#5
0
    def remove(self, effect):
        """
        Remove an LV2 plugin instance (and also the jack client)

        :param Lv2Effect effect: Effect that your jack client encapsulated will removed
        """
        self.connection.send(ProtocolParser.remove(effect))
示例#6
0
    def add(self, effect):
        """
        Add an LV2 plugin encapsulated as a jack client

        :param Lv2Effect effect: Effect that will be loaded as LV2 plugin encapsulated
        """
        effect.instance = self.instance_index
        self.instance_index += 1

        self.connection.send(ProtocolParser.add(effect))
    def test_remove(self):
        effect_uri = 'http://calf.sourceforge.net/plugins/Reverb'
        effect_instance = 3

        reverb = self.builder.build(effect_uri)
        reverb.instance = effect_instance

        message = ProtocolParser.remove(reverb)

        correct_message = "remove {}".format(effect_instance)
        self.assertEqual(correct_message, message)
    def test_bypass_effect_no_active(self):
        effect_uri = 'http://calf.sourceforge.net/plugins/Reverb'
        effect_instance = 3

        reverb = self.builder.build(effect_uri)
        reverb.instance = effect_instance
        reverb.active = False

        message = ProtocolParser.bypass(reverb)

        correct_message = "bypass {} {}".format(effect_instance, 0)
        self.assertEqual(correct_message, message)
    def test_connect_system_effect(self):
        system_effect = SystemEffect('system', ('capture_1', 'capture_2'), ('playback_1', 'playback_2'))

        output = system_effect.outputs[1]
        input = system_effect.inputs[0]
        connection = Connection(output, input)

        correct_message = 'connect system:{} system:{}'.format(
            output.symbol,
            input.symbol
        )

        self.assertEqual(correct_message, ProtocolParser.connect(connection))
    def test_param_get(self):
        effect_uri = 'http://calf.sourceforge.net/plugins/Reverb'
        effect_instance = 3

        reverb = self.builder.build(effect_uri)
        reverb.instance = effect_instance

        param = reverb.params[0]
        message = ProtocolParser.param_get(param)

        correct_message = "param_get {} {}".format(
            effect_instance,
            param.symbol
        )
        self.assertEqual(correct_message, message)
    def test_disconnect(self):
        effect1_instance = 3
        effect2_instance = 4

        reverb1 = self.builder.build('http://calf.sourceforge.net/plugins/Reverb')
        reverb2 = self.builder.build('http://calf.sourceforge.net/plugins/Reverb')
        reverb1.instance = effect1_instance
        reverb2.instance = effect2_instance

        output = reverb1.outputs[0]
        input = reverb2.inputs[0]
        connection = Connection(output, input)

        correct_message = 'disconnect effect_{}:{} effect_{}:{}'.format(
            reverb1.instance,
            output.symbol,
            reverb2.instance,
            input.symbol
        )

        self.assertEqual(correct_message, ProtocolParser.disconnect(connection))
 def test_quit(self):
     self.assertEqual('quit', ProtocolParser.quit())
 def test_help(self):
     self.assertEqual('help', ProtocolParser.help())
 def test_save(self):
     filename = 'Não sei'
     correct_message = 'save {}'.format(filename)
     self.assertEqual(correct_message, ProtocolParser.save(filename))
 def test_load(self):
     filename = 'Não sei'
     correct_message = 'load {}'.format(filename)
     self.assertEqual(correct_message, ProtocolParser.load(filename))