CsoundUnity 4.0.0-alpha.3
Loading...
Searching...
No Matches
Csound.Unity.CsoundRealtime Struct Reference

Layer 2b — Realtime state (audio thread). More...

Inheritance diagram for Csound.Unity.CsoundRealtime:

Public Member Functions

GeneratorInstance.Result Process (in RealtimeContext context, ProcessorInstance.Pipe pipe, ChannelBuffer buffer, GeneratorInstance.Arguments args)
 Called by Unity on every audio block (audio thread). Mirrors CsoundUnity.ProcessBlock: iterates sample-by-sample, calls PerformKsmps every ksmps frames, copies spout → buffer . Outputs silence when the bridge is not ready or Csound's performance has ended.
void Update (ProcessorInstance.UpdatedDataContext context, ProcessorInstance.Pipe pipe)
 No-op for Phase 1 — no cross-thread pipe messages needed yet.

Package Attributes

int InstanceId
 Index into CsoundBridgeRegistry.

Properties

bool isFinite [get]
 Csound runs indefinitely — not finite.
bool isRealtime [get]
 Csound must process in real time at system rate.
DiscreteTime? length [get]
 Infinite generator — length is unknown.

Detailed Description

Layer 2b — Realtime state (audio thread).

Fully unmanaged struct implementing GeneratorInstance.IRealtime. Unity calls Process on every audio block to fill the output buffer.

The struct is stored in Unity's unmanaged audio memory (ptr->HeaderAndProcessor.UserProcessor), so _ksmpsIndex persists correctly across consecutive Process calls — exactly as CsoundUnity.ksmpsIndex persists across OnAudioFilterRead calls.

The Csound bridge is resolved through CsoundBridgeRegistry so that this struct can remain unmanaged (required by Unity's TRealtime constraint).

Member Function Documentation

◆ Process()

GeneratorInstance.Result Csound.Unity.CsoundRealtime.Process ( in RealtimeContext context,
ProcessorInstance.Pipe pipe,
ChannelBuffer buffer,
GeneratorInstance.Arguments args )
inline

Called by Unity on every audio block (audio thread). Mirrors CsoundUnity.ProcessBlock: iterates sample-by-sample, calls PerformKsmps every ksmps frames, copies spout → buffer . Outputs silence when the bridge is not ready or Csound's performance has ended.

Parameters
contextThe audio thread context for this block.
pipeThe pipe that carries messages between the control and audio sides.
bufferThe block to write the output into.
argsWhat Unity says about the block being rendered.
Returns
What the generator did with the block.

◆ Update()

void Csound.Unity.CsoundRealtime.Update ( ProcessorInstance.UpdatedDataContext context,
ProcessorInstance.Pipe pipe )
inline

No-op for Phase 1 — no cross-thread pipe messages needed yet.

Parameters
contextThe context Unity passes when it hands over updated data.
pipeThe pipe that carries messages between the control and audio sides.

Member Data Documentation

◆ InstanceId

int Csound.Unity.CsoundRealtime.InstanceId
package

Index into CsoundBridgeRegistry.

Property Documentation

◆ isFinite

bool Csound.Unity.CsoundRealtime.isFinite
get

Csound runs indefinitely — not finite.

◆ isRealtime

bool Csound.Unity.CsoundRealtime.isRealtime
get

Csound must process in real time at system rate.

◆ length

DiscreteTime? Csound.Unity.CsoundRealtime.length
get

Infinite generator — length is unknown.


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