Beispiel #1
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)
Beispiel #2
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)
Beispiel #3
0
    def test_system_effect_connections(self):
        pedalboard = Pedalboard('A pedalboard')
        sys_effect = SystemEffect('system', ['capture_1'], ['playback_1', 'playback_2'])

        effect_output = sys_effect.outputs[0]
        effect_input = sys_effect.inputs[0]

        pedalboard.connect(effect_output, effect_input)
        self.assertEqual(len(pedalboard.connections), 1)

        pedalboard.disconnect(effect_output, effect_input)
        self.assertEqual(len(pedalboard.connections), 0)
Beispiel #4
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_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()
    def test_disconnect(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.connect(cctonode.midi_outputs[0], cctonode2.midi_inputs[0])
        self.assertEqual(1, len(pedalboard.connections))

        pedalboard.observer = MagicMock()

        disconnected = pedalboard.connections[-1]
        pedalboard.disconnect(cctonode.midi_outputs[0],
                              cctonode2.midi_inputs[0])
        self.assertEqual(0, len(pedalboard.connections))
        pedalboard.observer.on_connection_updated.assert_called_with(
            disconnected, UpdateType.DELETED, pedalboard=pedalboard)