cs-midi-docs/docs/manual/01-getting-started/04-faq.md

54 lines
1.7 KiB
Markdown

# FAQ
> Original: [Frequently Asked Questions](https://tttapa.github.io/Control-Surface/Doxygen/da/dc1/FAQ.html)
## Can cs-midi be used as a general MIDI library?
Yes. You can use the MIDI interface objects directly for sending and receiving, without using the element system or `Control_Surface` singleton.
Sending:
```cpp pico
BluetoothMIDI_Interface midi;
int main() {
stdio_init_all();
if (cyw43_arch_init()) return 1;
midi.begin();
midi.sendNoteOn({MIDI_Notes::C[4], Channel_1}, 127);
midi.sendNoteOff({MIDI_Notes::C[4], Channel_1}, 127);
while (true) { midi.update(); sleep_ms(1); }
}
```
Receiving with callbacks:
```cpp pico
struct MyCallbacks : MIDI_Callbacks {
void onChannelMessage(MIDI_Interface &, ChannelMessage msg) override {
// handle msg
(void)msg;
}
} cb;
// in main(): midi.setCallbacks(cb);
```
## Can addresses or channels be changed at runtime?
Yes, through banks. A `Bank<N>` groups bankable elements and a selector controls which bank is active. See the [Banks](../../examples/04-banks/) examples.
## What's the difference from Control Surface?
cs-midi is a source-level extraction of Control Surface for pico-sdk. Key differences:
- `#include <cs_midi.h>` instead of `#include <Control_Surface.h>`
- Standard `main()` replaces Arduino `setup()`/`loop()`
- `cs::` namespace instead of top-level
- BTstack BLE backend instead of ArduinoBLE/Bluedroid
- No MCU protocol, displays, FastLED, or hardware expanders (yet)
## What radio modules are supported?
The BLE transport uses BTstack with the CYW43 radio. Only the **Infineon RM2** module has been tested. Other CYW43 variants may work but are unverified.