# HG changeset patch # User Eugene Zagidullin # Date 1201772635 -10800 # Node ID a916f7215b62c4d9363b1f3ec29ab4e07b90f18e # Parent 47d7a45b26a050d5b6bb8ad571a5eac210278190 tonegen swithed to FMT_FLOAT for debugging purposes diff -r 47d7a45b26a0 -r a916f7215b62 src/tonegen/tonegen.c --- a/src/tonegen/tonegen.c Wed Jan 30 05:04:15 2008 +0300 +++ b/src/tonegen/tonegen.c Thu Jan 31 12:43:55 2008 +0300 @@ -73,13 +73,13 @@ } #define BUF_SAMPLES 512 -#define BUF_BYTES BUF_SAMPLES * 2 +#define BUF_BYTES BUF_SAMPLES * sizeof(float) static void* play_loop(void *arg) { InputPlayback *playback = arg; GArray* frequencies = playback->data; - gint16 data[BUF_SAMPLES]; + float data[BUF_SAMPLES]; gsize i; struct { double wd; @@ -111,10 +111,9 @@ tone[j].t -= tone[j].period; tone[j].t++; } - data[i] = rint(((1 << 15) - 1) * - (sum_sines / frequencies->len)); + data[i] = (sum_sines / (double)frequencies->len); } - playback->pass_audio(playback, FMT_S16_NE, 1, BUF_BYTES, data, &going); + playback->pass_audio(playback, FMT_FLOAT, 1, BUF_BYTES, data, &going); } g_array_free(frequencies, TRUE); @@ -193,7 +192,7 @@ going = TRUE; audio_error = FALSE; - if (playback->output->open_audio(FMT_S16_NE, OUTPUT_FREQ, 1) == 0) + if (playback->output->open_audio(FMT_FLOAT, OUTPUT_FREQ, 1) == 0) { audio_error = TRUE; going = FALSE;