Expanding A Midi Hardware Controller For Plugins

dear community,
i successfully built a hardware controller for the (music production) plugins Waves CLA 1176, CLA LA2A and Universal Audio API 2500.
Everything runs smooth under the "Control_Surface" on a Teensy 4.1.

Now i want to expand it even more and build a controller for the Distressor plugin.
I expanded the setup with a MCP23017 and got 6 more encoders running.
unfortunately i also need 3 buttons. And i have no clue how to make it work.
where can i find the little bit of code that makes the whole thing complete?
any ideas?
here is the code so far:


#include <Encoder.h> 
#include <Control_Surface.h> 
#include <AH/Hardware/MCP23017Encoders.hpp>
#include <Wire.h>

// Type for the MCP23017 encoders (translates encoder pulses to position)
using WireType = decltype(Wire); // The type of I²C driver to use
using EncoderPositionType = int32_t; // The type for saving encoder positions
constexpr bool IntSafe = true; // Make it safe to call `update` in an ISR
using MCPEncoderType = MCP23017Encoders<WireType, EncoderPositionType, IntSafe>;

// Type for the MIDI encoders (translates position to MIDI messages)
struct CCMCPEncoder : GenericMIDIRotaryEncoder<MCPEncoderType::MCP23017Encoder,
RelativeCCSender> {
CCMCPEncoder(MCPEncoderType::MCP23017Encoder enc, MIDIAddress address,
int16_t multiplier = 1, uint8_t pulsesPerStep = 4)
: GenericMIDIRotaryEncoder(std::move(enc), address, multiplier,
pulsesPerStep, {}) {}
};

USBMIDI_Interface midi;
using namespace MIDI_Notes;
const uint8_t interrupt_pin = 12;

// Create an object that manages the 6 encoders connected to the MCP23017.
MCPEncoderType enc {Wire, 0x0, interrupt_pin};
// │ │ └─ Interrupt pin
// │ └────── Address offset
// └──────────── I²C interface

// Instantiate 6 MIDI rotary encoders.
CCMCPEncoder ccencoders[] {
{
enc[0], // The encoder to use
MCU::V_POT_1, // The MIDI address
1, // Encoder speed multiplier
4, // Number of pulses per physical "click" of the encoder
},
{enc[1], MCU::V_POT_2},
{enc[2], MCU::V_POT_3},
{enc[3], MCU::V_POT_4},
{enc[4], MCU::V_POT_5},
{enc[5], MCU::V_POT_6},
};

// Further encoders connected directly to the Teensy 4.1 board
CCRotaryEncoder enc1 = {
{0, 1}, // 1176 1 Input
100, // MIDI address (CC number + optional channel)
4, // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc2 = {
{2, 3}, // 1176 2 Output
101, // MIDI address (CC number + optional channel)
4, // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc3 = {
{4, 5}, // 1176 3 Attack
102, // MIDI address (CC number + optional channel)
4, // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc4 = {
{6, 7}, // 1176 4 Release
103, // MIDI address (CC number + optional channel)
4, // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc5 = {
{8, 9}, // LA2A 1 Hi Freq
104, // MIDI address (CC number + optional channel)
4, // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc6 = {
{10, 11}, // LA2A 2 Gain
105, // MIDI address (CC number + optional channel)
4, // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc7 = {
{24, 25}, // LA2A 3 Peak Reduction
106, // MIDI address (CC number + optional channel)
4, // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc8 = {
{26, 27}, // 2500 1 Threshold
107, // MIDI address (CC number + optional channel)
4, // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc9 = {
{28, 29}, // 2500 2 Attack
108, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc10 = {
{30, 31}, // 2500 3 Ratio
109, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc11 = {
{32, 33}, // 2500 4 Release Position
110, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc12 = {
{34, 35}, // 2500 5 Release Fine
111, // MIDI address (CC number + optional channel)
4, // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc13 = {
{39, 40}, // 2500 6 Link
112, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc14 = {
{21, 22}, // 2500 7 Output Gain
113, // MIDI address (CC number + optional channel)
4, // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc15 = {
{17, 20}, // 2500 8 Mix
114, // 
4, // optional multiplier if the control isn't fast enough
};

// Instantiate a program changer with 8 programs
ProgramChanger<8> programChanger {
{
MIDI_PC::Acoustic_Grand_Piano, // list of programs
MIDI_PC::Bright_Acoustic_Piano,
MIDI_PC::Electric_Grand_Piano,
MIDI_PC::HonkyTonk_Piano,
MIDI_PC::Electric_Piano_1,
MIDI_PC::Electric_Piano_2,
MIDI_PC::Harpsichord,
MIDI_PC::Clavi,
},
Channel_2, // MIDI channel to use
};

// Instantiate a selector that reads 8 buttons and controls the program
// changer
ManyButtonsSelector<8> programSelector {
programChanger,
{{23, 36, 37, 38, 41, 15, 14, 16}},
};

void isr() {
enc.update(); // Read the state of the encoders and update the positions
}

void setup() {
Serial.begin(9600);
RelativeCCSender::setMode(relativeCCmode::MACKIE_CONTROL_RELATIVE);
Control_Surface.begin(); 
Wire.begin(); // Must be called before enc.begin()
Wire.setClock(800000);
enc.begin(); // Initialize the MCP23017
attachInterrupt(digitalPinToInterrupt(interrupt_pin), isr, LOW);
}

void loop() {
// No `enc.update()` here, updating the encoders happens inside of the ISR
Control_Surface.loop();
}


thank you very much for any help!

I doubt God knows. Most likely You have to make it Yourself. Searching for button code examples would help You with the buttons.
Example code, or code using MCP23017, could give help.

Encoder examples could give You tips.

Good. What controller is it?