Table of Contents

Struct RenderContext

Namespace
Sigil.Sound
Assembly
Sigil.Sound.dll

Everything an operator needs to know about the render it belongs to. Passed explicitly when a Sigil.Sound.Sound is compiled; there is no global audio context.

public readonly record struct RenderContext : IEquatable<RenderContext>

Implements

Inherited Members

Constructors

RenderContext(int, int)

Everything an operator needs to know about the render it belongs to. Passed explicitly when a Sigil.Sound.Sound is compiled; there is no global audio context.

public RenderContext(int SampleRate, int BlockSize = 256)

Parameters

SampleRate int

Frames per second.

BlockSize int

The largest block the renderer will ask for. Operators size scratch buffers to this at compile time; Sigil.Sound.IOperator.RenderBlock(System.Span{Sigil.Sound.StereoFrame}) is never called with a longer span.

Fields

DefaultBlockSize

The default largest block size: 256 frames.

public const int DefaultBlockSize = 256

Field Value

int

DefaultSampleRate

The sample rate of Sigil.Sound.RenderContext.Default: 48 kHz.

public const int DefaultSampleRate = 48000

Field Value

int

Properties

BlockSize

The largest block the renderer will ask for. Operators size scratch buffers to this at compile time; Sigil.Sound.IOperator.RenderBlock(System.Span{Sigil.Sound.StereoFrame}) is never called with a longer span.

public int BlockSize { get; init; }

Property Value

int

Clock

The host's clock, or null for sounds that count time from their own first frame (the default). See Sigil.Sound.HostClock for what following a clock changes.

public HostClock? Clock { get; init; }

Property Value

HostClock?

Default

A 48 kHz context with the default block size.

public static RenderContext Default { get; }

Property Value

RenderContext

Nyquist

Half the sample rate.

public double Nyquist { get; }

Property Value

double

SamplePeriod

Seconds per frame.

public double SamplePeriod { get; }

Property Value

double

SampleRate

Frames per second.

public int SampleRate { get; init; }

Property Value

int

Methods

Validate()

Throws if the sample rate or block size is not positive; otherwise returns this context.

public RenderContext Validate()

Returns

RenderContext