diff --git a/src/simple-tone-generator.c b/src/simple-tone-generator.c index 6a3ca33..ff5b2df 100644 --- a/src/simple-tone-generator.c +++ b/src/simple-tone-generator.c @@ -10,6 +10,7 @@ #include #include +#include #include #include "simpleaudio.h" @@ -27,20 +28,16 @@ simpleaudio_tone_reset() void simpleaudio_tone(simpleaudio *sa_out, float tone_freq, size_t nsamples_dur) { -#define TONE_GEN_BUFSIZE (10*48000) // FIXME - float buf[TONE_GEN_BUFSIZE]; - - assert ( nsamples_dur <= TONE_GEN_BUFSIZE ); + float *buf = malloc(nsamples_dur * sizeof(float)); + assert(buf); if ( tone_freq != 0 ) { float wave_nsamples = 48000.0 / tone_freq; // FIXME rate size_t i; - for ( i=0; i 0 ); + + free(buf); }