Each Reaper track has a number of MIDI busses (128 in recent versions of Reaper, 16 in earlier ones — way more than you'll ever need). (See page 264 of the Reaper User Guide for 7.03.) When sending:
You can select a bus besides the normal channels.
And then you can select which bus a plugin gets its MIDI from:
JSFX
Here's a trivial JSFX that routes MIDI coming in on bus 0 to bus 1.
desc:jda midi inter bus route 1
@init
ext_midi_bus = 1.0;
@block
while(midirecv(offset,msg1,msg2,msg3)) (
midi_bus == 0 ? (
midi_bus = 1;
);
m = midi_bus;
midisend(offset,msg1,msg2,msg3);
);
Note that midi_bus counts from 0, yet the bus numbers in Reaper count from 1. Thus midi_bus = 1 selects MIDI bus 2.
Uses
We can take multichannel MIDI input to a track, and then based on the input channel we can use midi_bus = to send it to a bus that depends upon the channel (and even the velocity and pitch if we like). Then different plugins can be set to receive on different channels. There is no way to ordinarily tell a plugin which midi channel to listen on: it listens on all channels.