/* RexxEdit example ARexx macro program */ /* Copy and/or transpose notes with rechannalizing */ options results /* always include this command */ MxMIRROR "Transposition:,64" /* -64 to 64 slider */ MXSLIDER "New Channel:,1,16,1" /* 1 to 16 slider */ MXRADIO "Selected Notes,All Notes" /* mutually exclusive options */ MXBUTTON "Delete Original Notes" /* an option */ MXREQUEST "COPY & TRANSPOSE NOTES,DO IT" /* put up requester and wait */ if result == 0 then exit /* 0 if user hit CANCEL */ MXPOINTER "sleepy" /* indicate we're working on it */ MXVALUE 1 /* get delta note value */ noteval = result MXVALUE 2 /* get channel number (0-15) */ chan = result - 1 MXVALUE 4 /* did they want to replace it? */ replace = result MXVALUE 3 /* selected or all events */ if result == 0 then BEGINSCAN 'selected' else BEGINSCAN 'all' /* begin event scan */ if result ~= 0 then do forever /* if BEGINSCAN worked, scan */ NEXTEVENT /* get next event */ if result == 0 then break if EVENT.TYPE == 'NOTE' then do /* if a NOTE, modify it */ newval = EVENT.NUM + noteval if newval < 0 then newval = newval + 128 if newval > 127 then newval = newval - 128 EVENT.NUM = newval EVENT.CHANNEL = chan if replace == 1 then REPLEVENT /* either replace or add event */ else ADDEVENT end end ENDSCAN /* terminate scan */ MXPOINTER "normal" /* we're all done */