wavestream.c
changeset 214 ab571e095c22
parent 173 0821a4ea0008
child 241 503416fca921
     1.1 --- a/wavestream.c	Wed Feb 12 05:07:12 2003 +0000
     1.2 +++ b/wavestream.c	Wed Feb 12 05:40:57 2003 +0000
     1.3 @@ -92,6 +92,7 @@
     1.4  
     1.5  /* This is the format of the audio mixer data */
     1.6  static SDL_AudioSpec mixer;
     1.7 +static int wavestream_volume = MIX_MAX_VOLUME;
     1.8  
     1.9  /* Function to load the WAV/AIFF stream */
    1.10  static FILE *LoadWAVStream (const char *file, SDL_AudioSpec *spec,
    1.11 @@ -108,13 +109,13 @@
    1.12  	return(0);
    1.13  }
    1.14  
    1.15 -/* Unimplemented */
    1.16 -extern void WAVStream_SetVolume(int volume)
    1.17 +void WAVStream_SetVolume(int volume)
    1.18  {
    1.19 +	wavestream_volume = volume;
    1.20  }
    1.21  
    1.22  /* Load a WAV stream from the given file */
    1.23 -extern WAVStream *WAVStream_LoadSong(const char *file, const char *magic)
    1.24 +WAVStream *WAVStream_LoadSong(const char *file, const char *magic)
    1.25  {
    1.26  	WAVStream *wave;
    1.27  	SDL_AudioSpec wavespec;
    1.28 @@ -148,7 +149,7 @@
    1.29  }
    1.30  
    1.31  /* Start playback of a given WAV stream */
    1.32 -extern void WAVStream_Start(WAVStream *wave)
    1.33 +void WAVStream_Start(WAVStream *wave)
    1.34  {
    1.35  	clearerr(wave->wavefp);
    1.36  	fseek(wave->wavefp, wave->start, SEEK_SET);
    1.37 @@ -156,7 +157,7 @@
    1.38  }
    1.39  
    1.40  /* Play some of a stream previously started with WAVStream_Start() */
    1.41 -extern void WAVStream_PlaySome(Uint8 *stream, int len)
    1.42 +void WAVStream_PlaySome(Uint8 *stream, int len)
    1.43  {
    1.44  	long pos;
    1.45  
    1.46 @@ -192,7 +193,7 @@
    1.47  			}
    1.48  			music->cvt.len = original_len;
    1.49  			SDL_ConvertAudio(&music->cvt);
    1.50 -			memcpy(stream, music->cvt.buf, music->cvt.len_cvt);
    1.51 +			SDL_MixAudio(stream, music->cvt.buf, music->cvt.len_cvt, wavestream_volume);
    1.52  		} else {
    1.53  			if ( (music->stop - pos) < len ) {
    1.54  				len = (music->stop - pos);
    1.55 @@ -203,13 +204,13 @@
    1.56  }
    1.57  
    1.58  /* Stop playback of a stream previously started with WAVStream_Start() */
    1.59 -extern void WAVStream_Stop(void)
    1.60 +void WAVStream_Stop(void)
    1.61  {
    1.62  	music = NULL;
    1.63  }
    1.64  
    1.65  /* Close the given WAV stream */
    1.66 -extern void WAVStream_FreeSong(WAVStream *wave)
    1.67 +void WAVStream_FreeSong(WAVStream *wave)
    1.68  {
    1.69  	if ( wave ) {
    1.70  		/* Clean up associated data */
    1.71 @@ -224,7 +225,7 @@
    1.72  }
    1.73  
    1.74  /* Return non-zero if a stream is currently playing */
    1.75 -extern int WAVStream_Active(void)
    1.76 +int WAVStream_Active(void)
    1.77  {
    1.78  	int active;
    1.79