class

IAudioGenerator

A procedural sound source: C++ writes the samples itself, pulled by the audio thread at the device's native rate. Use it where a MetaSound graph is the wrong tool (a physical model, an engine or wind synthesizer driven by gameplay state) and the clip-based AudioSource has nothing to play.

Module
Audio
Header
#include "Audio/AudioGenerator.h"
Namespace
Mowo

THREADING CONTRACT. Render, OnStart, OnStop and Reset all run on the audio thread, inside the device callback. They must never block, never allocate, never take a lock and never call into the engine's game-thread APIs: one slow block is an audible dropout for the whole mix. Preallocate in the constructor or in OnStart's caller side; read live control values from a TAudioParamBlock the game thread fills (Render takes a snapshot per block, so a change lands on the next block boundary; smooth it inside Render if a jump would click).

Constructors

SignatureNameDescription
virtual ~IAudioGenerator() = default~IAudioGenerator

Public functions

ReturnsNameDescription
voidRenderFill frames interleaved frames of channels floats at sampleRate.
voidOnStartThe first block after the voice was played (or played again after Stop).
voidOnStopThe first block after the voice was stopped; no Render follows until the next OnStart.
voidResetBack to the initial state (phases, filters, seeds).

Function details

~IAudioGenerator

C++
virtual ~IAudioGenerator() = default

Render

C++
virtual void Render(float* interleaved, uint32_t frames, uint32_t channels, uint32_t sampleRate) = 0

Fill frames interleaved frames of channels floats at sampleRate. The buffer is zeroed first, so a generator may add into it; it must write finite values (a NaN or infinity is replaced by silence on the way out).

OnStart

C++
virtual void OnStart(uint32_t channels, uint32_t sampleRate)

The first block after the voice was played (or played again after Stop).

OnStop

C++
virtual void OnStop()

The first block after the voice was stopped; no Render follows until the next OnStart. Also delivered when the voice shuts down while running.

Reset

C++
virtual void Reset()

Back to the initial state (phases, filters, seeds). Applied at the start of the next block, so a Render never sees it half way.

Generated from Audio/AudioGenerator.h via audio.json · Dec 5, 2026Version 1.1.0