|
CsoundUnity 4.0.0-alpha.3
|
Layer 2b — Realtime state (audio thread). More...
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. | |
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).
|
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.
| context | The audio thread context for this block. |
| pipe | The pipe that carries messages between the control and audio sides. |
| buffer | The block to write the output into. |
| args | What Unity says about the block being rendered. |
|
inline |
No-op for Phase 1 — no cross-thread pipe messages needed yet.
| context | The context Unity passes when it hands over updated data. |
| pipe | The pipe that carries messages between the control and audio sides. |
|
package |
Index into CsoundBridgeRegistry.
|
get |
Csound runs indefinitely — not finite.
|
get |
Csound must process in real time at system rate.
|
get |
Infinite generator — length is unknown.