Table of Contents

Delegate SampleFiller

Namespace
Stride.CommunityToolkit.Audio
Assembly
Stride.CommunityToolkit.dll

Produces the next block of PCM samples for a ProceduralSoundSource.

public delegate void SampleFiller(Span<short> samples, int sampleRate, int channels)

Parameters

samples Span<short>

The block to fill, interleaved by channel: for stereo, left then right for each frame. Every element must be written; the buffer is reused between calls and holds the previous block.

sampleRate int

Samples per second per channel, as given when the sound was created.

channels int

1 for mono, 2 for stereo.

Remarks

Called on the audio worker thread, never on the game thread, so anything it reads that the game writes - frequency, waveform, volume - should be a field the game sets atomically (a float or an int is enough) rather than a structure updated in several steps.