1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-10 13:01:44 +00:00
Ryujinx/Ryujinx.Audio/Renderer/Dsp/Effect/IDelayLine.cs
Mary-nyan 1825bd87b4
misc: Reformat Ryujinx.Audio with dotnet-format (#3485)
This is the first commit of a series of reformat around the codebase as
discussed internally some weeks ago.

This project being one that isn't touched that much, it shouldn't cause
conflict with any opened PRs.
2022-07-25 15:46:33 -03:00

37 lines
No EOL
1 KiB
C#

using System;
using System.Runtime.CompilerServices;
namespace Ryujinx.Audio.Renderer.Dsp.Effect
{
public interface IDelayLine
{
uint CurrentSampleCount { get; }
uint SampleCountMax { get; }
void SetDelay(float delayTime);
float Read();
float Update(float value);
float TapUnsafe(uint sampleIndex, int offset);
float Tap(uint sampleIndex);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Tap(Span<float> workBuffer, int baseIndex, int sampleIndex, int delaySampleCount)
{
int targetIndex = baseIndex - sampleIndex;
if (targetIndex < 0)
{
targetIndex += delaySampleCount;
}
return workBuffer[targetIndex];
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint GetSampleCount(uint sampleRate, float delayTime)
{
return (uint)MathF.Round(sampleRate * delayTime);
}
}
}