diff options
Diffstat (limited to 'tascam_fw_console/fader.py')
| -rw-r--r-- | tascam_fw_console/fader.py | 27 |
1 files changed, 17 insertions, 10 deletions
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() |
