Control Surface
1.1.1
MIDI Control Surface library for Arduino
Encoder-Selector-Bank.ino
Encoder-Selector-Bank
https://github.com/tttapa/Control-Surface/issues/66
#include <Encoder.h>
// Encoder must be included before Control Surface
#include <
Control_Surface.h
>
// MIDI Interface to use
USBMIDI_Interface
midi;
// Bank with 120 settings in total, increments of 1 address at a time
Bank<120>
bank = {1};
// A rotary encoder to select one of the 120 bank settings
EncoderSelector<120>
selector = {
bank,
// bank to manage
{2, 3},
// encoder pins
4,
// encoder pulses per step
Wrap::Clamp
,
// clamp or wrap around when going beyond maximum/minimum setting
};
// The potentiometer that sends MIDI messages
// the address (controller number) depends on the bank setting
Bankable::CCPotentiometer
potentiometer = {
{bank,
BankType::CHANGE_ADDRESS
},
// Bank configuration
A0,
// Analog pin for potentiometer
{0x00,
CHANNEL_1
},
// Base CC address
};
void
setup() {
Control_Surface
.
begin
();
}
void
loop() {
Control_Surface
.
loop
();
// You can get the bank number using:
// bank.getSelection();
}
USBMIDI_Interface
A class for MIDI interfaces sending MIDI messages over a USB MIDI connection.
Definition:
USBMIDI_Interface.hpp:35
Bank
A class that groups Bankable BankableMIDIOutputs and BankableMIDIInputs, and allows the user to chang...
Definition:
Bank.hpp:77
Control_Surface.h
The main header file that includes all Control-Surface header files.
Bankable::CCPotentiometer
A class of MIDIOutputElements that read the analog input from a potentiometer or fader,...
Definition:
Bankable/CCPotentiometer.hpp:22
Control_Surface_::loop
void loop()
Update all MIDI elements, send MIDI events and read MIDI input.
Definition:
Control_Surface_Class.cpp:48
Control_Surface
Control_Surface_ & Control_Surface
A predefined instance of the Control Surface to use in the Arduino sketches.
Definition:
Control_Surface_Class.cpp:176
EncoderSelector
Selector that reads from a rotary encoder.
Definition:
EncoderSelector.hpp:78
CHANGE_ADDRESS
Change the offset of the address (i.e.
Definition:
BankConfig.hpp:17
Wrap::Clamp
When the maximum (minimum) setting is reached, clamp to the maximum (minimum) setting.
CHANNEL_1
constexpr Channel CHANNEL_1
Definition:
Channel.hpp:111
Control_Surface_::begin
void begin()
Initialize the Control_Surface.
Definition:
Control_Surface_Class.cpp:25
Generated by
1.8.16