mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-11 22:56:39 +00:00
4c2ab880ef
* Ryujinx.Audio: Remove BOM from files * misc: Relicense Ryujinx.Audio under the terms of the MIT license With the approvals of all the Ryujinx.Audio contributors, this commit changes Ryujinx.Audio license from LGPLv3 to MIT.
37 lines
1 KiB
C#
37 lines
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);
|
|
}
|
|
}
|
|
}
|