upload
This commit is contained in:
commit
1c7a8cf25f
579 files changed
+83196
No files matched your search
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace VibranceHud.Audio;
|
||||
|
||||
public static class AudioLimiter
|
||||
{
|
||||
public const float MinVolume = 0.05f;
|
||||
|
||||
public const float DefaultAttack = 0.5f;
|
||||
|
||||
public const float DefaultRelease = 0.3f;
|
||||
|
||||
public static float NextVolume(float peak, float threshold, float currentVolume, float maxVolume, float attack = 0.5f, float release = 0.3f)
|
||||
{
|
||||
float num = ((peak > 0.0001f) ? MathF.Min(maxVolume, threshold / peak) : maxVolume);
|
||||
float num2 = ((num < currentVolume) ? attack : release);
|
||||
return Math.Clamp(currentVolume + (num - currentVolume) * num2, 0.05f, maxVolume);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user