From 34c035543811f7f1a313a4e86154f715cd71eb64 Mon Sep 17 00:00:00 2001 From: sbahling Date: Fri, 2 Nov 2018 20:45:10 +0100 Subject: rename faders.py to fader.py --- tascam_fw_console/fader.py | 73 +++++++++++++++++++++++++++++++++++++++++++++ tascam_fw_console/faders.py | 73 --------------------------------------------- tascam_fw_console/strips.py | 2 +- 3 files changed, 74 insertions(+), 74 deletions(-) create mode 100644 tascam_fw_console/fader.py delete mode 100644 tascam_fw_console/faders.py (limited to 'tascam_fw_console') diff --git a/tascam_fw_console/fader.py b/tascam_fw_console/fader.py new file mode 100644 index 0000000..ab20eaa --- /dev/null +++ b/tascam_fw_console/fader.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +""" + Open Sound Control send/recieve daemon for Tascam Firewire control surface + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + :copyright: Copyright (c) 2018 Scott Bahling + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program (see the file COPYING); if not, write to the + Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + :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) +status_bits = ((1, 16), + (1, 16), + (17, 32), + (1, 16), + (17, 32), + (1, 16), + (17, 32), + (1, 16), + (17, 32), + ) + + +class Fader(Button): + def __init__(self, strip): + name = 'Strip {} Fader'. format(strip.num) + super().__init__(strip.console, name) + self.strip = strip + if self.strip.num == 0: + self.addr = '/master/fader' + else: + self.addr = '/strip/fader' + 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) + + @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) + else: + osc.client.send_message(self.addr, (self.strip.num, pos/1023)) + + def press(self): + self.console.status_thread.add_callback(self) + super().press() + + def release(self): + self.console.status_thread.remove_callback(self) + super().press() diff --git a/tascam_fw_console/faders.py b/tascam_fw_console/faders.py deleted file mode 100644 index ab20eaa..0000000 --- a/tascam_fw_console/faders.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python3 -""" - Open Sound Control send/recieve daemon for Tascam Firewire control surface - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - :copyright: Copyright (c) 2018 Scott Bahling - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as - published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program (see the file COPYING); if not, write to the - Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - :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) -status_bits = ((1, 16), - (1, 16), - (17, 32), - (1, 16), - (17, 32), - (1, 16), - (17, 32), - (1, 16), - (17, 32), - ) - - -class Fader(Button): - def __init__(self, strip): - name = 'Strip {} Fader'. format(strip.num) - super().__init__(strip.console, name) - self.strip = strip - if self.strip.num == 0: - self.addr = '/master/fader' - else: - self.addr = '/strip/fader' - 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) - - @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) - else: - osc.client.send_message(self.addr, (self.strip.num, pos/1023)) - - def press(self): - self.console.status_thread.add_callback(self) - super().press() - - def release(self): - self.console.status_thread.remove_callback(self) - super().press() diff --git a/tascam_fw_console/strips.py b/tascam_fw_console/strips.py index 5da97e0..e063f52 100644 --- a/tascam_fw_console/strips.py +++ b/tascam_fw_console/strips.py @@ -20,7 +20,7 @@ :license: GPL-2.0, see COPYING for details """ -from tascam_fw_console.faders import Fader +from tascam_fw_console.fader import Fader from tascam_fw_console import osc -- cgit v1.2.3