diff options
| author | sbahling <sbahling@mudgum.net> | 2018-10-21 15:10:29 +0200 |
|---|---|---|
| committer | sbahling <sbahling@mudgum.net> | 2018-10-21 15:10:29 +0200 |
| commit | dda9a4c0fd3d6bbecab0616254ace479b5d4d233 (patch) | |
| tree | 17741b579a434ee71cf6e510cce2bf99ffa869f3 /faders.py | |
| parent | 6effbc283b3fa5b34bd45045c81168afa979572c (diff) | |
| download | tascam-fw-osc-dda9a4c0fd3d6bbecab0616254ace479b5d4d233.tar.gz tascam-fw-osc-dda9a4c0fd3d6bbecab0616254ace479b5d4d233.tar.xz tascam-fw-osc-dda9a4c0fd3d6bbecab0616254ace479b5d4d233.zip | |
continued refactoring
Diffstat (limited to 'faders.py')
| -rw-r--r-- | faders.py | 60 |
1 files changed, 22 insertions, 38 deletions
@@ -21,7 +21,19 @@ """ from buttons import Button -from osc import osc +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): @@ -31,20 +43,21 @@ class Fader(Button): 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 - + 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.pos + @position.setter + def position(self, pos): + self.pos = pos + self.console.unit.strips[self.strip.num].set_position(pos) + def send_pos(self): - osc.send_message(self.addr, (self.strip, self.pos/1023)) + osc.client.sent_message(self.addr, (self.strip, self.pos/1023)) def handle_console_status(self, pos): if pos != self.pos: @@ -59,32 +72,3 @@ class Fader(Button): 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) - |
