Struct VolumeEnvelope
- Namespace
- SpessaSharp.Synthesizer.Engine.Voice
- Assembly
- SpessaSharp.dll
Applies a volume envelope for a given voice. For performance reasons, cbAttenuationToGain is inlined here.
public struct VolumeEnvelope
- Inherited Members
Constructors
VolumeEnvelope(int, int)
public VolumeEnvelope(int sampleRate, int bufferSize)
Parameters
Fields
AttenuationCb
The current attenuation of the envelope in cB.
public float AttenuationCb
Field Value
OutputGain
The target gain for the current rendering block.
public float OutputGain
Field Value
State
The current stage of the volume envelope.
public VolumeEnvelope.VEState State
Field Value
Methods
Init(Voice)
Initialize the volume envelope
public void Init(Voice voice)
Parameters
voiceVoiceThe voice this envelope belongs to
Process(int, float)
Calculates the gain value for the last sample in the block and writes it to outputGain. Essentially we use approach of 100dB is silence, 0dB is peak.
public bool Process(int sampleCount, float gainTarget)
Parameters
Returns
- bool
If the voice has finished.
Exceptions
StartRelease(Voice)
Starts the release phase in the envelope.
public bool StartRelease(Voice voice)
Parameters
voiceVoiceThe voice this envelope belongs to.
Returns
- bool
If the voice is off.