Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
midi_control_bus.hpp File Reference

Lock-free publication of MIDI events from a UI control to the audio thread. More...

#include <pulp/midi/buffer.hpp>
#include <pulp/midi/message.hpp>
#include <pulp/runtime/spsc_queue.hpp>
#include <cstddef>
#include <cstdint>

Go to the source code of this file.

Classes

class  pulp::midi::MidiControlBus

Namespaces

namespace  pulp
namespace  pulp::midi

Detailed Description

Lock-free publication of MIDI events from a UI control to the audio thread.

A UI control that should emit MIDI (a pad that plays notes, a knob mapped to a CC) cannot touch the plugin's MIDI-out buffer directly — that buffer is filled on the audio thread inside process(). The UI thread send()s events into this bus; the audio thread drain()s them into midi_out at the top of the block. Single writer (UI), single reader (audio); never blocks either side and allocates nothing after construction.

Events arrive in the block they are drained in (sample offset 0). For a UI gesture that is the natural quantization — the event lands at the start of the next audio buffer.