desc:MIDI note hold

slider1:0<0,16,1>channel

@init
held=-1;

@slider
chan=slider1|0;

@block

while (
  midirecv(ts,msg,msg23) ? (
     (msg&$xf) == chan && (msg&$xe0)==$x80 ? (
        vel = (msg23/256)&$xff;
        (msg&16) && vel ? 
        (
          held >= 0 ? midisend(ts,$x80 + chan, held);
          held = msg23&$xff;
          midisend(ts,$x90+chan,held + (vel*256));
        );
     ) : (
       midisend(ts,msg,msg23);
     );

     1; // always loop if received msg
  );
);
