std :: audio::midi
Struct std::MidiIn
struct MidiIn {
int api_id;
?&struct MidiPortState_ impl;
}Fields
std-private; null when closed
Methods
static struct Result<MidiIn, AudioError> open(
int api,
const &char client_name,
unsigned long queue_bytes,
)source · definitionA client of 'api' (MIDI_API_UNSPECIFIED: midi_default_api()) named 'client_name' (what other programs see); 'queue_bytes' sizes the polling queue (0 = MIDI_DEFAULT_QUEUE_BYTES).
Connects to the index-th port; 'port_name' names our end.
Creates a port other programs can connect to.
generic<T: Send + Sync> void set_callback(fn void(&MidiEvent, ?&T) callback, ?&T user)source · definitionThe callback runs on the API's receiving thread, so T must be Send + Sync (as for Audio::open_stream).
Back to the polling queue.
Which message kinds to drop (non-zero = drop): sysex, clock/time code, active sensing.
Polling: copies the next queued message into 'buf' and returns its length (its timestamp into 'timestamp'); 0 when the queue is empty; -(length) when 'buf' is too small (the message stays queued).
Messages lost to a full queue or an oversized sysex.
= drop()