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/encoder.py | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'tascam_fw_console/encoder.py') diff --git a/tascam_fw_console/encoder.py b/tascam_fw_console/encoder.py index 211fef1..ae82234 100644 --- a/tascam_fw_console/encoder.py +++ b/tascam_fw_console/encoder.py @@ -20,22 +20,17 @@ :license: GPL-2.0, see COPYING for details """ +from tascam_fw_console import osc + class Encoder(): - def __init__(self): - self.name = 'Unknown' - self.update_callbacks = set() + def __init__(self, name, addr, strip=None): + self.name = name + self.addr = addr + self.strip = strip def update(self, delta): - print('Encoder: ', self.name, delta) - for callback in self.update_callbacks: - try: - callback(delta) - except Exception('Encoder update callback failed') as e: - raise(e) - - def add_callback(self, callback): - self.update_callbacks.add(callback) - - def remove_callback(self, callback): - self.update_callbacks.remove(callback) + if self.strip: + osc.client.send_message(self.addr, (self.strip, delta)) + else: + osc.client.send_message(self.addr, delta) -- cgit v1.2.3