Exemplo n.º 1
0
lp = Launchpad()

if DEBUG is True:
    il, ol = lp.getDeviceList()
    print("now available input is {}".format(il))
    print("now available output is {}".format(ol))
    print("inport is {}, outport is {}".format(midiInPort, midiOutPort))

result = lp.connect(midiInPort, midiOutPort)

if result is True:
    doloop = True
    while doloop:
        try:
            msg = lp.getMsg()
            if msg:
                key = str(msg['message'][0]) + str(msg['message'][1])
                try:
                    typeForAction, action = settings['action'][key].split(',')

                    if DEBUG is True:
                        print("key is in settings.ini")
                        print("type is {}, key is [{}], action is {}".format(
                            ACTION_TYPE[typeForAction], key, action))

                    #윈도우 키입력 신호 발생
                    if ACTION_TYPE[typeForAction] == "KEYIN":
                        PressKey(int(action, 0))
                        ReleaseKey(int(action, 0))