Add BLE MIDI transport (feature_bluetooth)
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include "midi_transport.h"
|
||||
|
||||
class BleMidiTransport {
|
||||
public:
|
||||
BleMidiTransport();
|
||||
~BleMidiTransport();
|
||||
|
||||
bool begin();
|
||||
void update();
|
||||
|
||||
void on_midi_receive(std::function<void(const MidiEvent&)> callback);
|
||||
|
||||
void send_note_on(uint8_t channel, uint8_t note, uint8_t velocity);
|
||||
void send_note_off(uint8_t channel, uint8_t note, uint8_t velocity);
|
||||
void send_cc(uint8_t channel, uint8_t cc, uint8_t value);
|
||||
|
||||
bool is_connected();
|
||||
|
||||
private:
|
||||
std::function<void(const MidiEvent&)> receive_callback;
|
||||
bool initialized;
|
||||
bool client_connected;
|
||||
|
||||
void send_midi_packet(const uint8_t* data, uint8_t len);
|
||||
void on_receive(const uint8_t* data, size_t len);
|
||||
size_t parse_ble_midi(uint8_t status, const uint8_t* data, size_t len, size_t offset, MidiEvent& event);
|
||||
};
|
||||
Reference in New Issue
Block a user