summaryrefslogtreecommitdiff
path: root/tascam_fw_console
diff options
context:
space:
mode:
Diffstat (limited to 'tascam_fw_console')
-rw-r--r--tascam_fw_console/console.py60
1 files changed, 52 insertions, 8 deletions
diff --git a/tascam_fw_console/console.py b/tascam_fw_console/console.py
index 81b5329..5bdec7f 100644
--- a/tascam_fw_console/console.py
+++ b/tascam_fw_console/console.py
@@ -26,6 +26,7 @@ import threading
from pathlib import Path
from tascam_fw_console import strips
+from tascam_fw_console import osc
from tascam_fw_console import fw_1884_buttons
import gi
@@ -38,6 +39,9 @@ from hinawa_utils.tscm.tscm_console_unit import TscmConsoleUnit # noqa: E402
bits32 = '{:032b}'.format
+ENCODER_MODES = ['FLIP', 'AUX1', 'AUX2', 'AUX3', 'AUX4',
+ 'AUX5', 'AUX6', 'AUX7', 'AUX8']
+
class ConsoleStatus():
def __init__(self, quadlets):
@@ -115,11 +119,26 @@ class Console():
self.strips = strips.init_strips(self)
self.buttons = {}
self.init_buttons()
+ self.init_encoder_mode()
+ self.encoders = {
+ 10: (self.strips[1].handle_encoder, self.strips[2].handle_encoder),
+ 11: (self.strips[3].handle_encoder, self.strips[4].handle_encoder),
+ 12: (self.strips[5].handle_encoder, self.strips[6].handle_encoder),
+ 13: (self.strips[7].handle_encoder, self.strips[8].handle_encoder),
+ 14: (self.handle_gain, self.handle_freq),
+ 15: (self.handle_q, self.handle_jog),
+ }
self.unit.connect('control', self.handle_control)
self.status_thread = RunningStatusThread(self) # noqa F841
+ def init_encoder_mode(self):
+ self.state['encoder_mode'] = 'PAN'
+ for mode in ENCODER_MODES:
+ self.unit.leds.turn_off(mode)
+ self.unit.leds.turn_on(self.state['encoder_mode'])
+
def _seek_snd_unit_from_guid(self, guid):
for fullpath in Path('/dev/snd').glob('hw*'):
fullpath = str(fullpath)
@@ -166,9 +185,36 @@ class Console():
else:
button.press()
+ def handle_gain(self, mode, delta):
+ print('Handle Gain:', mode, delta)
+
+ def handle_freq(self, mode, delta):
+ print('Handle Freq:', mode, delta)
+
+ def handle_q(self, mode, delta):
+ print('Handle Q:', mode, delta)
+
+ def handle_jog(self, mode, delta):
+ print('Handle Jog:', mode, delta)
+ delta = delta * 0.5
+ if self.buttons['ALT'].pressed:
+ if delta > 0:
+ osc.client.send_message('/access_action',
+ 'Editor/temporal-zoom-in')
+ else:
+ osc.client.send_message('/access_action',
+ 'Editor/temporal-zoom-out')
+ return
+
+ if self.buttons['SHIFT'].pressed:
+ delta = delta * 0.3
+ if self.buttons['CTRL'].pressed:
+ delta = delta * 0.1
+ osc.client.send_message('/jog', delta)
+ osc.client.send_message('/jog', delta)
+
def handle_encoder(self, index, before, after):
- strip1 = (index * 2 - 19)
- strip2 = (index * 2 - 18)
+ handler1, handler2 = self.encoders.get(int(index), (None, None))
bval1 = before & 0xffff
bval2 = before >> 0x10
aval1 = after & 0xffff
@@ -178,13 +224,11 @@ class Console():
delta2 = roll_over_delta(aval2 - bval2)
encoder_mode = self.state.get('encoder_mode', '')
- if delta1:
- strip = self.strips[strip1]
- strip.handle_encoder(encoder_mode, delta1)
+ if delta1 and handler1:
+ handler1(encoder_mode, delta1)
- if delta2:
- strip = self.strips[strip2]
- strip.handle_encoder(encoder_mode, delta2)
+ if delta2 and handler2:
+ handler2(encoder_mode, delta2)
def handle_control(self, unit, index, before, after):