Five months ago, I started this topic here about the code for the midi controller I was building and got help especially from PieterP, who presented me the Control Surface library he maintains. After all of this months, I put all the hardware and enclosure together and started working on the code. I got the 16 button matrix working as I expected and managed to make the 8 pots working too, but not how I want. I would like to make them ready (predefined) to control a specific group of parameters in my daw as I plug the midi, just like the button matrix, instead of having to map them everytime I open the daw, how can I do that?.
The other thing Im having difficulties on making it work is the button ladder, I've tried I few things on the code without success and I don't understand what I need to do to make it work.
Any help would be much appreciated.
#include <Control_Surface.h> // Include the Control Surface library
USBMIDI_Interface midi; // Instantiate a MIDI over USB interface.
int RX1_PIN= 0;
int TX0_PIN= 1;
int BLUEL= A10;
//int BLUER= A10;
//int WHITE= A10;
//int GREEN= A10;
//int RED= A10;
//int YELLOW= A10;
// Transpose up to 2 octaves down or up (steps of 12 semitones = 1 octave)
Transposer<-2, +2> transposer{10};
// The note numbers corresponding to the buttons in the matrix
const AddressMatrix<4, 4> addresses = {{
{ 36, 37, 38, 39 },
{ 40, 41, 42, 43 },
{ 44, 45, 46, 47 },
{ 48, 49, 50, 51 },
}};
Bankable::NoteButtonMatrix<4, 4> buttonmatrix = {
transposer, // determines the offset
{5, 7, 14, 15}, // row pins
{3, 2, 0, 1}, // column pins
addresses, // address matrix
CHANNEL_1, // channel and cable number
};
// Instantiate a CCPotentiometer object
CCPotentiometer potentiometers[] = {
{A3, // Analog pin connected to potentiometer
{MIDI_CC::Channel_Volume, CHANNEL_1}}, // Channel volume of channel 1
{A2,
{MIDI_CC::General_Purpose_Controller_2, CHANNEL_2}},
{A1,
{MIDI_CC::General_Purpose_Controller_3, CHANNEL_3}},
{A0,
{MIDI_CC::General_Purpose_Controller_4, CHANNEL_4}},
{A9,
{MIDI_CC::General_Purpose_Controller_5, CHANNEL_5}},
{A8,
{MIDI_CC::General_Purpose_Controller_6, CHANNEL_6}},
{A7,
{MIDI_CC::General_Purpose_Controller_7, CHANNEL_7}},
{A6,
{MIDI_CC::General_Purpose_Controller_8, CHANNEL_8}},
};
//CCPotentiometer potentiometers[] = {
//{A3, 0X07},
//{A2, 0X08},
//{A1, 0X0A},
//{A0, 0X0C},
//{A9, 0X0D},
//{A8, 0X10},
//{A7, 0X11},
//{A6, 0X12},
//};
void setup() {
Control_Surface.begin(); // Initialize Control Surface
}
void loop() {
Control_Surface.loop(); // Update the Control Surface
//if (BLUEL) {
// You can set the transposition using transposer.select(i),
// where i is the index of the octave to select: i = 0 is
// the lowest octave (-2 in this case), i = 1 is the second
// octave (-1 here), i = 2 is the third octave (no transposition
// here) etc.
//transposer.select(-2); // selects transposition of -2
//}
//if (BLUER) {
//transposer.select (2);
//}
//Control_Surface.sendNoteOn(0x5E, 127); // default channel 1
//Control_Surface.sendNoteOff(0x5E, 127);
//Control_Surface.sendNoteOff({0x5E, CHANNEL_10}, 127); // specific channel
}