From e6fc431efcf17d3b31e6c644d1b255f5e579701d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 9 May 2006 08:02:35 +0000 Subject: [PATCH] Fixed bug #73 Date: Tue, 15 Apr 2003 23:36:17 +0300 From: King Of The Bongo Subject: [SDL] SDL_mixer patch Hi, this is modified version of wavestream.c When you call Mix_VolumeMusic (volume) and play PCM wav stream it does not apply and the wav file plays with the old values. --- configure.in | 2 +- wavestream.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 731cb5ff..d2b2b439 100644 --- a/configure.in +++ b/configure.in @@ -99,7 +99,7 @@ $srcdir/mixer.c \ $srcdir/music.c" dnl Check for SDL -SDL_VERSION=1.2.4 +SDL_VERSION=1.2.10 AM_PATH_SDL($SDL_VERSION, :, AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) diff --git a/wavestream.c b/wavestream.c index 3695196e..1f52cf73 100644 --- a/wavestream.c +++ b/wavestream.c @@ -195,10 +195,17 @@ void WAVStream_PlaySome(Uint8 *stream, int len) SDL_ConvertAudio(&music->cvt); SDL_MixAudio(stream, music->cvt.buf, music->cvt.len_cvt, wavestream_volume); } else { + Uint8 *data; if ( (music->stop - pos) < len ) { len = (music->stop - pos); } - fread(stream, len, 1, music->wavefp); + data = SDL_stack_alloc(Uint8, len); + if (data) + { + fread(data, len, 1, music->wavefp); + SDL_MixAudio(stream, data, len, wavestream_volume); + SDL_stack_free(data); + } } } } @@ -535,3 +542,4 @@ static FILE *LoadAIFFStream (const char *file, SDL_AudioSpec *spec, } return(wavefp); } +