cs-midi-docs/docs/classes.md

271 lines
11 KiB
Markdown

# Class Reference
Cross-reference between cs-midi and the original [Control Surface](https://tttapa.github.io/Control-Surface/Doxygen/annotated.html) library.
## Ported Classes
These classes are available in cs-midi and work identically to their Control Surface equivalents (within the `cs::` namespace unless noted).
### MIDI Output Elements
| Class | Template | Description |
|-------|----------|-------------|
| `NoteButton` | | Note On/Off on button press/release |
| `NoteButtonLatched` | | Toggle Note On/Off on each press |
| `NoteButtonLatching` | | Note On while held, toggles |
| `NoteChordButton` | | Chord (multiple notes) on press |
| `NoteButtons` | `<N>` | Array of sequential note buttons |
| `NoteButtonMatrix` | `<R, C>` | Row/column scanned note grid |
| `CCButton` | | CC 127/0 on press/release |
| `CCButtonLatched` | | Toggle CC 127/0 on each press |
| `CCButtonLatching` | | CC 127 while held, toggles |
| `CCButtons` | `<N>` | Array of sequential CC buttons |
| `CCButtonMatrix` | `<R, C>` | Row/column scanned CC grid |
| `CCPotentiometer` | | Analog input to CC 0-127 |
| `PBPotentiometer` | | Analog input to 14-bit Pitch Bend |
| `CCRotaryEncoder` | | Relative CC from encoder |
| `BorrowedCCRotaryEncoder` | | Shared encoder reference for CC |
| `CCAbsoluteEncoder` | | Absolute CC from encoder position |
| `PBAbsoluteEncoder` | | 14-bit Pitch Bend from encoder |
| `CCIncrementDecrementButtons` | | Two buttons for CC inc/dec + reset |
| `PCButton` | | Program Change on press |
| `ProgramChanger` | `<N>` | Selectable program change list |
### MIDI Input Elements
| Class | Template | Description |
|-------|----------|-------------|
| `NoteValue` | | Incoming Note value (8-bit) |
| `CCValue` | | Incoming CC value (8-bit) |
| `KPValue` | | Incoming Key Pressure value (8-bit) |
| `PBValue` | | Incoming Pitch Bend value (14-bit) |
| `NoteRange` | `<Len>` | Array of incoming Note values |
| `CCRange` | `<Len>` | Array of incoming CC values |
| `KPRange` | `<Len>` | Array of incoming Key Pressure values |
| `NoteLED` | | LED driven by Note On/Off |
| `CCLED` | | LED driven by CC value |
| `KPLED` | | LED driven by Key Pressure |
### Bankable Input Elements
| Class | Template | Description |
|-------|----------|-------------|
| `Bankable::NoteValue` | `<BankSize>` | Bank-switched Note value |
| `Bankable::CCValue` | `<BankSize>` | Bank-switched CC value |
| `Bankable::KPValue` | `<BankSize>` | Bank-switched Key Pressure value |
| `Bankable::PBValue` | `<BankSize>` | Bank-switched Pitch Bend value |
| `Bankable::NoteLED` | `<BankSize>` | Bank-switched Note LED |
| `Bankable::CCLED` | `<BankSize>` | Bank-switched CC LED |
| `Bankable::KPLED` | `<BankSize>` | Bank-switched Key Pressure LED |
| `Bankable::NoteRange` | `<BankSize, Len>` | Bank-switched Note range |
| `Bankable::CCRange` | `<BankSize, Len>` | Bank-switched CC range |
| `Bankable::KPRange` | `<BankSize, Len>` | Bank-switched Key Pressure range |
### Banks and Selectors
| Class | Template | Description |
|-------|----------|-------------|
| `Bank` | `<N>` | N-setting bank for bankable elements |
| `Transposer` | `<Min, Max>` | Note transposition bank |
| `OutputBank` | | Bank for output elements |
| `EncoderSelector` | `<N>` | Bank selection via rotary encoder |
| `IncrementSelector` | `<N>` | Bank selection via single button |
| `IncrementDecrementSelector` | `<N>` | Bank selection via two buttons |
| `ManyButtonsSelector` | `<N>` | Bank selection via N buttons |
| `SwitchSelector` | | Two-state selector from switch |
| `ProgramChangeSelector` | `<N>` | Bank selection via incoming MIDI PC |
| `EncoderSelectorLEDs` | `<N>` | EncoderSelector with LED indicators |
| `IncrementSelectorLEDs` | `<N>` | IncrementSelector with LED indicators |
| `IncrementDecrementSelectorLEDs` | `<N>` | IncrementDecrementSelector with LEDs |
| `ManyButtonsSelectorLEDs` | `<N>` | ManyButtonsSelector with LEDs |
| `SwitchSelectorLED` | | SwitchSelector with LED |
| `ProgramChangeSelectorLEDs` | `<N>` | ProgramChangeSelector with LEDs |
### MIDI Interfaces
| Class | Template | Description |
|-------|----------|-------------|
| `BluetoothMIDI_Interface` | | BLE MIDI via BTstack |
| `USBMIDI_Interface` | | USB MIDI device via TinyUSB |
| `HardwareSerialMIDI_Interface` | | 5-pin DIN MIDI over UART |
| `AppleMIDI_Interface` | | RTP-MIDI over WiFi (AppleMIDI/Bonjour) |
### MIDI Routing
| Class | Template | Description |
|-------|----------|-------------|
| `MIDI_Pipe` | | Connects a MIDI source to a sink |
| `MIDI_PipeFactory` | `<N>` | Creates N unidirectional pipes |
| `BidirectionalMIDI_PipeFactory` | `<N>` | Creates N bidirectional pipes |
| `MIDI_Sink` | | Base class for MIDI receivers |
| `MIDI_Source` | | Base class for MIDI senders |
### Hardware Utilities (`AH::` namespace)
| Class | Template | Description |
|-------|----------|-------------|
| `Button` | | Debounced button with state machine |
| `IncrementButton` | | Button with auto-repeat |
| `IncrementDecrementButtons` | | Button pair with auto-repeat |
| `ButtonMatrix` | `<R, C>` | Row/column button scanner |
| `GenericFilteredAnalog` | `<...>` | EMA-filtered analog input with hysteresis |
| `FilteredAnalog` | | Concrete filtered analog (10-bit, no mapping) |
| `AHEncoder` | | Interrupt-driven quadrature encoder |
### Infrastructure
| Class | Description |
|-------|-------------|
| `Control_Surface_` | Singleton coordinating all elements (`Control_Surface.begin()` / `.loop()`) |
| `MIDIAddress` | Note/CC address with channel and cable |
| `MIDIChannelCable` | Channel + cable pair |
| `RelativeMIDIAddress` | Relative address offset |
| `Channel` | MIDI channel (1-16) |
| `Cable` | MIDI cable number |
| `DigitalCCSender` | Sends CC 0/127 |
| `ContinuousCCSender` | Sends CC 0-127 |
| `ContinuousCCSender14` | Sends 14-bit CC |
| `DigitalNoteSender` | Sends Note On/Off |
| `RelativeCCSender` | Sends relative CC (Mackie, etc.) |
| `PitchBendSender` | Sends Pitch Bend |
| `ProgramChangeSender` | Sends Program Change |
---
## Not Yet Ported
These classes exist in the original Control Surface but are not yet available in cs-midi.
### Bankable Output Elements
The entire bankable output layer (Phase 11) has not been extracted. This includes bank-switched versions of every output element.
| Class | Original | Priority |
|-------|----------|----------|
| `Bankable::NoteButton` | Bankable note button | High |
| `Bankable::CCButton` | Bankable CC button | High |
| `Bankable::CCPotentiometer` | Bankable CC pot | High |
| `Bankable::CCRotaryEncoder` | Bankable CC encoder | High |
| `Bankable::CCAbsoluteEncoder` | Bankable absolute encoder | Medium |
| `Bankable::PBAbsoluteEncoder` | Bankable PB encoder | Medium |
| `Bankable::PBPotentiometer` | Bankable PB pot | Medium |
| `Bankable::PCButton` | Bankable program change button | Medium |
| `Bankable::NoteButtonLatched` | Bankable latched note | Low |
| `Bankable::NoteButtonLatching` | Bankable latching note | Low |
| `Bankable::CCButtonLatched` | Bankable latched CC | Low |
| `Bankable::CCButtonLatching` | Bankable latching CC | Low |
| `Bankable::NoteButtons` | Bankable note button array | Low |
| `Bankable::CCButtons` | Bankable CC button array | Low |
| `Bankable::NoteButtonMatrix` | Bankable note matrix | Low |
| `Bankable::CCButtonMatrix` | Bankable CC matrix | Low |
| `Bankable::NoteChordButton` | Bankable chord button | Low |
| `Bankable::CCIncrementDecrementButtons` | Bankable inc/dec | Low |
| `Bankable::CCSmartPotentiometer` | Smart pot (avoids bank-switch jumps) | Medium |
| `Bankable::PBSmartPotentiometer` | Smart PB pot | Medium |
### Bankable ManyAddresses Output Elements
Per-bank explicit address lists (alternative to offset-based banking).
| Class | Original |
|-------|----------|
| `Bankable::ManyAddresses::NoteButton` | Per-bank note addresses |
| `Bankable::ManyAddresses::CCButton` | Per-bank CC addresses |
| `Bankable::ManyAddresses::CCPotentiometer` | Per-bank CC pot addresses |
| `Bankable::ManyAddresses::CCRotaryEncoder` | Per-bank CC encoder addresses |
| `Bankable::ManyAddresses::CCAbsoluteEncoder` | Per-bank absolute encoder addresses |
| `Bankable::ManyAddresses::PBAbsoluteEncoder` | Per-bank PB encoder addresses |
| `Bankable::ManyAddresses::PBPotentiometer` | Per-bank PB pot addresses |
| `Bankable::ManyAddresses::PCButton` | Per-bank PC addresses |
| `Bankable::ManyAddresses::NoteButtonMatrix` | Per-bank note matrix |
| `Bankable::ManyAddresses::CCButtonMatrix` | Per-bank CC matrix |
| `Bankable::ManyAddresses::CCIncrementDecrementButtons` | Per-bank inc/dec |
### MCU (Mackie Control Universal)
Full Mackie Control protocol support — VU meters, V-Pots, LCD, time display, etc.
| Class | Description |
|-------|-------------|
| `MCU::VU` | VU meter input element |
| `MCU::VULEDs` | VU meter with LED output |
| `MCU::VPotRing` | V-Pot ring value reader |
| `MCU::VPotRingLEDs` | V-Pot ring with LED output |
| `MCU::LCD` | 112-char LCD display reader |
| `MCU::SevenSegmentDisplay` | 7-segment display driver |
| `MCU::TimeDisplay` | Time code display |
| `MCU::AssignmentDisplay` | Assignment display |
| `MCU::Bankable::VU` | Bankable VU meter |
| `MCU::Bankable::VULEDs` | Bankable VU with LEDs |
| `MCU::Bankable::VPotRing` | Bankable V-Pot ring |
| `MCU::Bankable::VPotRingLEDs` | Bankable V-Pot ring with LEDs |
### USB MIDI
| Class | Description |
|-------|-------------|
| `USBHostMIDI_Interface` | USB Host MIDI interface |
| `GenericUSBMIDI_Interface` | Configurable USB MIDI backend |
| `USBDebugMIDI_Interface` | Serial monitor debug output |
### Serial MIDI
| Class | Description |
|-------|-------------|
| `SoftwareSerialMIDI_Interface` | Software serial MIDI |
| `HairlessMIDI_Interface` | Hairless MIDI serial bridge |
### LED Bars and PWM
| Class | Description |
|-------|-------------|
| `NoteCCKPLEDBar` | LED bar graph driven by MIDI |
| `NoteCCKPLEDPWM` | PWM LED brightness by velocity |
| `Bankable::NoteCCKPLEDBar` | Bankable LED bar |
| `Bankable::NoteCCKPLEDPWM` | Bankable PWM LED |
### FastLED (Addressable LEDs)
| Class | Description |
|-------|-------------|
| `NoteCCKPRangeFastLED` | Addressable LED strip driven by MIDI |
| `Bankable::NoteCCKPRangeFastLED` | Bankable variant |
### Extended I/O Hardware
| Class | Description |
|-------|-------------|
| `AH::AnalogMultiplex` | CD74HC4067 / CD74HC4051 multiplexer |
| `AH::ShiftRegisterOut` | 74HC595 shift register output |
| `AH::SPIShiftRegisterOut` | SPI-based shift register |
| `AH::ShiftRegisterOutRGB` | RGB LED shift register |
| `AH::MAX7219` | MAX7219 LED driver |
| `AH::MAX7219SevenSegmentDisplay` | MAX7219 7-segment display |
| `AH::LEDs` | Array of simple LEDs |
| `AH::DotBarDisplayLEDs` | Dot/bar mode LED array |
| `AH::MultiPurposeButton` | Long press / double press detection |
| `AH::RegisterEncoders` | Multiple encoders via registers |
### Display
| Class | Description |
|-------|-------------|
| `DisplayElement` | Base for on-screen elements |
| `DisplayInterface` | Abstract display driver |
| `SSD1306_DisplayInterface` | SSD1306 OLED driver |
| `BitmapDisplay` | Bitmap rendering on display |
### Audio
| Class | Description |
|-------|-------------|
| `AudioVU` | Audio level analysis |
| `AudioVULEDs` | Audio VU with LED output |
| `VolumeControl` | Audio volume knob |
### Motor Fader
| Class | Description |
|-------|-------------|
| `MotorFader` | Motorized fader with touch sense |