44 lines
1.1 KiB
Markdown
44 lines
1.1 KiB
Markdown
# Dual Transport (BLE + AppleMIDI)
|
|
|
|
BLE for direct iOS/macOS connection, AppleMIDI for DAW integration over WiFi.
|
|
Elements send to both transports simultaneously via pipe routing.
|
|
|
|
Build with `CS_MIDI_BLE=ON CS_MIDI_APPLEMIDI=ON`.
|
|
|
|
> **Note:** See the [AppleMIDI example](06-applemidi.md) for a reliability
|
|
> caveat on the WiFi transport. BLE remains the more reliable option on
|
|
> macOS/iOS.
|
|
|
|
```cpp pico
|
|
#include "pico/stdlib.h"
|
|
#include "pico/cyw43_arch.h"
|
|
#include <cs_midi.h>
|
|
|
|
using namespace cs;
|
|
|
|
BluetoothMIDI_Interface ble;
|
|
AppleMIDI_Interface applemidi {"PicoW-MIDI", 5004};
|
|
|
|
MIDI_PipeFactory<2> pipes;
|
|
|
|
NoteButton button {5, {MIDI_Notes::C[4], Channel_1}};
|
|
CCRotaryEncoder enc {{0, 2}, {16, Channel_1}, 1, 4};
|
|
|
|
int main() {
|
|
stdio_init_all();
|
|
if (cyw43_arch_init()) return 1;
|
|
|
|
cyw43_arch_enable_sta_mode();
|
|
cyw43_arch_wifi_connect_blocking("SSID", "PASS", CYW43_AUTH_WPA2_AES_PSK);
|
|
|
|
Control_Surface >> pipes >> ble;
|
|
Control_Surface >> pipes >> applemidi;
|
|
|
|
Control_Surface.begin();
|
|
while (true) {
|
|
Control_Surface.loop();
|
|
sleep_ms(1);
|
|
}
|
|
}
|
|
```
|