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