-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMixerComponent.py
39 lines (32 loc) · 1.6 KB
/
MixerComponent.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
from __future__ import absolute_import, print_function, unicode_literals
from _Framework.Control import ButtonControl
from _Framework.MixerComponent import MixerComponent as MixerComponentBase
class MixerComponent(MixerComponentBase):
bank_up_button = ButtonControl()
bank_down_button = ButtonControl()
track_up_button = ButtonControl()
track_down_button = ButtonControl()
def __init__(self, *a, **k):
super(MixerComponent, self).__init__(*a, **k)
self.sends = [] # Initialize sends with None
@bank_up_button.pressed
def bank_up_button_pressed(self, button):
new_offset = self._track_offset + len(self._channel_strips)
if len(self.tracks_to_use()) > new_offset:
self.set_track_offset(new_offset)
@bank_down_button.pressed
def bank_down_button_pressed(self, button):
self.set_track_offset(max(0, self._track_offset - len(self._channel_strips)))
@track_up_button.pressed
def track_up_button_pressed(self, button):
new_offset = self._track_offset + 1
if len(self.tracks_to_use()) > new_offset:
self.set_track_offset(new_offset)
@track_down_button.pressed
def track_down_button_pressed(self, button):
self.set_track_offset(max(0, self._track_offset - 1))
# The previous set_send method led to an index out of bounds error when selecting certain toggle keys on the physical Roland A PRO Series midi keyboard, namely B1 through B4.
# I added a lower and upper bounds condition
def set_send(self, index, send):
if 0 <= index < len(self.sends):
self.sends[index] = send