Expand description
Real-time MIDI clock and I/O thread for oxurack.
oxurack-rt runs on a dedicated OS thread elevated to real-time
priority. It handles:
- Clock generation (master mode) at a configurable tempo, producing 24-PPQN MIDI clock ticks.
- Clock tracking (slave mode) using a PLL-based tempo estimator locked to an external MIDI clock source.
- Clock passthrough (passthrough mode) forwarding an external clock to output ports with optional multiplication/division.
- MIDI I/O via
midir, forwarding input messages to the ECS world and sending output messages on command. - Lock-free communication with the ECS world through bounded SPSC
queues (
rtrb).
§Architecture
┌────────────────────┐ rtrb queues ┌──────────────────┐
│ ECS world │◄═══ RtEvent ═══════►│ RT thread │
│ (RtHandles) │════ EcsCommand ════►│ (rt_thread_main) │
└────────────────────┘ └──────────────────┘The caller creates a Runtime via Runtime::start, receiving
RtHandles for queue access. Dropping the Runtime (or calling
Runtime::stop) shuts down the thread gracefully.
Modules§
- clock
- Clock subsystem: master clock generation, slave clock tracking, and shared scheduling types.
Structs§
- Midi
Input Config - Configuration for a MIDI input port connection.
- Midi
Output Config - Configuration for a MIDI output port connection.
- RtHandles
- The ECS-side handles for communicating with the RT thread.
- Runtime
- Handle to the running RT thread.
- Runtime
Config - Full configuration for starting the RT runtime.
Enums§
- Clock
Mode - Selects how the RT thread generates or tracks MIDI clock.
- EcsCommand
- A command sent from the ECS world to the RT thread.
- Error
- Errors that can occur during real-time MIDI operations.
- RtError
Code - Error codes for non-fatal conditions reported by the RT thread.
- RtEvent
- An event produced by the RT thread for consumption by the ECS world.
- Transport
Event - Transport state change events.
Functions§
- list_
midi_ input_ ports - Lists the names of all available MIDI input ports on the system.
- list_
midi_ output_ ports - Lists the names of all available MIDI output ports on the system.
Type Aliases§
- Midi
Message - A compact MIDI message representation.