From e9e1efefc87ce4dd942fa7c83794a7b27ec3a13c Mon Sep 17 00:00:00 2001 From: sbahling Date: Sat, 3 Nov 2018 01:09:07 +0100 Subject: Serve as base OSC server for the Tascam Console Unit We remove the Ardour specific OSC mapping and create our own OSC API that will be consumed by OSC translators that communicate to specific applications. We only send the state of each control and set the state of each fader or led based on received commands. Logic for interpreting the control state will be moved to the OSC translator code. --- tascam_fw_console/fader.py | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'tascam_fw_console/fader.py') diff --git a/tascam_fw_console/fader.py b/tascam_fw_console/fader.py index ab20eaa..0169322 100644 --- a/tascam_fw_console/fader.py +++ b/tascam_fw_console/fader.py @@ -20,7 +20,6 @@ :license: GPL-2.0, see COPYING for details """ -from tascam_fw_console.buttons import Button from tascam_fw_console import osc status_quadlets = (4, 0, 0, 1, 1, 2, 2, 3, 3) @@ -36,38 +35,46 @@ status_bits = ((1, 16), ) -class Fader(Button): +class Fader(): def __init__(self, strip): - name = 'Strip {} Fader'. format(strip.num) - super().__init__(strip.console, name) + self.name = 'Strip {} Fader'. format(strip.num) self.strip = strip + self.console = strip.console if self.strip.num == 0: self.addr = '/master/fader' + self.press_args = (self.strip.num, 1) + self.release_args = (self.strip.num, 0) else: self.addr = '/strip/fader' + self.press_args = (1,) + self.release_args = (0,) self.status_quadlet = status_quadlets[self.strip.num] self.status_bits = status_bits[self.strip.num] self.status_callback = self.send_pos @property def position(self): - return self.console.status.field(self.status_quadlet, *self.status_bits) + return self.console.status.field(self.status_quadlet, + *self.status_bits) @position.setter def position(self, pos): self.console.unit.strips[self.strip.num].fader.set_position(pos) def send_pos(self, pos): - print('{}, ({}, {})'.format(self.addr, self.strip.num, pos/1023)) if self.strip.num == 0: - osc.client.send_message(self.addr, pos/1023) + osc.client.send_message(self.addr, pos) else: - osc.client.send_message(self.addr, (self.strip.num, pos/1023)) + osc.client.send_message(self.addr, (self.strip.num, pos)) def press(self): + addr = '{}_touch'.format(self.addr) + args = self.press_args + (1,) + osc.client.send_message(addr, args) self.console.status_thread.add_callback(self) - super().press() def release(self): + addr = '{}_touch'.format(self.addr) + args = self.press_args + (0,) + osc.client.send_message(addr, args) self.console.status_thread.remove_callback(self) - super().press() -- cgit v1.2.3