/******************************************************************************* * Copyright 2021 Rafa * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License (http://www.gnu.org/licenses/)for more details. * *******************************************************************************/ desc:Playback sends MIDI note C0 desc:Playback sends MIDI note C0 [Rafa] //tags: playback midi Redux //author: Rafa slider1:0<0,15,1{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}>MIDI channel slider2:1<0,1,1{Off, On}>Drop MIDI Channel Notes //////////////////////////////////////////////////////////////////////////////// @init channel=slider1; filter=slider2; doSend=1; // init is always called before playback function bypass_notes_on_channel() local (has, offset, b1, b2, b3, op, msg_chnl) ( while ( has = midirecv (offset, b1, b2, b3); has ? ( op = (b1 / 16) | 0; msg_chnl = (b1 % 16) | 0; msg_chnl != channel || (op != 9 && op != 8) ? ( // 9 = NoteOn, 8 = NoteOff midisend (offset, b1, b2, b3); ); ); has; ); ); @block dosend ? ( midisend (0, 144 + channel, 0, 127); // Note ON (0x90 + chnl), Note 0, vel 127 midisend (0, 128 + channel, 0, 127); // Note OFF (0x80 + chnl), Note 0, vel 127 ); dosend = 0; filter ? (bypass_notes_on_channel());