slider1:0<0,1,1{REC,PLAY Recorded}>Mode
in_pin:none
out_pin:none
@slider
(slider1 == 1 && play_state == 0 ) ? i = 0;output_msg_count=0;
(slider1 == 0 && play_state == 0 ) ? i = 0;output_msg_count=0;
@init
ext_noinit = 1;
//===RECORD INPUT MIDI===//
@block
sample_position = floor(srate*play_position + 0.5);
(play_state == 0 || sample_position<Last_Point || sample_position-Last_Point > 4*samplesblock) ?
(i = 0;output_msg_count=0;YYY=29;
Start_Point = sample_position;);
block_position = sample_position - Start_Point;
slider1 == 0 && play_state == 1 ?
(
while (midirecv(offset,msg1,msg2,msg3) )
(i==0 ? input_msg_count=0;
input_msg_count+=1;
buf[i] = block_position;
buf[i+1] = offset;
buf[i+2] = msg1;
buf[i+3] = msg2;
buf[i+4] = msg3;
i+=5;
midisend(offset,msg1,msg2,msg3);//Pass true
);
);
Last_Point = sample_position;
//=========PLAY Recorded MIDI===================
@sample
slider1 == 1 && output_msg_count<input_msg_count && (play_state == 1 || play_state == 5) ?
(
block_position == buf[i] ?
( midisend( buf[i+1],buf[i+2], buf[i+3],buf[i+4]);
output_msg_count+=1;
i+=5;
);
);
//===INFO ONLY===//
Y1 = buf[0]; Y2 = buf[1]; //Y3 = buf[3];
Y4 = buf[10]; Y5 = buf[11]; //Y6 = buf[13];
Y7 = buf[20]; Y8 = buf[21]; //Y9 = buf[23];
Y10 = buf[30]; Y11 = buf[31]; //Y12 = buf[33];