From: David Griffith Date: Wed, 13 May 2015 07:32:27 +0000 (-0700) Subject: Fix some stupidity. X-Git-Url: https://scope-eye.net/git/?a=commitdiff_plain;h=712f4ead930c4b284fcdaa12cededeadff165224;p=liskon_frotz.git Fix some stupidity. --- diff --git a/src/curses/ux_audio.c b/src/curses/ux_audio.c index 27ba0e4..d30a1ec 100644 --- a/src/curses/ux_audio.c +++ b/src/curses/ux_audio.c @@ -300,7 +300,7 @@ static void *mixer(void *arg) } floattopcm16(shortbuffer, bleepbuffer, bleepsamples); - ao_play(device, (char *) shortbuffer, bleepsamples); + ao_play(device, (char *) shortbuffer, bleepsamples * sizeof(short)); memset(shortbuffer, 0, BUFFSIZE * sizeof(short) * 2); memset(bleepbuffer, 0, BUFFSIZE * sizeof(float) * bleepchannels); @@ -446,7 +446,11 @@ void *playaiff(EFFECT *raw_effect) exit(1); } - bleepsamples = src_data.output_frames_gen * sizeof(short) * sf_info.channels; + bleepsamples = src_data.output_frames_gen * sf_info.channels; + + /* adjust volume */ + for (volcount = 0; volcount <= bleepsamples; volcount++) + bleepbuffer[volcount] /= volfactor; /* if that's all, terminate and signal that we're done */ if (src_data.end_of_input && src_data.output_frames_gen == 0) { @@ -455,10 +459,6 @@ void *playaiff(EFFECT *raw_effect) break; } - /* adjust volume */ - for (volcount = 0; volcount <= bleepsamples; volcount++) - bleepbuffer[volcount] /= volfactor; - /* get ready for the next chunk */ output_count += src_data.output_frames_gen; src_data.data_in += src_data.input_frames_used * sf_info.channels;