From: David Griffith Date: Fri, 16 Oct 2015 05:00:25 +0000 (-0700) Subject: No more segfaults when playing an AIFF when an OGG is already playing. X-Git-Url: https://scope-eye.net/git/?a=commitdiff_plain;h=09485e3a;p=liskon_frotz.git No more segfaults when playing an AIFF when an OGG is already playing. Sound of any kind is distorted after this. --- diff --git a/src/curses/ux_audio.c b/src/curses/ux_audio.c index 3537d5d..3eb3766 100644 --- a/src/curses/ux_audio.c +++ b/src/curses/ux_audio.c @@ -538,8 +538,8 @@ void *playaiff(EFFECT *raw_effect) /* If that's all, terminate and signal that we're done. */ if (src_data.end_of_input && src_data.output_frames_gen == 0) { - pthread_mutex_unlock(&mutex); sem_post(&audio_full); + pthread_mutex_unlock(&mutex); break; } @@ -559,8 +559,10 @@ void *playaiff(EFFECT *raw_effect) */ bleep_playing = FALSE; + memset(bleepbuffer, 0, BUFFSIZE * sizeof(float) * 2); + pthread_mutex_unlock(&mutex); -// sem_post(&audio_empty); + sem_post(&audio_empty); fseek(myeffect.fp, filestart, SEEK_SET); sf_close(sndfile); @@ -649,7 +651,7 @@ static void *playmod(EFFECT *raw_effect) if (myeffect.vol > 8) myeffect.vol = 8; ModPlug_SetMasterVolume(mod, mypower(2, myeffect.vol)); - shortbuffer = malloc(BUFFSIZE * sizeof(char) * 2); + shortbuffer = malloc(BUFFSIZE * sizeof(short) * 2); music_playing = TRUE;