Fix some stupidity.
authorDavid Griffith <dave@661.org>
Wed, 13 May 2015 07:32:27 +0000 (00:32 -0700)
committerDavid Griffith <dave@661.org>
Wed, 13 May 2015 07:32:27 +0000 (00:32 -0700)
src/curses/ux_audio.c

index 27ba0e45d7bd9531cfce467f93cef98a205ea466..d30a1ec3191a283ea5b2158d4b3861e0ec49d871 100644 (file)
@@ -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;