midi: move python assets in src, add launcher context menu action for midi device listing

This commit is contained in:
jean-emmanuel 2019-03-19 10:41:26 +01:00
parent 32c717de6d
commit 5b7cdeccd5
10 changed files with 125 additions and 77 deletions

26
src/python/head.py Normal file
View file

@ -0,0 +1,26 @@
from sys import argv, stdin, stdout, version_info, version, exit
from binascii import hexlify, unhexlify
import traceback
import json as JSON
import re
def ipcSend(name, data):
print(JSON.dumps([name, data]))
stdout.flush()
try:
import rtmidi
API = rtmidi.RtMidiIn.UNIX_JACK if 'jack' in argv else rtmidi.RtMidiIn.UNSPECIFIED
JACK = API == rtmidi.RtMidiIn.UNIX_JACK
in_dev = rtmidi.RtMidiIn(API, 'MIDI->OSC probe')
out_dev = rtmidi.RtMidiOut(API, 'OSC->MIDI probe')
except:
ipcSend('error', 'pyrtmidi not found (or wrong version)\nRunning with python version %s' % version)
exit()
if version_info.major == 3:
raw_input = input
debug = False
if 'debug' in argv:
debug = True