AudioAPI reference
Class OfflineAudioSink
Namespace: MicroEngine.Audio
Assembly: MicroEngine.Audio.dll
Guide: Audio
The test sink: renders into memory with no device and no clock. Each Pump renders exactly one simulation step of frames (the step’s share of the rate, so 44100 Hz at 60 steps alternates 735-frame steps exactly), in blocks of at most the block size, so the output depends only on what the game played, never on time.
public sealed class OfflineAudioSink : IAudioSink, IDisposableInheritance
Implements
Constructors
OfflineAudioSink(AudioFormat, int, int, int)
Creates an offline sink.
public OfflineAudioSink(AudioFormat format, int updateRate = 60, int blockFrames = 1024, int latencyFrames = 0)Parameters
format AudioFormat
The format to render.
updateRate int
Simulation steps per second: one pump renders one step.
blockFrames int
The largest block asked of the mixer at once.
latencyFrames int
The latency it reports (0: sounds start at their step’s first frame).
Exceptions
A count is out of range.
Properties
Format
The format the sink plays.
public AudioFormat Format { get; }Property Value
Frames
Frames rendered so far.
public long Frames { get; }Property Value
LatencyFrames
Frames rendered ahead of the device (queue target plus device period): the mixer’s minimum scheduling delay.
public int LatencyFrames { get; }Property Value
Samples
Everything rendered so far, interleaved.
public IReadOnlyList<float> Samples { get; }Property Value
Schedule
HostPump: rendering happens in Pump.
public AudioSinkSchedule Schedule { get; }Property Value
Methods
Dispose()
Stops rendering.
public void Dispose()Pump()
Renders the next simulation step of frames.
public void Pump()Start(AudioRender)
Starts calling render. Page-driven hosts call it inside the user gesture that starts the game.
public void Start(AudioRender render)Parameters
render AudioRender