Hi, I am making a 4 button foot controller, with two banks. I would like to:
- assign a non linear list of note numbers to each bank
- set the midi channel for those notes
- assign a random velocity to each note
This code works, but I can't figure out how to assign the midi channel:
#include <Control_Surface.h> // Include the Control Surface library
USBMIDI_Interface midi;
const int NoteVals1 [] {
55,
51,
49,
47,
};
const int NoteVals2 [] {
59,
52,
48,
42,
};
// Instantiate 2 Banks
Bank<2> bank;
// Instantiate a Bank selector to control which one of the three Banks is active.
IncrementDecrementSelector<2> selector = {
bank, // Bank to manage
{15, 14}, // push button pins (increment, decrement)
Wrap::Clamp, // No Wrap
};
Bankable::ManyAddresses::NoteButton<2> myMultiFunctionNoteButton1 = {
bank,
6, // input pin
{
NoteVals1[0], // Controller Nº to use when 1st bank is selected
NoteVals2[0], // Controller Nº to use when 2nd bank is selected
},
};
Bankable::ManyAddresses::NoteButton<2> myMultiFunctionNoteButton2 = {
bank,
7, // input pin
{
NoteVals1[1],
NoteVals2[1],
},
};
Bankable::ManyAddresses::NoteButton<2> myMultiFunctionNoteButton3 = {
bank,
8, // input pin
{
NoteVals1[2],
NoteVals2[2],
},
};
Bankable::ManyAddresses::NoteButton<2> myMultiFunctionNoteButton4 = {
bank,
9, // input pin
{
NoteVals1[3],
NoteVals2[3],
},
};
void setup() {
Control_Surface.begin(); // Initialize Control Surface
}
void loop() {
Control_Surface.loop(); // Update the Control Surface
}
As far as assigning random velocities, I had this code working before I introduced ManyAddresses:
int rand1;
void setup() {
Control_Surface.begin(); // Initialize Control Surface
}
void loop() {
for (int i = 0; i < 4; i++) {
rand1 = random(80,115);
footButtons[i].setVelocity(rand1);
}
Control_Surface.loop(); // Update the Control Surface
}
But I can't figure out the syntax for assigning setVelocity() to items when ManyAddresses is used. Any help is appreciated!