Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::format::au::MidiOutputCallbackPublisher Class Reference

Publishes the host's kAudioUnitProperty_MIDIOutputCallback pair from the main thread to the render thread. More...

#include <au_v2_common.hpp>

Classes

struct  Pair

Public Member Functions

OSStatus publish (const void *in_data, UInt32 in_data_size) noexcept
 Publish the pair carried by a kAudioUnitProperty_MIDIOutputCallback SetProperty payload.
OSStatus reflect (void *out_data) const noexcept
 Reflect the currently published pair into a AUMIDIOutputCallbackStruct for GetProperty.
const Pair * load () const noexcept
 Acquire-load the published pair, or nullptr when the host has installed none.

Detailed Description

Publishes the host's kAudioUnitProperty_MIDIOutputCallback pair from the main thread to the render thread.

The (callback, userData) pair is written by SetProperty on the main thread and read by the render thread every block. A plain two-pointer struct is a data race that can pair a fresh callback with a stale userData, so the pair is double-buffered: the writer fills the inactive slot then release-stores a pointer to it and flips the write cursor; the reader does a single acquire-load and therefore never observes a torn pair. "AU serializes property writes against render" is NOT relied on.

Member Function Documentation

◆ load()

const Pair * pulp::format::au::MidiOutputCallbackPublisher::load ( ) const
inlinenoexcept

Acquire-load the published pair, or nullptr when the host has installed none.

Render-thread entry point.

◆ publish()

OSStatus pulp::format::au::MidiOutputCallbackPublisher::publish ( const void * in_data,
UInt32 in_data_size )
noexcept

Publish the pair carried by a kAudioUnitProperty_MIDIOutputCallback SetProperty payload.

Returns kAudioUnitErr_InvalidPropertyValue for a null or undersized payload.

◆ reflect()

OSStatus pulp::format::au::MidiOutputCallbackPublisher::reflect ( void * out_data) const
noexcept

Reflect the currently published pair into a AUMIDIOutputCallbackStruct for GetProperty.


The documentation for this class was generated from the following file: