Библиотека, как и в прошлые разы: Control Surface, которая превращает написание кода в сущую банальность. Код ниже по тексту...
Пайка, как бог на душу пошлёт, ну в смысле- последовательность особо не имеет значения, главное, потом промапить соответственно в вашей DAW.
Теперь , любимый VST управляется полностью с двух контроллеров. Я засел крутить себе неземные патчи, при этом не забывая их записывать в отдельную папку с пресетами. Придёт время, может куда то и выложу сей труд.
https://youtu.be/g336wUsinUM
КОД:
#include <Control_Surface.h>
#include "MIDIUSB.h"
USBMIDI_Interface midi;
using namespace MIDI_Notes;
CD74HC4067 muxPots = { A0, {2, 3, 4, 5},};
CD74HC4067 muxPots1 = { 6, {2, 3, 4, 5},};
CCPotentiometer potentiometer[] = {
{A1,{25, CHANNEL_7}},
{muxPots.pin(0),{26, CHANNEL_7}},
{muxPots.pin(1),{27, CHANNEL_7}},
{muxPots.pin(2),{28, CHANNEL_7}},
{muxPots.pin(3),{29, CHANNEL_7}},
{muxPots.pin(4),{30, CHANNEL_7}},
{muxPots.pin(5),{31, CHANNEL_7}},
{muxPots.pin(6),{32, CHANNEL_7}},
{muxPots.pin(7),{33, CHANNEL_7}},
{muxPots.pin(8),{34, CHANNEL_7}},
{muxPots.pin(9),{35, CHANNEL_7}},
{muxPots.pin(10),{36, CHANNEL_7}},
{muxPots.pin(11),{37, CHANNEL_7}},
{muxPots.pin(12),{38, CHANNEL_7}},
{muxPots.pin(13),{39, CHANNEL_7}},
{muxPots.pin(14),{40, CHANNEL_7}},
{muxPots.pin(15),{41, CHANNEL_7}},
};
NoteButton buttons[] = {
{muxPots1.pin(0),{note(C, 4), CHANNEL_1}},
{muxPots1.pin(1),{note(Db, 4), CHANNEL_1}},
{muxPots1.pin(2),{note(D, 4), CHANNEL_1}},
{muxPots1.pin(3),{note(Eb, 4), CHANNEL_1}},
{muxPots1.pin(4),{note(E, 4), CHANNEL_1}},
{muxPots1.pin(5),{note(F, 4), CHANNEL_1}},
{muxPots1.pin(6),{note(Gb, 4), CHANNEL_1}},
{muxPots1.pin(7),{note(G, 4), CHANNEL_1}},
{muxPots1.pin(8),{note(Ab, 4), CHANNEL_1}},
{muxPots1.pin(9),{note(A, 4), CHANNEL_1}},
{muxPots1.pin(10),{note(Bb, 4), CHANNEL_1}},
{muxPots1.pin(11),{note(B, 4), CHANNEL_1}},
{muxPots1.pin(12),{note(C, 5), CHANNEL_1}},
{muxPots1.pin(13),{note(Db, 5), CHANNEL_1}},
{muxPots1.pin(14),{note(D, 5), CHANNEL_1}},
{muxPots1.pin(15),{note(Eb, 4), CHANNEL_1}},
};
void setup() {
Control_Surface.begin(); // Initialize Control Surface
muxPots.begin();
muxPots1.begin();
}
void loop() {
Control_Surface.loop(); // Update the Control Surface
}