CsoundUnity 4.0.0-alpha.3
Loading...
Searching...
No Matches
Csound.Unity.CsoundBridgeRegistry Class Reference

Shared static registry of Csound bridges for the IAudioGenerator path. More...

Static Package Functions

static int Register (CsoundUnityBridge bridge)
 Registers a bridge (and an optional command queue) and returns the stable integer ID that CsoundRealtime.InstanceId and CsoundControl.InstanceId must store.
static void Unregister (int id)
 Nulls out the slot at id so that any in-flight audio-thread call to GetBridge returns null (→ silence) after teardown. Does not shrink the lists; IDs remain stable.
static void RegisterSpinFillCallback (int id, System.Action< int > callback)
 Registers an action to be called before each PerformKsmps for instance id . The int argument is the buffer-frame offset at which the new ksmps block begins.
static void InvokeSpinFillCallback (int id, int bufferFrameOffset)
 Invoked by CsoundRealtime on the audio thread immediately before each PerformKsmps.
static void RegisterKsmpsCallback (int id, System.Action< int > callback)
 Registers an action to be called after each PerformKsmps for instance id . The int argument is the buffer-frame offset at which the new ksmps block begins.
static void InvokeKsmpsCallback (int id, int bufferFrameOffset)
 Invoked by CsoundRealtime on the audio thread after each successful PerformKsmps.
static void RegisterPerformanceFinishedCallback (int id, System.Action callback)
static void InvokePerformanceFinishedCallback (int id)
static CsoundUnityBridge GetBridge (int id)
 Returns the bridge at id , or null if not found.

Detailed Description

Shared static registry of Csound bridges for the IAudioGenerator path.

CsoundUnity registers its bridge here, on the AudioPath.IAudioGenerator and AudioPath.RootOutput paths, so that the fully unmanaged CsoundRealtime and CsoundRootRealtime structs can resolve it by integer index on the audio thread, without holding any managed references themselves.

Slots are never removed from the lists — they are nulled on unregister — so IDs stay stable for as long as the lists do. That is one Play session: ResetForNewPlaySession clears them at each start, because with domain reload disabled the statics outlive a session and would otherwise carry dead slots into the next one.

Member Function Documentation

◆ GetBridge()

CsoundUnityBridge Csound.Unity.CsoundBridgeRegistry.GetBridge ( int id)
inlinestaticpackage

Returns the bridge at id , or null if not found.

◆ InvokeKsmpsCallback()

void Csound.Unity.CsoundBridgeRegistry.InvokeKsmpsCallback ( int id,
int bufferFrameOffset )
inlinestaticpackage

Invoked by CsoundRealtime on the audio thread after each successful PerformKsmps.

◆ InvokePerformanceFinishedCallback()

void Csound.Unity.CsoundBridgeRegistry.InvokePerformanceFinishedCallback ( int id)
inlinestaticpackage

◆ InvokeSpinFillCallback()

void Csound.Unity.CsoundBridgeRegistry.InvokeSpinFillCallback ( int id,
int bufferFrameOffset )
inlinestaticpackage

Invoked by CsoundRealtime on the audio thread immediately before each PerformKsmps.

◆ Register()

int Csound.Unity.CsoundBridgeRegistry.Register ( CsoundUnityBridge bridge)
inlinestaticpackage

Registers a bridge (and an optional command queue) and returns the stable integer ID that CsoundRealtime.InstanceId and CsoundControl.InstanceId must store.

Always called on the main thread, before the audio system starts producing frames — no additional synchronisation is needed.

◆ RegisterKsmpsCallback()

void Csound.Unity.CsoundBridgeRegistry.RegisterKsmpsCallback ( int id,
System.Action< int > callback )
inlinestaticpackage

Registers an action to be called after each PerformKsmps for instance id . The int argument is the buffer-frame offset at which the new ksmps block begins.

◆ RegisterPerformanceFinishedCallback()

void Csound.Unity.CsoundBridgeRegistry.RegisterPerformanceFinishedCallback ( int id,
System.Action callback )
inlinestaticpackage

◆ RegisterSpinFillCallback()

void Csound.Unity.CsoundBridgeRegistry.RegisterSpinFillCallback ( int id,
System.Action< int > callback )
inlinestaticpackage

Registers an action to be called before each PerformKsmps for instance id . The int argument is the buffer-frame offset at which the new ksmps block begins.

◆ Unregister()

void Csound.Unity.CsoundBridgeRegistry.Unregister ( int id)
inlinestaticpackage

Nulls out the slot at id so that any in-flight audio-thread call to GetBridge returns null (→ silence) after teardown. Does not shrink the lists; IDs remain stable.


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