diff options
| author | sbahling <sbahling@mudgum.net> | 2018-10-26 14:23:08 +0200 |
|---|---|---|
| committer | sbahling <sbahling@mudgum.net> | 2018-10-26 14:23:08 +0200 |
| commit | 1d1b23e5154e093a3e3e3e40b05946ab06c9738c (patch) | |
| tree | a57773bf632c21cecc6427619ec23fd8c88d8b5d /tascam_fw_console/strips.py | |
| parent | 38c4e8310ef6bde30d3628ee93103c631caed47b (diff) | |
| download | tascam-fw-osc-1d1b23e5154e093a3e3e3e40b05946ab06c9738c.tar.gz tascam-fw-osc-1d1b23e5154e093a3e3e3e40b05946ab06c9738c.tar.xz tascam-fw-osc-1d1b23e5154e093a3e3e3e40b05946ab06c9738c.zip | |
Create initial package setup with setuptools
Diffstat (limited to 'tascam_fw_console/strips.py')
| -rw-r--r-- | tascam_fw_console/strips.py | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/tascam_fw_console/strips.py b/tascam_fw_console/strips.py new file mode 100644 index 0000000..8d195f8 --- /dev/null +++ b/tascam_fw_console/strips.py @@ -0,0 +1,130 @@ +#!/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.faders import Fader +from tascam_fw_console import osc + + +class Strip(): + + def __init__(self, console, num): + self.console = console + self.num = num + self.mute_button = None + self._mute = False + self.solo_button = None + self._solo = False + self.select_button = None + self._select = False + self._rec = False + self.pan = 0.5 + self.fader = Fader(self.console, self) + self.name = None + + @property + def mute_led(self): + return self.console.unit.strips[self.num].mute_led + + @property + def solo_led(self): + return self.console.unit.strips[self.num].solo_led + + @property + def sel_led(self): + return self.console.unit.strips[self.num].sel_led + + @property + def rec_led(self): + return self.console.unit.strips[self.num].rec_led + + @property + def mute(self): + return self._mute + + @mute.setter + def mute(self, state): + state = bool(state) + self._mute = state + if state: + self.mute_led.turn_on() + else: + self.mute_led.turn_off() + + @property + def solo(self): + return self._solo + + @solo.setter + def solo(self, state): + state = bool(state) + self._solo = state + if state: + self.solo_led.turn_on() + else: + self.solo_led.turn_off() + + @property + def select(self): + return self._select + + @select.setter + def select(self, state): + state = bool(state) + self._select = state + if state: + self.sel_led.turn_on() + else: + self.sel_led.turn_off() + + @property + def rec(self): + return self._rec + + @rec.setter + def rec(self, state): + state = bool(state) + self._rec = state + if state: + self.rec_led.turn_on() + else: + self.rec_led.turn_off() + + def send_pan(self, delta): + addr = '/strip/pan_stereo_position' + pan = self.pan + delta * 0.02 + if pan < 0: + pan = 0 + if pan > 1.0: + pan = 1.0 + osc.client.send_message(addr, (self.num, pan)) + + def recv_pan(self, pan): + print('Pan: {} {}'.format(self.num, pan)) + self.pan = pan + + +def init_strips(unit): + strips = [] + for strip_num in range(0, 9): + strips.append(Strip(unit, strip_num)) + + return strips |
