This page documents input/output MIDI transport and scheduling used by the UI/controller stack.
MidiInputHandler)Defined in JUCE/SmartGridOne/Source/MidiHandlers.hpp.
SmartGrid::BasicMidi with microsecond timestamps.m_routeId) so downstream routing is explicit.AttemptConnect) from saved config.Integrations subclass SendMessage(BasicMidi) to forward into their MessageInBus.
MidiOutputHandler)Also in MidiHandlers.hpp.
SpinLock.m_shape) and route ID.Reset() and Process() implementations.SendMessageNow),sendBlockOfMessages) for buffered paths.MidiSender realtime dispatcherDefined in JUCE/SmartGridOne/Source/MidiSender.hpp.
Key structure:
startRealtimeThread) with tight scheduling params.CircularQueue<BasicMidi, 16384>.MidiOutputHandler* m_outputHandlers[16].Core behaviors:
AllocateRoute(handler) assigns route IDs and binds handlers.SendMessage(msg, routeId) enqueues timestamped output.HandleMessage() peeks queue head and sends only when target wall-clock time is reached:
targetTimeMs = msgTimestampMs + x_latencyMs.Shutdown() enables controlled draining behavior.ProcessMessagesOut(MessageOutBuffer&, timestamp) converts sequencer transport events to MIDI real-time messages on m_clockRouteId:
This decouples transport timing from controller rendering traffic.