chore: run dotnet format scoped default (was previously scoped to just 'style')
This commit is contained in:
parent
8799edf99b
commit
c06874f14a
23 changed files with 749 additions and 485 deletions
|
|
@ -176,41 +176,42 @@ public unsafe partial class AmpEnvelope : IExample
|
|||
switch (env.State)
|
||||
{
|
||||
case ADSRState.Attack:
|
||||
{
|
||||
env.CurrentValue += (1.0f / env.AttackTime) * sampleTime;
|
||||
if (env.CurrentValue >= 1.0f)
|
||||
{
|
||||
env.CurrentValue = 1.0f;
|
||||
env.State = ADSRState.Decay;
|
||||
env.CurrentValue += (1.0f / env.AttackTime) * sampleTime;
|
||||
if (env.CurrentValue >= 1.0f)
|
||||
{
|
||||
env.CurrentValue = 1.0f;
|
||||
env.State = ADSRState.Decay;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ADSRState.Decay:
|
||||
{
|
||||
env.CurrentValue -= ((1.0f - env.SustainLevel) / env.DecayTime) * sampleTime;
|
||||
if (env.CurrentValue <= env.SustainLevel)
|
||||
{
|
||||
env.CurrentValue -= ((1.0f - env.SustainLevel) / env.DecayTime) * sampleTime;
|
||||
if (env.CurrentValue <= env.SustainLevel)
|
||||
{
|
||||
env.CurrentValue = env.SustainLevel;
|
||||
env.State = ADSRState.Sustain;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ADSRState.Sustain:
|
||||
{
|
||||
env.CurrentValue = env.SustainLevel;
|
||||
env.State = ADSRState.Sustain;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ADSRState.Sustain:
|
||||
{
|
||||
env.CurrentValue = env.SustainLevel;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ADSRState.Release:
|
||||
{
|
||||
env.CurrentValue -= (env.SustainLevel / env.ReleaseTime) * sampleTime;
|
||||
if (env.CurrentValue <= 0.001f) // Use a small threshold to avoid infinite tail
|
||||
{
|
||||
env.CurrentValue = 0.0f;
|
||||
env.State = ADSRState.Idle;
|
||||
env.CurrentValue -= (env.SustainLevel / env.ReleaseTime) * sampleTime;
|
||||
if (env.CurrentValue <= 0.001f) // Use a small threshold to avoid infinite tail
|
||||
{
|
||||
env.CurrentValue = 0.0f;
|
||||
env.State = ADSRState.Idle;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,10 +88,18 @@ public unsafe partial class StreamCallback : IExample
|
|||
{
|
||||
switch (waveType)
|
||||
{
|
||||
case WaveType.Sine: SetAudioStreamCallback(stream, &SineCallback); break;
|
||||
case WaveType.Square: SetAudioStreamCallback(stream, &SquareCallback); break;
|
||||
case WaveType.Triangle: SetAudioStreamCallback(stream, &TriangleCallback); break;
|
||||
case WaveType.Sawtooth: SetAudioStreamCallback(stream, &SawtoothCallback); break;
|
||||
case WaveType.Sine:
|
||||
SetAudioStreamCallback(stream, &SineCallback);
|
||||
break;
|
||||
case WaveType.Square:
|
||||
SetAudioStreamCallback(stream, &SquareCallback);
|
||||
break;
|
||||
case WaveType.Triangle:
|
||||
SetAudioStreamCallback(stream, &TriangleCallback);
|
||||
break;
|
||||
case WaveType.Sawtooth:
|
||||
SetAudioStreamCallback(stream, &SawtoothCallback);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue