Watch
2
0
Fork
You've already forked raylib-cs
0

chore: run dotnet format scoped default (was previously scoped to just 'style')

This commit is contained in:
tiger tiger tiger 2026-07-30 15:07:59 +02:00
commit c06874f14a
No known key found for this signature in database
23 changed files with 749 additions and 485 deletions

View file

@ -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;
}
}

View file

@ -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;
}
}