tttapa / Control-Surface

Arduino library for creating MIDI controllers and other MIDI devices.
GNU General Public License v3.0
1.26k stars 140 forks source link

Banks not working? #902

Open dchstudios opened 1 year ago

dchstudios commented 1 year ago

For some reason, I can't get any functionality out of trying to implement Banks. I have a bunch of different boards I have tried, mostly ESP32 variants, since my goal is to create a Bluetooth/Wireless DAW controller for Record/Rewind/Play type of Mackie Control ability. I get the Control Surface to work on other aspects, like general buttons and potentiometers no problem. But any attempt at trying say the IncrementDecrementSelector function, I do not get any change in the button/hardware MIDI signals.

For example, this simple code:


// board being used in this example: Adafruit Feather Huzzah32 ESP32
#include <Control_Surface.h> // Include the Control Surface library

// Instantiate a MIDI over USB interface
// USBMIDI_Interface midi;
// BluetoothMIDI_Interface midi;   // will be my in final code to use Bluetooth for an ESP32 board
HairlessMIDI_Interface midi;

// ------------------------------- Bank setup ------------------------------- //
// ========================================================================== //

/*
   Create a bank and a bank selector to change its setting.
*/
Bank<4> bank(1); // create a new bank with two tracks per bank
//   │       └───── number of tracks per bank
//   └───────────── number of banks

// Instantiate a Bank selector to control which one of the four Banks is active.
IncrementDecrementSelector<4> bankselector = {
    bank,       // Bank to manage
    {14, 32},     // push button pins (increment, decrement)
    Wrap::Wrap, // Wrap around
};

// -------------------------- MIDI Input Elements --------------------------- //
// ========================================================================== //

/*
   Define all elements that listen for MIDI messages.
*/

// Rec Ready 1
Bankable::NoteButton rec1 = {
  {bank, BankType::CHANGE_ADDRESS},
  15,
  {MCU::REC_RDY_1},
};

void setup() {
  RelativeCCSender::setMode(MACKIE_CONTROL_RELATIVE);
  Control_Surface.begin(); // Initialize Control Surface
}

void loop() {
  Control_Surface.loop(); // Update the Control Surface
}

and I will be able to see the button on pin 15 I'm using give serial MIDI signals like

Serial In: Ch1 Note 0 off velocity 127 Serial In: Ch1 Note 0 on velocity 127

but when pressing the buttons for increment and decrement, I will get no change in the above midi data. There is no MIDI signal that is sent through when I press the Increment and Decrement buttons either, though I don't know if there is supposed to be? I'm using Arduino 2.0.4 on a Windows 11, latest Control Surface Main. (and to note: the button/pins I'm using 14/32 for the increment/decrement, work as any other kind of Control Surface Button like NoteButton, so it's not wiring.)

boards I've tried:

OK thanks for ANY help!!! (I've been on off tackling this issue for months)

dchstudios commented 1 year ago

I think I solved it... Wiring issue on my buttons I was using for the Increment/Decrement Selector (newb error)... And now the code works with Banks as intended on my Adafruit Qt Py S3