Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
Note-ManyAddresses-Transposer.ino

Note-ManyAddresses-Transposer

Combining a transposer and a bank to switch between different scales.

namespace Bankable {
namespace ManyAddresses {
template <uint8_t NumAddr>
class ManyAddressBank {
public:
ManyAddressBank(const ManyAddresses<NumAddr> &manyaddresses,
: manyaddresses(manyaddresses), bank(bank) {}
void lock() { manyaddresses.lock(), bank.lock(); }
void unlock() { manyaddresses.unlock(), bank.unlock(); }
MIDIAddress getActiveAddress() const {
return manyaddresses.getActiveAddress() + bank.getAddressOffset();
}
private:
ManyAddresses<NumAddr> manyaddresses;
};
template <uint8_t NumAddr>
class ManyAddressBankNoteButton
: public MIDIButton<ManyAddressBank<NumAddr>, DigitalNoteSender> {
public:
ManyAddressBankNoteButton(const ManyAddresses<NumAddr> &manyaddresses,
OutputBankConfig<> bank, pin_t pin,
const DigitalNoteSender &sender {})
{manyaddresses, bank}, pin, sender) {}
};
} // namespace ManyAddresses
} // namespace Bankable
The main header file that includes all Control-Surface header files.
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
A struct for selecting the bank of BankableMIDIOutputs and the bank type.
Class that sends MIDI note on and off messages.
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
An abstract class for momentary push buttons that send MIDI events.
A base class for all MIDIOutputElements that can be banked.
A namespace for MIDI elements that can be added to a Bank, to change their address or channel.
#include "ManyAddressBankNoteButton.hpp"
// Transposer to go +1 to -1 octave
Transposer<-1, +1> transposer(12);
IncrementDecrementSelector<transposer.getNumberOfBanks()> transposeSelector {
transposer,
{A0, A1}, // Press push button A0 → +1 octave, A1 → -1 octave, A0+A1 → reset
};
// Bank to select first or second set of notes.
Bank<2> scaleBank;
scaleBank,
{A2, A3}, // Press push button A2 → second set of notes, A3 → first set
};
Bankable::ManyAddresses::ManyAddressBankNoteButton<2> buttons[] {
{
{scaleBank, {MIDI_Notes::F[4], MIDI_Notes::Gb[4]}},
transposer,
2, // pin
},
{
{scaleBank, {MIDI_Notes::C[4], MIDI_Notes::Db[4]}},
transposer,
3, // pin
},
{
{scaleBank, {MIDI_Notes::G[4], MIDI_Notes::Ab[4]}},
transposer,
4, // pin
},
// etc.
};
void setup() {
}
void loop() {
}
Control_Surface_ & Control_Surface
A predefined instance of the Control Surface to use in the Arduino sketches.
@ Clamp
When the maximum (minimum) setting is reached, clamp to the maximum (minimum) setting.
A class that groups Bankable MIDI Output Elements and Bankable MIDI Input Elements,...
Definition Bank.hpp:94
void begin()
Initialize the Control_Surface.
void loop()
Update all MIDI elements, send MIDI events and read MIDI input.
Selector with two buttons (one to increment, one to decrement).
Class for transposing the address of NoteButton and other MIDI elements.
A class for debug MIDI interfaces sending and receiving human-readable MIDI messages over the USB CDC...
constexpr Note Db
C♯, D♭ (Do sharp, Re flat)
Definition Notes.hpp:57
constexpr Note F
F (Fa)
Definition Notes.hpp:61
constexpr Note Gb
F♯, G♭ (Fa sharp, Sol flat)
Definition Notes.hpp:62
constexpr Note G
G (Sol)
Definition Notes.hpp:63
constexpr Note Ab
G♯, A♭ (Sol sharp, La flat)
Definition Notes.hpp:64
constexpr Note C
C (Do)
Definition Notes.hpp:56