示例#1
0
    def test_data(self):
        pedalboard = Pedalboard('Bank 1')
        pedalboard.observer = MagicMock()

        self.assertEqual({}, pedalboard.data)
        data = {'my-awesome-component': True}
        pedalboard.data = data
        self.assertEqual(data, pedalboard.data)
    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