private static double Triangle(long x, WaveConfig wc) { return(2 * (2 * wc.Amplitude / wc.Period) * (Math.Abs(x - wc.Period / 2) - wc.Period / 4)); }
private static double Flat(long x, WaveConfig wc) { return(wc.Offset); }
private static double Sawtooth(long x, WaveConfig wc) { return(2 * (wc.Amplitude / wc.Period) * x - wc.Amplitude); }
private static double Square(long x, WaveConfig wc) { var b = 2 * Math.PI / (1 / wc.FrequencyInKilohertz); return(wc.Amplitude * Math.Sign(Math.Sin(b * x))); }