diff options
| author | sbahling <sbahling@mudgum.net> | 2018-10-21 20:14:16 +0200 |
|---|---|---|
| committer | sbahling <sbahling@mudgum.net> | 2018-10-21 20:14:16 +0200 |
| commit | 29d00369ad37e98ea2269e0115789cd28f5410cc (patch) | |
| tree | 63308f7157474fa1ec0112e8b50bb02fb4b1bc32 | |
| parent | fd73458471ff784edaac617e46dffd92a670c3f8 (diff) | |
| download | tascam-fw-osc-29d00369ad37e98ea2269e0115789cd28f5410cc.tar.gz tascam-fw-osc-29d00369ad37e98ea2269e0115789cd28f5410cc.tar.xz tascam-fw-osc-29d00369ad37e98ea2269e0115789cd28f5410cc.zip | |
Fixing the fader position handling
| -rw-r--r-- | console.py | 7 | ||||
| -rw-r--r-- | faders.py | 15 | ||||
| -rw-r--r-- | strips.py | 2 |
3 files changed, 9 insertions, 15 deletions
@@ -49,11 +49,11 @@ class ConsoleStatus(): # reverse the bit order before slicing so the index '0' is the LSB # and reverse back before converting to int - return int(bits32(bits)[::-1][first_bit:last_bit][::-1], 2) + return int(bits32(bits)[::-1][first_bit-1:last_bit][::-1], 2) class RunningStatusThread(): - def __init__(self, console, interval=1): + def __init__(self, console, interval=0.1): """ Constructor :type interval: int :param interval: Check interval, in seconds @@ -116,7 +116,8 @@ class Console(): changed = before ^ after - for bit in [i for i, b in enumerate(reversed(bits32(changed))) if int(b)]: + bits = reversed(bits32(changed)) + for bit in [i for i, b in enumerate(bits) if int(b)]: high = bool(after & (0b1 << bit)) button = self.buttons[index][int(bit)] if button is None: @@ -41,7 +41,6 @@ class Fader(Button): name = 'Strip {} Fader'. format(strip.num) super().__init__(console, name) self.strip = strip - self.pos = 0 self.addr = '/strip/fader' self.status_quadlet = status_quadlets[self.strip.num] self.status_bits = status_bits[self.strip.num] @@ -49,21 +48,15 @@ class Fader(Button): @property def position(self): - return self.pos + return self.console.status.field(self.status_quadlet, self.status_bits) @position.setter def position(self, pos): - self.pos = pos self.console.unit.strips[self.strip.num].set_position(pos) - def send_pos(self): - osc.client.sent_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 send_pos(self, pos): + print('{}, ({}, {})'.format(self.addr, self.strip.num, pos/1023)) + osc.client.send_message(self.addr, (self.strip.num, pos/1023)) def press(self): self.console.status_thread.add_callback(self) @@ -28,7 +28,7 @@ class Strip(): def __init__(self, console, num): self.console = console - self.num = 0 + self.num = num self.mute_button = None self._mute = False self.solo_button = None |
