31 lines
739 B
C#
31 lines
739 B
C#
using System;
|
|
namespace AudioStreamer
|
|
{
|
|
public class Amplifier : BaseAudioProcessor
|
|
{
|
|
Int32 amplification;
|
|
|
|
public Amplifier(float amplification)
|
|
{
|
|
FloatAmplification = amplification;
|
|
}
|
|
public Amplifier(Int32 amplification)
|
|
{
|
|
Amplification = amplification;
|
|
}
|
|
|
|
public Int32 Amplification { get { return this.amplification; } set { this.amplification = value; } }
|
|
public float FloatAmplification {
|
|
get { return ((float)this.amplification) / 655360f; }
|
|
set { this.amplification = (Int32)(value * 65536.0f); }
|
|
}
|
|
|
|
protected override void process(ref short[] samples)
|
|
{
|
|
for (int n = 0; n < samples.Length;n++){
|
|
samples[n] = (Int16)(((UInt32)samples[n] * this.amplification) >> 16);
|
|
}
|
|
}
|
|
}
|
|
}
|