Skip to content

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.

C#
public sealed class OfflineAudioSink : IAudioSink, IDisposable

Inheritance

object ← OfflineAudioSink

Implements

IAudioSink, IDisposable

Constructors

OfflineAudioSink(AudioFormat, int, int, int)

Creates an offline sink.

C#
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

ArgumentOutOfRangeException

A count is out of range.

Properties

Format

The format the sink plays.

C#
public AudioFormat Format { get; }

Property Value

AudioFormat

Frames

Frames rendered so far.

C#
public long Frames { get; }

Property Value

long

LatencyFrames

Frames rendered ahead of the device (queue target plus device period): the mixer’s minimum scheduling delay.

C#
public int LatencyFrames { get; }

Property Value

int

Samples

Everything rendered so far, interleaved.

C#
public IReadOnlyList<float> Samples { get; }

Property Value

IReadOnlyList<float>

Schedule

HostPump: rendering happens in Pump.

C#
public AudioSinkSchedule Schedule { get; }

Property Value

AudioSinkSchedule

Methods

Dispose()

Stops rendering.

C#
public void Dispose()

Pump()

Renders the next simulation step of frames.

C#
public void Pump()

Start(AudioRender)

Starts calling render. Page-driven hosts call it inside the user gesture that starts the game.

C#
public void Start(AudioRender render)

Parameters

render AudioRender