The Control Surface library I'm working on supports MIDI input, output and banks. Here's a simple example with 4 push buttons and 4 LEDs. Two more push buttons control the banks, and the active tracks are displayed on a 7-segment display:
[color=#5e6d03]#include[/color] [color=#434f54]<[/color][b][color=#d35400]Control_Surface[/color][/b][color=#434f54].[/color][color=#000000]h[/color][color=#434f54]>[/color]
[color=#434f54]// Create a seven segment display, connected to the SPI bus, with the load pin connected to pin 10[/color]
[b][color=#d35400]MAX7219SevenSegmentDisplay[/color][/b] [color=#d35400]display[/color] [color=#434f54]=[/color] [color=#000000]{[/color][color=#000000]10[/color][color=#000000]}[/color][color=#000000];[/color]
[color=#434f54]// A MIDI over USB interface[/color]
[b][color=#d35400]USBMIDI_Interface[/color][/b] [color=#00979c]midi[/color][color=#000000];[/color]
[color=#434f54]// Create a new bank with a total of 4 banks and with four tracks per bank[/color]
[b][color=#d35400]Bank[/color][/b][color=#434f54]<[/color][color=#000000]4[/color][color=#434f54]>[/color] [color=#000000]bank[/color][color=#000000]([/color][color=#000000]4[/color][color=#000000])[/color][color=#000000];[/color]
[color=#434f54]// Create a new bank selector with four bank settings that controls the bank above[/color]
[color=#434f54]// and with the increment button on pin A0 and the decrement button on pin A1[/color]
[b][color=#d35400]IncrementDecrementSelector[/color][/b][color=#434f54]<[/color][color=#000000]4[/color][color=#434f54]>[/color] [color=#000000]bankselector[/color] [color=#434f54]=[/color] [color=#000000]{[/color][color=#000000]bank[/color][color=#434f54],[/color] [color=#000000]{[/color][color=#000000]A0[/color][color=#434f54],[/color] [color=#000000]A1[/color][color=#000000]}[/color][color=#000000]}[/color][color=#000000];[/color]
[color=#434f54]// NoteButton reads state of a push button, sends out MIDI Note on/off events on the [/color]
[color=#434f54]// given address (MCU::REC_RDY_#) and channel (CHANNEL_1)[/color]
[b][color=#d35400]Bankable[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][b][color=#d35400]NoteButton[/color][/b] [color=#000000]buttons[/color][color=#000000][[/color][color=#000000]][/color] [color=#434f54]=[/color] [color=#000000]{[/color]
[color=#000000]{bank, 2, {[/color][b][color=#d35400]MCU[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][color=#00979c]REC_RDY_1[/color][color=#434f54],[/color] [color=#00979c]CHANNEL_1[/color][color=#000000]}},[/color] [color=#434f54]// push button connected between pin 2 and ground[/color]
[color=#000000]{bank, 3, {[/color][b][color=#d35400]MCU[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][color=#00979c]REC_RDY_2[/color][color=#434f54],[/color] [color=#00979c]CHANNEL_1[/color][color=#000000]}},[/color]
[color=#000000]{bank, 4, {[/color][b][color=#d35400]MCU[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][color=#00979c]REC_RDY_3[/color][color=#434f54],[/color] [color=#00979c]CHANNEL_1[/color][color=#000000]}},[/color]
[color=#000000]{bank, 5, {[/color][b][color=#d35400]MCU[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][color=#00979c]REC_RDY_4[/color][color=#434f54],[/color] [color=#00979c]CHANNEL_1[/color][color=#000000]}},[/color]
[color=#000000]}[/color][color=#000000];[/color]
[color=#434f54]// MIDINoteLED listens for MIDI Note on/off events on the given address (MCU::REC_RDY_#) [/color]
[color=#434f54]// and channel (CHANNEL_1) and turns on/off an LED accordingly[/color]
[b][color=#d35400]Bankable[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][b][color=#d35400]MIDINoteLED[/color][/b][color=#434f54]<[/color][color=#000000]4[/color][color=#434f54]>[/color] [color=#000000]leds[/color][color=#000000][[/color][color=#000000]][/color] [color=#434f54]=[/color] [color=#000000]{[/color]
[color=#000000]{bank, 6, {[/color][b][color=#d35400]MCU[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][color=#00979c]REC_RDY_1[/color][color=#434f54],[/color] [color=#00979c]CHANNEL_1[/color][color=#000000]}},[/color] [color=#434f54]// LED + resistor connected between pin 6 and ground[/color]
[color=#000000]{bank, 7, {[/color][b][color=#d35400]MCU[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][color=#00979c]REC_RDY_2[/color][color=#434f54],[/color] [color=#00979c]CHANNEL_1[/color][color=#000000]}},[/color]
[color=#000000]{bank, 8, {[/color][b][color=#d35400]MCU[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][color=#00979c]REC_RDY_3[/color][color=#434f54],[/color] [color=#00979c]CHANNEL_1[/color][color=#000000]}},[/color]
[color=#000000]{bank, 9, {[/color][b][color=#d35400]MCU[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][color=#00979c]REC_RDY_4[/color][color=#434f54],[/color] [color=#00979c]CHANNEL_1[/color][color=#000000]}},[/color]
[color=#000000]}[/color][color=#000000];[/color]
[color=#00979c]void[/color] [color=#5e6d03]setup[/color][color=#000000]([/color][color=#000000])[/color] [color=#000000]{[/color]
[b][color=#d35400]Control_Surface[/color][/b][color=#434f54].[/color][color=#d35400]begin[/color][color=#000000]([/color][color=#000000])[/color][color=#000000];[/color]
[color=#d35400]display[/color][color=#434f54].[/color][color=#d35400]begin[/color][color=#000000]([/color][color=#000000])[/color][color=#000000];[/color]
[color=#000000]}[/color]
[color=#00979c]void[/color] [color=#5e6d03]loop[/color][color=#000000]([/color][color=#000000])[/color] [color=#000000]{[/color]
[b][color=#d35400]Control_Surface[/color][/b][color=#434f54].[/color][color=#5e6d03]loop[/color][color=#000000]([/color][color=#000000])[/color][color=#000000];[/color]
[color=#434f54]// Print the tracks of the active bank[/color]
[color=#00979c]uint8_t[/color] [color=#000000]track[/color] [color=#434f54]=[/color] [color=#000000]bank[/color][color=#434f54].[/color][color=#d35400]getSelection[/color][color=#000000]([/color][color=#000000])[/color] [color=#434f54]*[/color] [color=#000000]bank[/color][color=#434f54].[/color][color=#d35400]getTracksPerBank[/color][color=#000000]([/color][color=#000000])[/color][color=#000000];[/color]
[color=#d35400]display[/color][color=#434f54].[/color][color=#d35400]display[/color][color=#000000]([/color][color=#000000]track[/color] [color=#434f54]+[/color] [color=#000000]1[/color][color=#434f54],[/color] [color=#000000]6[/color][color=#434f54],[/color] [color=#000000]7[/color][color=#000000])[/color][color=#000000];[/color] [color=#434f54]// first track of bank[/color]
[color=#d35400]display[/color][color=#434f54].[/color][color=#d35400]display[/color][color=#000000]([/color][color=#005c5f]"--"[/color][color=#434f54],[/color] [color=#000000]3[/color][color=#000000])[/color][color=#000000];[/color] [color=#434f54]// separator[/color]
[color=#d35400]display[/color][color=#434f54].[/color][color=#d35400]display[/color][color=#000000]([/color][color=#000000]track[/color] [color=#434f54]+[/color] [color=#000000]bank[/color][color=#434f54].[/color][color=#d35400]getTracksPerBank[/color][color=#000000]([/color][color=#000000])[/color][color=#434f54],[/color] [color=#000000]0[/color][color=#434f54],[/color] [color=#000000]1[/color][color=#000000])[/color][color=#000000];[/color] [color=#434f54]// last track of bank[/color]
[color=#000000]}[/color]
The hardest part is indeed getting feedback from Reaper. By default, it doesn't send any data to MIDI controllers.
If you select the Mackie Control Universal in Reaper (Preferences > Control/OSC/web), the code above works (with LEDs) for the first 8 tracks (that's all MCU supports). You could try using the MCU banks instead of the Control Surface banks.
Pieter