Struct Modulator
- Namespace
- SpessaSharp.SoundBank
- Assembly
- SpessaSharp.dll
Parses soundfont modulators and the source enums, also includes the default modulators list
public readonly record struct Modulator : IEquatable<Modulator>
- Implements
- Inherited Members
Constructors
Modulator(Source, Source, Type, short, TransformType)
Parses soundfont modulators and the source enums, also includes the default modulators list
public Modulator(Modulator.Source PrimarySource, Modulator.Source SecondarySource, Generator.Type Destination = Type.Invalid, short TransformAmount = 0, Modulator.TransformType TType = TransformType.Linear)
Parameters
PrimarySourceModulator.SourceThe primary source of this modulator.
SecondarySourceModulator.SourceDestinationGenerator.TypeThe generator destination of this modulator.
TransformAmountshortThe transform amount for this modulator.
TTypeModulator.TransformTypeThe transform type for this modulator.
Modulator(Source?, Source?, Type, short, TransformType)
Creates a new SF2 Modulator
public Modulator(Modulator.Source? primarySource = null, Modulator.Source? secondarySource = null, Generator.Type destination = Type.Invalid, short amount = 0, Modulator.TransformType transformType = TransformType.Linear)
Parameters
primarySourceModulator.Source?secondarySourceModulator.Source?destinationGenerator.TypeamountshorttransformTypeModulator.TransformType
Fields
ByteSize
public const int ByteSize = 10
Field Value
DefaultResonantModSource
public static readonly short DefaultResonantModSource
Field Value
DefaultSoundFont2Modulators
public static readonly Modulator[] DefaultSoundFont2Modulators
Field Value
DefaultSpessaSynthModulators
public static readonly Modulator[] DefaultSpessaSynthModulators
Field Value
MODULATOR_TRANSFORMS
To get the value, you do MODULATOR_RESOLUTION * (MOD_CURVE_TYPES_AMOUNT * curveType + transformType) + your raw value as 14-bit number (0 - 16,383)
public static readonly float[] MODULATOR_TRANSFORMS
Field Value
- float[]
Properties
Destination
The generator destination of this modulator.
public Generator.Type Destination { get; init; }
Property Value
PrimarySource
The primary source of this modulator.
public Modulator.Source PrimarySource { get; init; }
Property Value
SPESSASYNTH_DEFAULT_MODULATORS
public static ReadOnlySpan<Modulator> SPESSASYNTH_DEFAULT_MODULATORS { get; }
Property Value
SecondarySource
public Modulator.Source SecondarySource { get; init; }
Property Value
TType
The transform type for this modulator.
public Modulator.TransformType TType { get; init; }
Property Value
TransformAmount
The transform amount for this modulator.
public short TransformAmount { get; init; }
Property Value
Methods
Decoded(short, short, short, short, short)
public static Modulator Decoded(short sourceEnum, short secondarySourceEnum, short destination, short amount, short transformType)
Parameters
Returns
GetModSourceEnum(Type, bool, bool, bool, Index)
public static short GetModSourceEnum(ModulatorCurve.Type curveType, bool isBipolar, bool isNegative, bool isCC, Modulator.Source.Index index)
Parameters
Returns
ID(TransformType)
public static int ID(Modulator.TransformType t)
Parameters
Returns
IsIdentical(Modulator, Modulator, bool)
Checks if the pair of modulators is identical (in SF2 terms)
public static bool IsIdentical(Modulator mod1, Modulator mod2, bool checkAmount = false)
Parameters
mod1ModulatorModulator 1
mod2ModulatorModulator 2
checkAmountboolIf the amount should be checked too.
Returns
- bool
If they are identical
SumTransform(Modulator)
Sums transform and create a NEW modulator
public Modulator SumTransform(Modulator mod)
Parameters
modModulatorThe modulator to sum with
Returns
- Modulator
The new modulator
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Write(ref Span<byte>, SoundFontWriteIndexes?)
public void Write(ref Span<byte> modData, SoundFontWriteIndexes? indexes = null)
Parameters
modDataSpan<byte>indexesSoundFontWriteIndexes