Skip to main content

Crate oscyl_midi

Crate oscyl_midi 

Source
Expand description

USB-MIDI transport for Oscyl synth drivers.

candidates picks the ports any registered driver (DRIVERS) claims; a Device drives one synth’s driver session over a Link: MidirLink for a real synth on desktop (feature midir: ALSA on Linux, CoreMIDI on macOS, WinMM on Windows; input arrives through midir’s callback as byte chunks and is framed into SysEx messages), PushLink on platforms that move the bytes themselves (Android, iOS), or SimLink for a simulated one. One thread can serve several devices at once.

Modules§

hotplug
Notice synths being plugged in or unplugged, from ALSA sequencer announcements (event-driven: the caller polls the file descriptors from its own main loop and calls PortWatcher::drain_changes when they are ready).
logue
The logue family’s own operations (user units, global and tuning data), which the driver contract does not model, for every logue driver: the minilogue xd and the prologue. A Device runs them between its driver session’s ops, pumped like them.

Structs§

Candidate
A port whose name matches a driver’s hint; not yet confirmed by the device inquiry (crate::Device::open does that).
Device
An open connection to one synth, through its driver’s session.
InputSender
The input end of a PushLink: the platform pushes received bytes (in any fragments) and closes it when the port goes away.
MidirLink
The real synth over midir (ALSA on Linux).
Opening
A synth being opened: the device inquiry is out, the answer awaited without blocking (Opening::poll from a pumping loop).
PushLink
Output through a closure; input pushed by the platform through the paired InputSender and framed into SysEx messages here.
SimLink
The simulated synth. Replies are computed when a message is sent and queued; receiving never waits.

Enums§

Error
Opened
Where an Opening stands.

Statics§

DRIVERS
Every driver this transport can find synths for.

Traits§

Link
A bidirectional SysEx connection to a synth.

Functions§

candidates
Every (port, driver) pair where the port’s name contains one of the driver’s hints, in port order.
driver
The registered driver with this oscyl_driver::Info::id.
list_ports
Names of all MIDI input and output ports, for diagnostics.
port_label
A port’s name as Oscyl spells it on every platform. Windows’ class driver names a device’s later ports “MIDIIN2 (minilogue xd)” and “MIDIOUT2 (minilogue xd)”; both become “minilogue xd _ MIDI 2”, the name such a port gets on Android (the mobile app’s midiPortName), so the input and output pair up and the drivers’ hints match.
run_all
Run every device’s queued ops at once in this thread, interleaved, until all are idle. on_event gets each event with its device’s index. The results hold transport errors per device (such a device stops; cancel it); op failures are SessionEvent::Failed events.
scan
Candidates among the connected ports that are both an input and an output.
wait
Block until bell rings or until passes (None: until it rings). Rings that piled up meanwhile are drained: their input is already queued for the next pump. Keep a sender of bell alive, or a None wait returns at once.