예제 #1
0
def rec_handler(signum, frame):
    print('rec signal', signum)
    global signal_rec
    global signal_play
    if signal_play:
        print ("WARNING! still playing")
    else:
        if signal_rec == 0:
            signal_rec = 1
            #TODOupali diodu
            midiplay.dioda(midiout, recdioda, 100)
            pjesma = midiplay.midiin2list(midiin, 'in')
            midiplay.list2file(pjesma, 'novapjesma.txt')
        elif signal_rec == 1:
            signal_rec = 0
            #TODOugasi diodu
            midiplay.dioda(midiout, recdioda, 0)
            raise KeyboardInterrupt
예제 #2
0
def play_handler(signum, frame):
    print('play signal', signum)
    global signal_play
    global siganl_rec
    #TODOload pjesma on startup
    try:
        pjesma
    except NameError:
        pjesma = midiplay.file2list('novapjesma.txt')
    if signal_rec:
        print ("WARNING! still recording")
    else:
        if signal_play == 0:
            signal_play = 1
            #TODOupali diodu
            midiplay.dioda(midiout, playdioda, 100)
            signal_play = midiplay.list2midiout(midiout, pjesma)
            midiplay.dioda(midiout, playdioda, 0)
            #print("islo je")
        elif signal_play == 1:
            signal_play = 0
            midiplay.dioda(midiout, playdioda, 0)
            raise KeyboardInterrupt