def bank(self, midi=True):
        sys_effect = self.system_effect

        bank = Bank('Bank 1')
        pedalboard = Pedalboard('Pedalboard 1')

        bank.append(pedalboard)
        bank.append(Pedalboard('Pedalboard is a Pedalboard?'))

        reverb = self.builder.build('http://calf.sourceforge.net/plugins/Reverb')
        filter = self.builder.build('http://calf.sourceforge.net/plugins/Filter')
        reverb2 = self.builder.build('http://calf.sourceforge.net/plugins/Reverb')

        pedalboard.append(reverb)
        pedalboard.append(filter)
        pedalboard.append(reverb2)

        pedalboard.connect(reverb.outputs[0], filter.inputs[0])
        pedalboard.connect(reverb.outputs[1], filter.inputs[0])
        pedalboard.connect(filter.outputs[0], reverb2.inputs[0])
        pedalboard.connect(reverb.outputs[0], reverb2.inputs[0])

        if midi:
            cctonode = self.builder.build('http://gareus.org/oss/lv2/midifilter#cctonote')
            pedalboard.append(cctonode)
            pedalboard.connect(cctonode.midi_outputs[0], sys_effect.midi_inputs[0])
            pedalboard.connect(sys_effect.midi_outputs[0], cctonode.midi_inputs[0])

        pedalboard.connections.append(Connection(sys_effect.outputs[0], reverb.inputs[0]))
        pedalboard.connections.append(Connection(reverb2.outputs[0], sys_effect.inputs[0]))

        filter.toggle()
        filter.params[0].value = (filter.params[0].maximum - filter.params[0].minimum) / 3

        return bank
    def test__eq__(self):
        reverb = self.builder.build(
            'http://calf.sourceforge.net/plugins/Reverb')
        filter = self.builder.build(
            'http://calf.sourceforge.net/plugins/Filter')

        connection = Connection(reverb.outputs[0], filter.inputs[0])
        connection2 = Connection(reverb.outputs[0], filter.inputs[0])

        self.assertEqual(connection, connection2)
Exemple #3
0
    def test_observers_mock(self):
        """Test only coverage"""
        sys_effect = SystemEffect('system', ('capture_1', 'capture_2'),
                                  ('playback_1', 'playback_2'))
        manager = BanksManager()

        bank = Bank('Bank 1')
        manager.append(bank)

        mod_host = ModHost('localhost')
        mod_host.host = MagicMock()
        manager.register(mod_host)

        pedalboard = Pedalboard('Rocksmith')

        mod_host.pedalboard = pedalboard

        bank.append(pedalboard)

        reverb = self.builder.build(
            'http://calf.sourceforge.net/plugins/Reverb')
        filter = self.builder.build(
            'http://calf.sourceforge.net/plugins/Filter')
        reverb2 = self.builder.build(
            'http://calf.sourceforge.net/plugins/Reverb')

        pedalboard.append(reverb)
        pedalboard.append(filter)
        pedalboard.append(reverb2)

        pedalboard.connect(reverb.outputs[0], filter.inputs[0])
        pedalboard.connect(reverb.outputs[1], filter.inputs[0])
        pedalboard.connect(filter.outputs[0], reverb2.inputs[0])
        pedalboard.connect(reverb.outputs[0], reverb2.inputs[0])

        filter.toggle()
        filter.params[0].value = (filter.params[0].maximum -
                                  filter.params[0].minimum) / 2

        pedalboard.disconnect(filter.outputs[0], reverb2.inputs[0])
        filter.toggle()

        pedalboard.effects.remove(filter)

        pedalboard.connections.append(
            Connection(sys_effect.outputs[0], reverb.inputs[0]))
        pedalboard.connections.append(
            Connection(reverb2.outputs[0], sys_effect.inputs[0]))

        for connection in list(pedalboard.connections):
            pedalboard.connections.remove(connection)

        for effect in list(pedalboard.effects):
            pedalboard.effects.remove(effect)
Exemple #4
0
    def test_connections_effect_remove_your_connections(self):
        pedalboard = Pedalboard('Pedalboard name')

        builder = EffectTest.builder
        reverb = builder.build('http://calf.sourceforge.net/plugins/Reverb')
        filter = builder.build('http://calf.sourceforge.net/plugins/Filter')
        reverb2 = builder.build('http://calf.sourceforge.net/plugins/Reverb')

        pedalboard.append(reverb)
        pedalboard.append(filter)
        pedalboard.append(reverb2)

        reverb.outputs[0].connect(filter.inputs[0])
        reverb.outputs[1].connect(filter.inputs[0])
        filter.outputs[0].connect(reverb2.inputs[0])
        reverb.outputs[0].connect(reverb2.inputs[0])

        reverb_connections = (Connection(reverb.outputs[0], filter.inputs[0]),
                              Connection(reverb.outputs[1], filter.inputs[0]),
                              Connection(reverb.outputs[0], reverb2.inputs[0]))
        fuzz_connections = (Connection(reverb.outputs[0], filter.inputs[0]),
                            Connection(reverb.outputs[1], filter.inputs[0]),
                            Connection(filter.outputs[0], reverb2.inputs[0]))
        reverb2_connections = (Connection(filter.outputs[0],
                                          reverb2.inputs[0]),
                               Connection(reverb.outputs[0],
                                          reverb2.inputs[0]))

        self.assertCountEqual(reverb_connections, reverb.connections)
        self.assertCountEqual(fuzz_connections, filter.connections)
        self.assertCountEqual(reverb2_connections, reverb2.connections)
Exemple #5
0
    def read(self, json):
        connection_output = self.generate_builder(json, 'output').build_output(
            json['output'])
        connection_input = self.generate_builder(json, 'input').build_input(
            json['input'])

        return Connection(connection_output, connection_input)
Exemple #6
0
    def disconnect(self, effect_input):
        """
        Disconnect it with effect_input

            >>> driver_output = driver.outputs[0]
            >>> reverb_input = reverb.inputs[0]
            >>> Connection(driver_output, reverb_input) in driver.effect.connections
            True
            >>> driver_output.disconnect(reverb_input)
            >>> Connection(driver_output, reverb_input) in driver.effect.connections
            False

        .. note::

            This method does not work for all cases.
            class:`SystemOutput` can not be disconnected with class:`SystemInput` this way.
            For this case, use ::

                >>> pedalboard.connections.remove(Connection(system_output, system_input))

        :param Input effect_input: Input that will be disconnected with it
        """
        if self._unique_for_all_pedalboards and effect_input._unique_for_all_pedalboards:
            error = "Isn't possible connect this way. Please use pedalboard.connect(Connection(output, input))"
            raise ConnectionError(error)

        self.effect.pedalboard.connections.remove(
            Connection(self, effect_input))
    def test_connect_effect_itself_successful(self):
        system_effect = SystemEffect('system', ('capture_1', 'capture_2'),
                                     ('playback_1', 'playback_2'))

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

        self.assertEqual(connection.input, system_effect.inputs[0])
        self.assertEqual(connection.output, system_effect.outputs[0])
    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_connection_midi_ports(self):
        cctonode1 = self.builder.build(
            'http://gareus.org/oss/lv2/midifilter#cctonote')
        cctonode2 = self.builder.build(
            'http://gareus.org/oss/lv2/midifilter#cctonote')

        system_effect = SystemEffect('system', ('capture_1', 'capture_2'),
                                     ('playback_1', 'playback_2'))

        with self.assertRaises(ConnectionError):
            Connection(cctonode1.midi_outputs[0], cctonode2.midi_inputs[0])
        with self.assertRaises(ConnectionError):
            MidiConnection(system_effect.outputs[0], system_effect.inputs[0])
    def bank(self):
        sys_effect = SystemEffect('system', ('capture_1', 'capture_2'),
                                  ('playback_1', 'playback_2'))

        bank = Bank('Bank 1')
        pedalboard = Pedalboard('Pedalboard 1')

        bank.append(pedalboard)
        bank.append(Pedalboard('Pedalboard is a Pedalboard?'))

        reverb = self.builder.build(
            'http://calf.sourceforge.net/plugins/Reverb')
        filter = self.builder.build(
            'http://calf.sourceforge.net/plugins/Filter')
        reverb2 = self.builder.build(
            'http://calf.sourceforge.net/plugins/Reverb')

        pedalboard.append(reverb)
        pedalboard.append(filter)
        pedalboard.append(reverb2)

        reverb.outputs[0].connect(filter.inputs[0])
        reverb.outputs[1].connect(filter.inputs[0])
        filter.outputs[0].connect(reverb2.inputs[0])
        reverb.outputs[0].connect(reverb2.inputs[0])

        pedalboard.connections.append(
            Connection(sys_effect.outputs[0], reverb.inputs[0]))
        pedalboard.connections.append(
            Connection(reverb2.outputs[0], sys_effect.inputs[0]))

        filter.toggle()
        filter.params[0].value = (filter.params[0].maximum -
                                  filter.params[0].minimum) / 3

        return bank
    def test_put(self):
        bank = self.default_bank_mock
        bank.index = self.rest.create_bank(bank).json()['index']

        pedalboard = bank.pedalboards[0]
        reverb, reverb2 = pedalboard.effects
        connection = Connection(reverb2.outputs[0], reverb.inputs[0])
        pedalboard.connections.append(connection)

        response = self.rest.create_connection(connection)

        self.assertEqual(Test.SUCCESS, response.status_code)

        response = self.rest.get_pedalboard(pedalboard)
        self.assertEqual(pedalboard.json, response.json())

        self.rest.delete_bank(bank)
    def test_append_notaddable(self):
        builder = Lv2EffectBuilder()
        element1 = builder.build('http://calf.sourceforge.net/plugins/Reverb')
        element2 = builder.build('http://calf.sourceforge.net/plugins/Reverb')

        pedalboard = Pedalboard('name')
        connection = Connection(element1.outputs[0], element2.inputs[0])

        with self.assertRaises(NotAddableError):
            pedalboard.connections.append(connection)

        pedalboard.append(element2)

        with self.assertRaises(NotAddableError):
            pedalboard.connections.append(connection)

        pedalboard.append(element1)
        pedalboard.connections.append(connection)  # All effects added - OK
    def test_connect(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 = 'connect effect_{}:{} effect_{}:{}'.format(
            reverb1.instance, output.symbol, reverb2.instance, input.symbol)

        self.assertEqual(correct_message, ProtocolParser.connect(connection))
Exemple #14
0
    mod_host.connect()
    manager.register(mod_host)

    pedalboard = Pedalboard('Rocksmith')
    bank.append(pedalboard)

    mod_host.pedalboard = pedalboard

    builder = Lv2EffectBuilder()

    reverb = builder.build('http://calf.sourceforge.net/plugins/Reverb')
    fuzz = builder.build('http://guitarix.sourceforge.net/plugins/gx_fuzz_#fuzz_')
    reverb2 = builder.build('http://calf.sourceforge.net/plugins/Reverb')

    pedalboard.append(reverb)
    pedalboard.append(fuzz)
    pedalboard.append(reverb2)

    sys_effect = SystemEffect('system', ['capture_1'], ['playback_1', 'playback_2'])

    pedalboard.connections.append(Connection(sys_effect.outputs[0], reverb.inputs[0]))

    reverb.outputs[0].connect(fuzz.inputs[0])
    reverb.outputs[1].connect(fuzz.inputs[0])
    fuzz.outputs[0].connect(reverb2.inputs[0])
    reverb.outputs[0].connect(reverb2.inputs[0])

    # Causes error
    reverb2.outputs[0].connect(sys_effect.inputs[0])
    reverb2.outputs[0].connect(sys_effect.inputs[1])
    def test_connect_effect_itself_error(self):
        reverb = self.builder.build(
            'http://calf.sourceforge.net/plugins/Reverb')

        with self.assertRaises(ConnectionError):
            Connection(reverb.outputs[0], reverb.inputs[0])
Exemple #16
0
modhost = SystemEffect('mod-host', ['midi_in'], [])

autosaver = Autosaver('/root/pedalpi')
manager = autosaver.load(sys_effect)

#manager = BanksManager()

# Mod-Host
mod_host = ModHost('localhost')
mod_host.connect()

manager.register(mod_host)

pedalboard = Pedalboard('MDA-EP')
modhost.pedalboard = pedalboard

builder = Lv2EffectBuilder()

ep = builder.build('http://moddevices.com/plugins/mda/EPiano')

pedalboard.connections.append(Connection(sys_effect.inputs[0], ep.outputs[0]))
pedalboard.connections.append(Connection(sys_effect.inputs[1], ep.outputs[1]))
pedalboard.connections.append(Connection(sys_effect.outputs[0], ep.inputs[0]))

# Safe close
from signal import pause
try:
    pause()
except KeyboardInterrupt:
    mod_host.close()
Exemple #17
0
    def test_observers_calls(self):
        observer = MagicMock()

        manager = BanksManager()
        manager.register(observer)

        bank = Bank('Bank 1')
        manager.append(bank)
        observer.on_bank_updated.assert_called_with(bank, UpdateType.CREATED, index=0, origin=manager)

        pedalboard = Pedalboard('Rocksmith')
        bank.append(pedalboard)
        observer.on_pedalboard_updated.assert_called_with(pedalboard, UpdateType.CREATED, index=0, origin=bank)

        builder = Lv2EffectBuilder()
        reverb = builder.build('http://calf.sourceforge.net/plugins/Reverb')
        filter = builder.build('http://calf.sourceforge.net/plugins/Filter')
        reverb2 = builder.build('http://calf.sourceforge.net/plugins/Reverb')

        pedalboard.append(reverb)
        observer.on_effect_updated.assert_called_with(reverb, UpdateType.CREATED, index=reverb.index, origin=pedalboard)
        pedalboard.append(filter)
        observer.on_effect_updated.assert_called_with(filter, UpdateType.CREATED, index=filter.index, origin=pedalboard)
        pedalboard.append(reverb2)
        observer.on_effect_updated.assert_called_with(reverb2, UpdateType.CREATED, index=reverb2.index, origin=pedalboard)

        pedalboard.connect(reverb.outputs[0], filter.inputs[0])
        observer.on_connection_updated.assert_called_with(
            Connection(reverb.outputs[0], filter.inputs[0]),
            UpdateType.CREATED,
            pedalboard=pedalboard
        )
        pedalboard.connect(reverb.outputs[1], filter.inputs[0])
        observer.on_connection_updated.assert_called_with(
            Connection(reverb.outputs[1], filter.inputs[0]),
            UpdateType.CREATED,
            pedalboard=pedalboard
        )
        pedalboard.connect(filter.outputs[0], reverb2.inputs[0])
        observer.on_connection_updated.assert_called_with(
            Connection(filter.outputs[0], reverb2.inputs[0]),
            UpdateType.CREATED,
            pedalboard=pedalboard
        )
        pedalboard.connect(reverb.outputs[0], reverb2.inputs[0])
        observer.on_connection_updated.assert_called_with(
            Connection(reverb.outputs[0], reverb2.inputs[0]),
            UpdateType.CREATED,
            pedalboard=pedalboard
        )

        filter.toggle()
        observer.on_effect_status_toggled.assert_called_with(filter)

        filter.params[0].value = (filter.params[0].maximum - filter.params[0].minimum) / 2
        observer.on_param_value_changed.assert_called_with(filter.params[0])

        del bank.pedalboards[0]
        observer.on_pedalboard_updated.assert_called_with(pedalboard, UpdateType.DELETED, index=0, origin=bank)

        bank2 = Bank('Bank 2')
        old_bank = manager.banks[0]
        manager.banks[0] = bank2
        observer.on_bank_updated.assert_called_with(bank2, UpdateType.UPDATED, index=0, origin=manager, old=old_bank)

        manager.banks.remove(bank2)
        observer.on_bank_updated.assert_called_with(bank2, UpdateType.DELETED, index=0, origin=manager)
Exemple #18
0
    pedalboard = Pedalboard('Rocksmith')
    bank.append(pedalboard)

    mod_host.pedalboard = pedalboard

    builder = Lv2EffectBuilder()

    reverb = builder.build('http://calf.sourceforge.net/plugins/Reverb')
    fuzz = builder.build(
        'http://guitarix.sourceforge.net/plugins/gx_fuzz_#fuzz_')
    reverb2 = builder.build('http://calf.sourceforge.net/plugins/Reverb')

    pedalboard.append(reverb)
    pedalboard.append(fuzz)
    pedalboard.append(reverb2)

    sys_effect = SystemEffect('system', ['capture_1'],
                              ['playback_1', 'playback_2'])

    pedalboard.connections.append(
        Connection(sys_effect.outputs[0], reverb.inputs[0]))

    reverb.outputs[0].connect(fuzz.inputs[0])
    reverb.outputs[1].connect(fuzz.inputs[0])
    fuzz.outputs[0].connect(reverb2.inputs[0])
    reverb.outputs[0].connect(reverb2.inputs[0])

    # Causes error
    reverb2.outputs[0].connect(sys_effect.inputs[0])
    reverb2.outputs[0].connect(sys_effect.inputs[1])