Ejemplo n.º 1
0
    def test_connect(self):
        pedalboard = Pedalboard('Pedalboard name')
        pedalboard.observer = MagicMock()

        builder = MidiOutputTest.builder
        cctonode = builder.build(
            'http://gareus.org/oss/lv2/midifilter#cctonote')
        cctonode2 = builder.build(
            'http://gareus.org/oss/lv2/midifilter#cctonote')

        pedalboard.append(cctonode)
        pedalboard.append(cctonode2)

        self.assertEqual(0, len(pedalboard.connections))
        pedalboard.connect(cctonode.midi_outputs[0], cctonode2.midi_inputs[0])
        self.assertEqual(1, len(pedalboard.connections))

        new_connection = pedalboard.connections[0]
        pedalboard.observer.on_connection_updated.assert_called_with(
            new_connection, UpdateType.CREATED, pedalboard=pedalboard)

        pedalboard.connect(cctonode2.midi_outputs[0], cctonode.midi_inputs[0])
        self.assertEqual(2, len(pedalboard.connections))

        new_connection = pedalboard.connections[-1]
        pedalboard.observer.on_connection_updated.assert_called_with(
            new_connection, UpdateType.CREATED, pedalboard=pedalboard)
Ejemplo n.º 2
0
    def test_json(self):
        bank = Bank('Bank 1')
        pedalboard = Pedalboard('Rocksmith')

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

        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)

        pedalboard.connect(system_effect.outputs[0], reverb.inputs[0])
        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])
        pedalboard.connect(reverb.outputs[0], system_effect.inputs[0])

        bank.append(pedalboard)

        print(json.dumps(bank.json, sort_keys=True, indent=2))
Ejemplo n.º 3
0
    def test_delete_effect_remove_your_connections(self):
        pedalboard = Pedalboard('Pedalboard name')

        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)
        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])

        self.assertEqual(4, len(pedalboard.connections))

        pedalboard.observer = MagicMock()
        fuzz_connections = filter.connections

        pedalboard.effects.remove(filter)

        self.assertEqual(1, len(pedalboard.connections))
        for connection in fuzz_connections:
            pedalboard.observer.on_connection_updated.assert_any_call(
                connection, UpdateType.DELETED, pedalboard=pedalboard)
Ejemplo n.º 4
0
    def test_set_pedalboard(self):
        """Test only coverage"""
        manager = BanksManager()

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

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

        pedalboard = Pedalboard('test_set_pedalboard_1')
        bank.append(pedalboard)
        reverb = self.builder.build(
            'http://calf.sourceforge.net/plugins/Reverb')
        pedalboard.append(reverb)

        pedalboard2 = Pedalboard('test_set_pedalboard_2')
        reverb2 = self.builder.build(
            'http://calf.sourceforge.net/plugins/Reverb')
        bank.append(pedalboard)
        pedalboard2.append(reverb2)

        mod_host.pedalboard = pedalboard
        mod_host.pedalboard = pedalboard2
Ejemplo n.º 5
0
    def test_param_value_not_current_pedalboard(self):
        """Test only coverage"""
        manager = BanksManager()

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

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

        pedalboard = Pedalboard('test_set_pedalboard_1')
        pedalboard.append(
            self.builder.build('http://calf.sourceforge.net/plugins/Reverb'))

        pedalboard2 = Pedalboard('test_set_pedalboard_2')
        pedalboard2.append(
            self.builder.build('http://calf.sourceforge.net/plugins/Reverb'))

        bank.append(pedalboard)
        bank.append(pedalboard2)

        mod_host.pedalboard = pedalboard

        pedalboard2.effects[0].params[0].value = pedalboard2.effects[0].params[
            0].maximum
Ejemplo n.º 6
0
    def test_disconnect(self):
        pedalboard = Pedalboard('Pedalboard name')

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

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

        pedalboard.connect(reverb.outputs[0], reverb2.inputs[0])
        pedalboard.connect(reverb.outputs[1], reverb2.inputs[0])
        self.assertEqual(2, len(pedalboard.connections))

        pedalboard.observer = MagicMock()

        disconnected = pedalboard.connections[-1]
        pedalboard.disconnect(reverb.outputs[1], reverb2.inputs[0])
        self.assertEqual(1, len(pedalboard.connections))
        pedalboard.observer.on_connection_updated.assert_called_with(disconnected, UpdateType.DELETED, pedalboard=pedalboard)

        disconnected = pedalboard.connections[-1]
        pedalboard.disconnect(reverb.outputs[0], reverb2.inputs[0])
        self.assertEqual(0, len(pedalboard.connections))
        pedalboard.observer.on_connection_updated.assert_called_with(disconnected, UpdateType.DELETED, pedalboard=pedalboard)
Ejemplo n.º 7
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)
Ejemplo n.º 8
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)
Ejemplo n.º 9
0
    def test_update_effect(self):
        pedalboard = Pedalboard('Pedalboard 1')

        effect1 = MagicMock()
        effect2 = MagicMock()

        pedalboard.append(effect1)

        pedalboard.observer = MagicMock()
        pedalboard.effects[0] = effect2

        self.assertEqual(effect2.pedalboard, pedalboard)
        self.assertEqual(pedalboard.effects[0], effect2)
        pedalboard.observer.on_effect_updated.assert_called_with(
            effect2, UpdateType.UPDATED, index=0, origin=pedalboard)
Ejemplo n.º 10
0
    def default_bank_mock(self):
        bank = BankMock('REST - Default Bank' + str(uuid.uuid4()))
        pedalboard = Pedalboard('REST - Default Pedalboard')

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

        bank.append(pedalboard)

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

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

        return bank
    def read(self, json):
        pedalboard = Pedalboard(json['name'])

        effect_reader = EffectReader(self.system_effect)
        for effect_json in json['effects']:
            pedalboard.append(effect_reader.read(effect_json))

        connection_reader = ConnectionReader(pedalboard, self.system_effect)
        for connection_json in json['connections']:
            port_output, port_input = connection_reader.read(connection_json)
            pedalboard.connect(port_output, port_input)

        if 'data' in json:
            pedalboard.data = json['data']

        return pedalboard
Ejemplo n.º 12
0
    def test_disconnect_connection_not_created(self):
        pedalboard = Pedalboard('Pedalboard name')

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

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

        pedalboard.observer = MagicMock()

        with self.assertRaises(ValueError):
            pedalboard.disconnect(reverb.outputs[1], reverb2.inputs[0])

        pedalboard.observer.on_connection_updated.assert_not_called()
    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
Ejemplo n.º 14
0
    def test_disconnect_connection_not_created(self):
        pedalboard = Pedalboard('Pedalboard name')

        builder = MidiOutputTest.builder
        cctonode = builder.build(
            'http://gareus.org/oss/lv2/midifilter#cctonote')
        cctonode2 = builder.build(
            'http://gareus.org/oss/lv2/midifilter#cctonote')

        pedalboard.append(cctonode)
        pedalboard.append(cctonode2)

        pedalboard.observer = MagicMock()

        with self.assertRaises(ValueError):
            pedalboard.disconnect(cctonode.midi_outputs[0],
                                  cctonode2.midi_inputs[0])

        pedalboard.observer.on_connection_updated.assert_not_called()
Ejemplo n.º 15
0
    def test_system_midi_port(self):
        from pluginsmanager.observer.mod_host.mod_host import ModHost
        from pluginsmanager.model.pedalboard import Pedalboard
        from pluginsmanager.model.lv2.lv2_effect_builder import Lv2EffectBuilder
        from pluginsmanager.model.system.system_effect import SystemEffect

        jack_system = SystemEffect(
            'system',
            [],  # audio inputs
            ['playback_1', 'playback_2'],  # audio output
            [],  # midi inputs
            []  # midi outputs
        )
        jack_ttymidi = SystemEffect(
            'ttymidi',
            [],  # audio inputs
            [],  # audio output
            ['MIDI_in'],  # midi inputs
            ['MIDI_out']  # midi outputs
        )

        modhost = ModHost('localhost')
        modhost.connect()

        pedalboard = Pedalboard('MDA-EP')
        builder = Lv2EffectBuilder()
        ep = builder.build(
            'http://guitarix.sourceforge.net/plugins/gx_oc_2_#_oc_2_')

        pedalboard.append(ep)

        # REMEMBER: FIRST OUTPUT, SECOND INPUT
        # EPiano contains two audio output ports and one midi input port
        pedalboard.connect(ep.outputs[0], jack_system.inputs[0])
        pedalboard.connect(jack_ttymidi.midi_outputs[0], ep.midi_inputs[0])

        # If not using banks manager, the changes will not be applied automatically
        # then, is necessary changes the pedalboard at the end
        modhost.pedalboard = pedalboard

        # Safe close
        modhost.close()
Ejemplo n.º 16
0
    def test_json(self):
        bank = Bank('Bank 1')
        pedalboard = Pedalboard('Rocksmith')

        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)
        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])

        bank.append(pedalboard)

        print((json.dumps(bank.json, sort_keys=True, indent=2)))
    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
Ejemplo n.º 18
0
    def test_delete_effect(self):
        pedalboard = Pedalboard('Bank 1')

        effect = MagicMock()
        effect2 = MagicMock()

        pedalboard.append(effect)
        pedalboard.append(effect2)

        pedalboard.observer = MagicMock()
        del pedalboard.effects[1]

        self.assertEqual(effect2.pedalboard, None)
        self.assertEqual(len(pedalboard.effects), 1)
        pedalboard.observer.on_effect_updated.assert_called_with(
            effect2, UpdateType.DELETED, index=1, origin=pedalboard)

        del pedalboard.effects[0]
        self.assertEqual(effect.pedalboard, None)
        self.assertEqual(len(pedalboard.effects), 0)
        pedalboard.observer.on_effect_updated.assert_called_with(
            effect, UpdateType.DELETED, index=0, origin=pedalboard)
Ejemplo n.º 19
0
    def test_index(self):
        builder = EffectTest.builder
        reverb1 = builder.build('http://calf.sourceforge.net/plugins/Reverb')
        reverb2 = builder.build('http://calf.sourceforge.net/plugins/Reverb')
        reverb3 = builder.build('http://calf.sourceforge.net/plugins/Reverb')

        pedalboard = Pedalboard(name='My awesome pedalboard')
        pedalboard.append(reverb1)
        pedalboard.append(reverb2)
        pedalboard.append(reverb3)

        self.assertEqual(0, reverb1.index)
        self.assertEqual(1, reverb2.index)
        self.assertEqual(2, reverb3.index)

        pedalboard.effects.remove(reverb2)

        self.assertEqual(0, reverb1.index)
        self.assertEqual(1, reverb3.index)

        with self.assertRaises(IndexError):
            reverb2.index
    def convert(self, pedalboard_path, system_effect=None):
        """
        :param Path pedalboard_path: Path that the pedalboard has been persisted.
                                     Generally is in format `path/to/pedalboard/name.pedalboard`
        :param SystemEffect system_effect: Effect that contains the audio interface outputs and inputs
                                           or None for **auto discover**
        :return Pedalboard: Pedalboard loaded
        """
        info = self.get_pedalboard_info(pedalboard_path)

        if system_effect is None:
            system_effect = self.discover_system_effect(info)

        pedalboard = Pedalboard(info['title'])

        effects_instance = {}

        for effect_data in info['plugins']:
            effect = self._generate_effect(effect_data)
            pedalboard.append(effect)
            effects_instance[effect_data['instance']] = effect

        try:
            for connection_data in info['connections']:
                output_port = self._get_port(connection_data['source'],
                                             effects_instance, system_effect)
                input_port = self._get_port(connection_data['target'],
                                            effects_instance, system_effect)

                pedalboard.connect(output_port, input_port)
        except PortNotFoundError as e:
            if self.ignore_errors:
                print("WARNING:", e)
            else:
                raise e

        return pedalboard
    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
Ejemplo n.º 22
0
    def test_observers(self):
        mock = MagicMock()
        observer = Autosaver('data/test/')
        observer.save = mock
        observer.delete = mock

        manager = BanksManager()
        manager.register(observer)

        bank = Bank('Bank 1')
        manager.append(bank)
        observer.save.assert_called_with(bank)

        pedalboard = Pedalboard('Rocksmith')
        bank.append(pedalboard)
        observer.save.assert_called_with(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.save.assert_called_with(bank)
        pedalboard.append(filter)
        observer.save.assert_called_with(bank)
        pedalboard.append(reverb2)
        observer.save.assert_called_with(bank)

        reverb.outputs[0].connect(filter.inputs[0])
        observer.save.assert_called_with(bank)
        reverb.outputs[1].connect(filter.inputs[0])
        observer.save.assert_called_with(bank)
        filter.outputs[0].connect(reverb2.inputs[0])
        observer.save.assert_called_with(bank)
        reverb.outputs[0].connect(reverb2.inputs[0])
        observer.save.assert_called_with(bank)

        filter.toggle()
        observer.save.assert_called_with(bank)

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

        del bank.pedalboards[0]
        observer.save.assert_called_with(bank)

        bank2 = Bank('Bank 2')
        manager.banks[0] = bank2
        observer.delete.assert_called_with(bank2)
        observer.save.assert_called_with(bank2)

        manager.banks.remove(bank2)
        observer.delete.assert_called_with(bank2)
Ejemplo n.º 23
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)
Ejemplo n.º 24
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