2 * Copyright (C) 2015 Caleb Crome
3 * Copyright (C) 2013-2015 Intel Corporation
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.
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.
18 * Here's a generic sine wave generator that will work indefinitely
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.
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 *);