mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-08 18:48:36 +00:00
40311310d1
* amadeus: Add missing compressor effect from REV11 This was in my reversing notes but seems I completely forgot to implement it Also took the opportunity to simplify the Limiter effect a bit. * Remove some outdated comment * Address gdkchan's comments
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using System.Runtime.CompilerServices;
|
|
|
|
namespace Ryujinx.Audio.Renderer.Dsp
|
|
{
|
|
public static class FixedPointHelper
|
|
{
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static int ToInt(long value, int qBits)
|
|
{
|
|
return (int)(value >> qBits);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static float ToFloat(long value, int qBits)
|
|
{
|
|
return (float)value / (1 << qBits);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static float ConvertFloat(float value, int qBits)
|
|
{
|
|
return value / (1 << qBits);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static int ToFixed(float value, int qBits)
|
|
{
|
|
return (int)(value * (1 << qBits));
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static int RoundUpAndToInt(long value, int qBits)
|
|
{
|
|
int half = 1 << (qBits - 1);
|
|
|
|
return ToInt(value + half, qBits);
|
|
}
|
|
}
|
|
} |