midi: add debug support (print sent/receive if --debug is on)
This commit is contained in:
parent
8ca2e5a87e
commit
6401ee257f
2 changed files with 26 additions and 19 deletions
|
|
@ -6,10 +6,15 @@ import json as JSON
|
|||
|
||||
# python -> node communication
|
||||
|
||||
def ipcSend(data):
|
||||
print(JSON.dumps(data))
|
||||
def ipcSend(name, data):
|
||||
print(JSON.dumps([name, data]))
|
||||
stdout.flush()
|
||||
|
||||
# debug
|
||||
debug = False
|
||||
if 'debug' in argv:
|
||||
debug = True
|
||||
|
||||
# virtual midi port
|
||||
virtuals = []
|
||||
mididingsLoopbackPatch = []
|
||||
|
|
@ -105,9 +110,7 @@ if 'list' in argv:
|
|||
|
||||
message.append('============')
|
||||
|
||||
ipcSend({
|
||||
'log': '\n'.join(message)
|
||||
})
|
||||
ipcSend('log', '\n'.join(message))
|
||||
|
||||
|
||||
|
||||
|
|
@ -185,7 +188,10 @@ class MidiRouter(object):
|
|||
|
||||
if device in self.midiDevicesIn:
|
||||
|
||||
ipcSend({'osc':{
|
||||
if debug:
|
||||
ipcSend('log','MIDI received: %i %i %i \t(from: %s)' % (status, data1, data2, self.midiDevicesIn[device]))
|
||||
|
||||
ipcSend('osc',{
|
||||
'address': '/%s' % event,
|
||||
'args': [
|
||||
{
|
||||
|
|
@ -202,7 +208,7 @@ class MidiRouter(object):
|
|||
}
|
||||
],
|
||||
'target': ['midi:' + self.midiDevicesIn[device]]
|
||||
}})
|
||||
})
|
||||
|
||||
|
||||
def sendMidi(self, device, event, *args):
|
||||
|
|
@ -233,10 +239,8 @@ class MidiRouter(object):
|
|||
|
||||
if device in self.midiDevicesOut:
|
||||
self.dispatcher.send(status, data1, data2, 0, self.midiDevicesOut[device])
|
||||
|
||||
elif device == '*':
|
||||
self.dispatcher.send(status, data1, data2, 0, -1)
|
||||
|
||||
if debug:
|
||||
ipcSend('log','MIDI sent: %i %i %i \t(to: %s)' % (status, data1, data2, device))
|
||||
|
||||
|
||||
patch = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue