OPTIONS "C_CALL LABELCHECK NOSOURCE"
LIBRARY rexxgui, rxmidi
midierr = "ERROR"
midiheading = 1
IF guisay('This script changes all events upon MIDI channel 1 to MIDI channel 10. Proceed?', 'YES|INFO', 'New MIDI') \= 'YES' THEN SIGNAL out
IF ARG() < 1 THEN DO
ERROR = guifile('FromFilename', 'EXISTING', 'Enter a name for the new MIDI file', 'MIDI files (*.mid, *.rmi) | *.mid;*.rmi | All files (*.*) | *.*')
IF ERROR \== "" THEN RETURN
END
ELSE fromfilename = ARG(1)
DO
MIDIOpenFile(fromfilename)
DO WHILE MIDITrack("") \= 0
DO WHILE MIDIGetEvent('On N|Off |(Off|Afte|Cont|Prog|Poly|Pitc', '1|10') == ""
IF midievent.!channel == 10 THEN midievent.!channel = 1
ELSE midievent.!channel = 10
MIDISetEvent('CHAN')
END
END
NAME = FILESPEC('N', fromfilename)
PATH = LEFT(fromfilename, LENGTH(fromfilename) - LENGTH(name))
MIDISaveFile(PATH || '_' || name)
CATCH ERROR
CONDITION('M')
END
RETURN
|