Skip to content

Commit

Permalink
tweaks after testing with capture device
Browse files Browse the repository at this point in the history
  • Loading branch information
Casey Tucker committed Mar 15, 2024
1 parent f6d7ab6 commit aba7cda
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bridge/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def check_connections(client, port):
pass

capture.disconnect()
log("Done.")
view.cursor_release()

if __name__ == '__main__':
main()
14 changes: 7 additions & 7 deletions bridge/capture.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from time import sleep
from view import log
from bindings.capmix import capmix, Type

Expand All @@ -7,8 +8,7 @@ def __init__(self, name='STUDIO-CAPTURE MIDI 2'):
self.name = name
self.ok = False

@classmethod
def listener(cls, event):
def listener(self, event):
value = event.value()
self.model.set_cache(event.addr, value)

Expand All @@ -19,27 +19,27 @@ def listener(cls, event):
ch = ((event.addr & 0x0f00) >> 8) + 1
mon = self.model.monitors[(event.addr & 0xf000) >> 12]
mute = value.unpacked.discrete
mutes[ch][mon] = mute
self.model.mutes[ch][mon] = mute
#self.model.queue.put([ord(mon) - ord('a'), ch, 0 if mute == 0 else 127])
if mon == 'd':
# TODO may not be needed
self.model.queue.put([int((ch-1)/2), 82, 0 if mute == 0 else 127])
elif '.stereo' in addr:
ch = ((event.addr & 0x0f00) >> 8) + 1
stereo[ch] = value.unpacked.discrete
self.model.stereo[ch] = value.unpacked.discrete
elif '.pan' in addr:
ch = ((event.addr & 0x0f00) >> 8) + 1
pans[ch] = value #capmix.format_type(Type.Pan, value.unpacked) #.unpacked.discrete >> 24
self.model.pans[ch] = value #capmix.format_type(Type.Pan, value.unpacked) #.unpacked.discrete >> 24

#log("addr=%x=%s type=%s v=%s" % (event.addr, addr, event.type_name(), value))

def connect(self):
self.ok = capmix.connect(Capture.listener)
self.ok = capmix.connect(self.listener)
if not self.ok:
log("Unable to connect to STUDIO-CAPTURE")
return False
self.view.dim(False)
time.sleep(1)
sleep(1)
self.get_mixer_data()
self.ok = True
return True
Expand Down
5 changes: 4 additions & 1 deletion bridge/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@ def print_pan(self, ch):

#size = os.get_terminal_size()
def cursor_to_log(self):
height = 17 if not self.compact else 9
height = 17 if not self.compact else 10
print("\033[%d;%dr\033[%d;1f\033[?25h" % (height, self.size.lines, self.size.lines-1))

def cursor_release(self):
print("\n\033[r\033[%d;1f\033[?25h" % (self.size.lines), end='')

def print_monitor_mutes(self):
compact = self.compact
#print("\033[r",end='')
Expand Down

0 comments on commit aba7cda

Please sign in to comment.