SHA256
Add Gain Filter
This commit is contained in:
1 file changed
+22
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ADOFAIRenderer.Util.Audio.Filter
|
||||||
|
{
|
||||||
|
public class Gain : IAudioFilter
|
||||||
|
{
|
||||||
|
public float Level = 0f;
|
||||||
|
|
||||||
|
public void Initialize(int sampleRate, int channels) { }
|
||||||
|
|
||||||
|
public float ProcessSample(float sample, int channel) =>
|
||||||
|
sample * (float)Math.Pow(10, Level / 20);
|
||||||
|
|
||||||
|
public void ProcessBlock(Span<float> buffer)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < buffer.Length; i++)
|
||||||
|
buffer[i] = ProcessSample(buffer[i], 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Reset() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user