Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::midi::BleMidiPacketDecoder Class Reference

Stateful decoder. More...

#include <ble_midi.hpp>

Public Types

using MessageCallback

Public Member Functions

void set_message_callback (MessageCallback cb)
bool decode (const uint8_t *data, std::size_t size)
 Feed one notification packet.
void reset ()
 Reset running status + the in-flight sysex buffer.

Detailed Description

Stateful decoder.

Feed BLE GATT notification bytes via decode(); each decoded MIDI message arrives on the registered callback with a millisecond timestamp reconstructed from the BLE packet header.

Member Typedef Documentation

◆ MessageCallback

Initial value:
std::function<void(const std::vector<uint8_t>& bytes,
uint32_t timestamp_ms)>

Member Function Documentation

◆ decode()

bool pulp::midi::BleMidiPacketDecoder::decode ( const uint8_t * data,
std::size_t size )

Feed one notification packet.

Returns true if the packet was well-formed (header + at least one timestamp byte + status). Malformed packets are dropped to satisfy spec section 3 — the decoder does not throw and recovers on the next packet.

◆ reset()

void pulp::midi::BleMidiPacketDecoder::reset ( )

Reset running status + the in-flight sysex buffer.

Call after a disconnect or when the host knows the stream has been interrupted (e.g. OS sleep/wake).

◆ set_message_callback()

void pulp::midi::BleMidiPacketDecoder::set_message_callback ( MessageCallback cb)
inline

The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/midi/include/pulp/midi/ble_midi.hpp