1 /* 2 * Copyright (C) 2015 Caleb Crome 3 * Copyright (C) 2013-2015 Intel Corporation 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 */ 16 17 /* 18 * Here's a generic sine wave generator that will work indefinitely 19 * for any frequency. 20 * 21 * Note: the state & phasor are stored as doubles (and updated as 22 * doubles) because after a million samples the magnitude drifts a 23 * bit. If we really need floats, it can be done with periodic 24 * renormalization of the state_real+state_imag magnitudes. 25 */ 26 27 int sin_generator_init(struct sin_generator *, float, float, float); 28 float sin_generator_next_sample(struct sin_generator *); 29 void sin_generator_vfill(struct sin_generator *, float *, int); 30 int generate_sine_wave(struct bat *, int, void *); 31 int generate_sine_wave_raw_mono(struct bat *, float *, float, int); 32