Table of Contents

Class SoundFontGenerators

Namespace
NAudio.SoundFont
Assembly
NAudio.Core.dll

A resolved set of SoundFont generator values, indexed by GeneratorEnum. Instances start from the SoundFont 2.04 default values (§8.1.3) and are then modified by zone generators during instrument resolution (see SoundFontInstrumentResolver).

Values are the raw signed generator amounts from the file; the units (cents, timecents, centibels, etc.) are interpreted by the synthesiser (see NAudio.Dsp.SynthMath). Range and index generators (KeyRange, VelocityRange, Instrument, SampleID) are not stored here — they drive zone selection and are surfaced on SoundFontRegion instead.

public sealed class SoundFontGenerators
Inheritance
SoundFontGenerators
Inherited Members

Properties

EndAddressOffset

Sample-point offset to add to the sample header's end point.

public int EndAddressOffset { get; }

Property Value

int

EndLoopAddressOffset

Sample-point offset to add to the sample header's loop end point.

public int EndLoopAddressOffset { get; }

Property Value

int

ExclusiveClass

The exclusive (choke) class — notes sharing a non-zero exclusive class within a preset cut each other off (e.g. hi-hat open/closed). 0 = none.

public int ExclusiveClass { get; }

Property Value

int

this[GeneratorEnum]

Gets or sets the raw value of a generator. Out-of-range generator enumerators read as 0 and ignore writes.

public short this[GeneratorEnum generator] { get; set; }

Parameters

generator GeneratorEnum

Property Value

short

KeyNumberOverride

A fixed key to use for this region regardless of the played note, or -1 (the default) to use the played note.

public int KeyNumberOverride { get; }

Property Value

int

OverridingRootKey

The MIDI key that plays the sample at its recorded pitch (overridingRootKey), or -1 to use the sample header's original pitch.

public int OverridingRootKey { get; }

Property Value

int

SampleModes

The sample loop behaviour for this region.

public SampleMode SampleModes { get; }

Property Value

SampleMode

StartAddressOffset

Sample-point offset to add to the sample header's start point, combining the fine and coarse (×32768) start-address generators.

public int StartAddressOffset { get; }

Property Value

int

StartLoopAddressOffset

Sample-point offset to add to the sample header's loop start point.

public int StartLoopAddressOffset { get; }

Property Value

int

VelocityOverride

A fixed velocity to use for this region regardless of the played velocity, or -1 (the default) to use the played velocity.

public int VelocityOverride { get; }

Property Value

int

Methods

Clone()

Returns a copy of this generator set.

public SoundFontGenerators Clone()

Returns

SoundFontGenerators

CreateWithDefaults()

Creates a generator set initialised to the SoundFont 2.04 default values — the correct starting point for instrument-level resolution.

public static SoundFontGenerators CreateWithDefaults()

Returns

SoundFontGenerators

CreateZeroed()

Creates a generator set with every value zero — the correct starting point for accumulating preset-level offsets, which are added to the instrument-level values.

public static SoundFontGenerators CreateZeroed()

Returns

SoundFontGenerators