cs-midi-docs/docs/manual/05-input-elements/_index.md

56 lines
1.4 KiB
Markdown

# MIDI Input Elements
> Original: [MIDI input elements](https://tttapa.github.io/Control-Surface/Doxygen/df/d8b/group__MIDIInputElements.html)
Input elements receive MIDI messages and update stored values or drive hardware outputs.
## Value readers
| Class | Description |
|-------|-------------|
| `NoteValue` | Incoming Note velocity (8-bit) |
| `CCValue` | Incoming CC value (8-bit) |
| `KPValue` | Incoming Key Pressure (8-bit) |
| `PBValue` | Incoming Pitch Bend (14-bit) |
```cpp pico
CCValue vol {{MIDI_CC::Channel_Volume, Channel_1}};
// In loop: uint8_t v = vol.getValue();
```
## Range readers
| Class | Description |
|-------|-------------|
| `NoteRange<N>` | Array of N consecutive note values |
| `CCRange<N>` | Array of N consecutive CC values |
| `KPRange<N>` | Array of N consecutive key pressure values |
```cpp pico
CCRange<8> faders {{16, Channel_1}};
// faders.getValue(0) through faders.getValue(7)
```
## LED outputs
| Class | Description |
|-------|-------------|
| `NoteLED` | GPIO high on Note On, low on Note Off |
| `CCLED` | GPIO high when CC > 63 |
| `KPLED` | GPIO high when Key Pressure > 63 |
```cpp pico
NoteLED led {25, {MIDI_Notes::C[4], Channel_1}};
```
## Bankable variants
All input elements have bankable versions under `Bankable::`:
```cpp pico
Bank<4> bank(2);
Bankable::CCValue<4> bankCC {{bank, BankType::ChangeAddress}, {16, Channel_1}};
```
See [Banks and Selectors](../06-banks/) for details.