-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
100 lines (72 loc) · 2.41 KB
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
from time import sleep
from pluginsmanager.observer.updates_observer import UpdatesObserver
from zoom.observer.zoom_host import ZoomHost
from zoom.zoom_builder import ZoomEffectsBuilder
from zoom.zoomg3v2 import ZoomG3v2
class Observer(UpdatesObserver):
def on_bank_updated(self, *args, **kwargs):
print('on_bank_updated', args, kwargs)
def on_pedalboard_updated(self, *args, **kwargs):
print('on_pedalboard_updated', args, kwargs)
def on_effect_updated(self, *args, **kwargs):
print('on_effect_updated', args, kwargs)
def on_effect_status_toggled(self, *args, **kwargs):
print('on_effect_status_toggled', args, kwargs)
def on_param_value_changed(self, *args, **kwargs):
print('on_param_value_changed', args, kwargs)
def on_connection_updated(self, *args, **kwargs):
print('on_connection_updated', args, kwargs)
def on_custom_change(self, *args, **kwargs):
print('on_custom_change', args, kwargs)
# Instantiate
zoom = ZoomG3v2()
# Connect the object 'zoom' with the real equipment
zoom.connect(ZoomHost())
zoom.register(Observer())
# Load all patches from the equipment
zoom.load_data()
sleep(2)
# Print current patch
print('Current pedalboard:', zoom.current_pedalboard)
# Set level of current pedalboard
zoom.current_pedalboard.level = 25
sleep(2)
# Toggle status
for effect in zoom.current_pedalboard.effects:
effect.toggle()
sleep(.5)
# Toggle status
for effect in zoom.current_pedalboard.effects:
effect.toggle()
sleep(.5)
for effect in zoom.current_pedalboard.effects:
for param in effect.params:
print(param)
value = param.value
param.value = param.minimum
sleep(.5)
param.value = value
sleep(.5)
builder = ZoomEffectsBuilder(None)
for effect in zoom.current_pedalboard.effects:
index = effect.index
if index == 0:
new_effect = builder.build_by_name('M-Filter')
effect.params[0].value = 10
effect.params[1].value = 0
effect.params[2].value = 2
effect.params[3].value = 0
else:
new_effect = builder.build_by_name('None')
zoom.current_pedalboard.effects[index] = new_effect
sleep(.5)
zoom.current_pedalboard.effects[index] = effect
sleep(.5)
# Go to next pedalboard
zoom.to_next_pedalboard()
sleep(2)
# Go to previous pedalboard
zoom.to_previous_pedalboard()
sleep(2)
# See all patches
print(zoom.pedalboards)