diff options
| author | sbahling <sbahling@cagafuego.fritz.box> | 2018-10-20 23:59:28 +0200 |
|---|---|---|
| committer | sbahling <sbahling@cagafuego.fritz.box> | 2018-10-20 23:59:28 +0200 |
| commit | 6effbc283b3fa5b34bd45045c81168afa979572c (patch) | |
| tree | a57236c458c1833551b81bc94ccf8d82500b117c /faders.py | |
| parent | 50ae6f1fdd4fd9e880435ff7e831f7461cb5302e (diff) | |
| download | tascam-fw-osc-6effbc283b3fa5b34bd45045c81168afa979572c.tar.gz tascam-fw-osc-6effbc283b3fa5b34bd45045c81168afa979572c.tar.xz tascam-fw-osc-6effbc283b3fa5b34bd45045c81168afa979572c.zip | |
Initial refactoring work
Diffstat (limited to 'faders.py')
| -rw-r--r-- | faders.py | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/faders.py b/faders.py new file mode 100644 index 0000000..ed202c5 --- /dev/null +++ b/faders.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python3 +""" + Open Sound Control send/recieve daemon for Tascam Firewire control surface + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + :copyright: Copyright (c) 2012-2014 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 buttons import Button +from osc import osc + + +class Fader(Button): + def __init__(self, console, strip): + name = 'Strip {} Fader'. format(strip.num) + super().__init__(console, name) + self.strip = strip + self.pos = 0 + self.addr = '/strip/fader' + self.console_callback = self.send_pos + + @position.setter + def position(self, pos): + self.pos = pos + self.console.unit.strips + + + @property + def position(self): + return self.pos + + def send_pos(self): + osc.send_message(self.addr, (self.strip, self.pos/1023)) + + def handle_console_status(self, pos): + if pos != self.pos: + print('{}: {}'.format(self.name, pos)) + self.pos = pos + self.send_pos() + + def press(self): + self.console.status_thread.add_callback(self) + super().press() + + def release(self): + self.console.status_thread.remove_callback(self) + super().press() + + + + +def strip_fader_handler(addr, args, ssid, pos): + unit = args[0] + strip = int(ssid) + print('fader_handler', addr, ssid, pos) + pos = pos * 1023 + if strip_states[strip].name != ' ': + unit.strips[strip].fader.set_position(pos) + strip_states[strip].fader = pos + + strips[strip].fader.set_position(pos) + + + unit = args[0] + if state: + unit.leds.rew.turn_on() + else: + unit.leds.rew.turn_off() + + + +def master_fader_handler(addr, args, pos): + unit = args[0] + print('master_fader_handler', pos) + unit.master_fader.set_position(1023 * pos) + |
