Commit c2e7f0e3 authored by Alyx's avatar Alyx
Browse files

Update player_functions.py

parent 960e2e86
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -35,12 +35,14 @@ def resetDevice(device_id,mode='GS'):
    if(mode=="GM"):
        statusmsg=f"Performing GM Reset"
        updateDisplay(str.encode(statusmsg))
        morbital.setDeviceLED(display,0,3)
        # send the sysex command for a GM Start to the synth using amidi
        subprocess.run(['amidi','-p',device_id,'-S','F07E7F0901F7'])
        print(fn_prefix+":Reset device to GM Mode")
    elif mode=="GS":
        statusmsg=f"Performing GS Reset"
        updateDisplay(str.encode(statusmsg))
        morbital.setDeviceLED(display,0,3)
        # send the sysex command for a GS Reset to the synth using amidi
        subprocess.run(['amidi','-p',device_id,'-S','F04110421240007F0041F7'])
        print(fn_prefix+": Reset device to GS Mode")
@@ -59,7 +61,7 @@ def playTrack(track_path,port):
        print(fn_prefix+": starting aplaymidi subprocess on file "+str(track_path))
        statusmsg=f"Playing: \n{track_path}"
        updateDisplay(str.encode(statusmsg))

        morbital.setDeviceLED(display,0,1)
        # Start the aplaymidi subprocess
        proc = subprocess.Popen(['aplaymidi', '--port', port, track_path],
                                stdout=subprocess.PIPE,
@@ -79,6 +81,7 @@ def playTrack(track_path,port):
            proc.terminate()
            print(fn_prefix+": Recieved stop command")
            statusmsg=f"Stopped: Finished playing"
            morbital.setDeviceLED(display,0,2)
            updateDisplay(str.encode(statusmsg))
            # send a GS reset to the synth
            resetDevice(findAMIDIDevice(),"GS")