Fixed bug #73
authorSam Lantinga <slouken@libsdl.org>
Tue, 09 May 2006 08:02:35 +0000
changeset 30802f1dc41d4e7
parent 307 0afaaf661ce8
child 309 e1c0ccfd16b6
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
wavestream.c
     1.1 --- a/configure.in	Sun May 07 17:29:06 2006 +0000
     1.2 +++ b/configure.in	Tue May 09 08:02:35 2006 +0000
     1.3 @@ -99,7 +99,7 @@
     1.4  $srcdir/music.c"
     1.5  
     1.6  dnl Check for SDL
     1.7 -SDL_VERSION=1.2.4
     1.8 +SDL_VERSION=1.2.10
     1.9  AM_PATH_SDL($SDL_VERSION,
    1.10              :,
    1.11  	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
     2.1 --- a/wavestream.c	Sun May 07 17:29:06 2006 +0000
     2.2 +++ b/wavestream.c	Tue May 09 08:02:35 2006 +0000
     2.3 @@ -195,10 +195,17 @@
     2.4  			SDL_ConvertAudio(&music->cvt);
     2.5  			SDL_MixAudio(stream, music->cvt.buf, music->cvt.len_cvt, wavestream_volume);
     2.6  		} else {
     2.7 +			Uint8 *data;
     2.8  			if ( (music->stop - pos) < len ) {
     2.9  				len = (music->stop - pos);
    2.10  			}
    2.11 -			fread(stream, len, 1, music->wavefp);
    2.12 +			data = SDL_stack_alloc(Uint8, len);
    2.13 +			if (data)
    2.14 +			{		
    2.15 +				fread(data, len, 1, music->wavefp);
    2.16 +				SDL_MixAudio(stream, data, len, wavestream_volume);
    2.17 +				SDL_stack_free(data);
    2.18 +			}	
    2.19  		}
    2.20  	}
    2.21  }
    2.22 @@ -535,3 +542,4 @@
    2.23  	}
    2.24  	return(wavefp);
    2.25  }
    2.26 +