[Scummvm-devel] Re: [Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.57,1.58

Max Horn max at quendi.de
Fri Jul 4 07:36:07 CEST 2003


Am Freitag, 04.07.03 um 16:10 Uhr schrieb James Brown:

> Update of /cvsroot/scummvm/scummvm/sound
> In directory sc8-pr-cvs1:/tmp/cvs-serv29407/sound
>
> Modified Files:
> 	mixer.cpp
> Log Message:
> Insert preliminary Zak256 sound looping support. It's not perfect, as 
> some Zak256 sounds only loop a part of the sample - which our mixer 
> API doesn't yet support.
>
>
> Index: mixer.cpp
> ===================================================================
> RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
> retrieving revision 1.57
> retrieving revision 1.58
> diff -u -d -r1.57 -r1.58
> --- mixer.cpp	3 Jul 2003 22:05:22 -0000	1.57
> +++ mixer.cpp	4 Jul 2003 14:10:44 -0000	1.58
> @@ -229,6 +229,11 @@
>  }
>
>  int SoundMixer::playRaw(PlayingSoundHandle *handle, void *sound, 
> uint32 size, uint rate, byte flags, int id) {
> +	// Prevent duplicate sounds
> +        for (int i = 0; i != NUM_CHANNELS; i++)
> +                if (_channels[i] != NULL && _channels[i]->_id == id)
> +			return -1;
> +
>  	return insertChannel(handle, new ChannelRaw(this, sound, size, rate, 
> flags, id));
>  }
>
>
This code is incorrect, as it leaves open the possibility of race 
conditions. The check for "duplicate sounds" must be covered by the 
sound mutex.

Max





More information about the Scummvm-devel mailing list