[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.77,1.78

Max Horn fingolfin at users.sourceforge.net
Mon Jul 28 18:22:22 CEST 2003


Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv2358

Modified Files:
	mixer.cpp 
Log Message:
cleanup

Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- mixer.cpp	28 Jul 2003 20:42:54 -0000	1.77
+++ mixer.cpp	29 Jul 2003 00:05:36 -0000	1.78
@@ -130,7 +130,7 @@
 	uint32 _size;
 
 public:
-	ChannelMP3Common(SoundMixer *mixer, PlayingSoundHandle *handle, uint32 rate);
+	ChannelMP3Common(SoundMixer *mixer, PlayingSoundHandle *handle);
 	~ChannelMP3Common();
 };
 
@@ -139,7 +139,7 @@
 	uint32 _position;
 
 public:
-	ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, uint32 rate, void *sound, uint size, byte flags);
+	ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, void *sound, uint size, byte flags);
 
 	void mix(int16 *data, uint len);
 	bool isMusicChannel() { return false; }
@@ -151,9 +151,8 @@
 	File *_file;
 	bool _initialized;
 
-
 public:
-	ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *handle, uint32 rate, File *file, mad_timer_t duration);
+	ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, mad_timer_t duration);
 
 	void mix(int16 *data, uint len);
 	bool isActive();
@@ -280,11 +279,11 @@
 #ifdef USE_MAD
 int SoundMixer::playMP3(PlayingSoundHandle *handle, void *sound, uint32 size, byte flags) {
 	StackLock lock(_mutex);
-	return insertChannel(handle, new ChannelMP3(this, handle, _syst->property(OSystem::PROP_GET_SAMPLE_RATE, 0), sound, size, flags));
+	return insertChannel(handle, new ChannelMP3(this, handle, sound, size, flags));
 }
 int SoundMixer::playMP3CDTrack(PlayingSoundHandle *handle, File *file, mad_timer_t duration) {
 	StackLock lock(_mutex);
-	return insertChannel(handle, new ChannelMP3CDMusic(this, handle, _syst->property(OSystem::PROP_GET_SAMPLE_RATE, 0), file, duration));
+	return insertChannel(handle, new ChannelMP3CDMusic(this, handle, file, duration));
 }
 #endif
 
@@ -919,12 +918,12 @@
 
 #ifdef USE_MAD
 
-ChannelMP3Common::ChannelMP3Common(SoundMixer *mixer, PlayingSoundHandle *handle, uint32 rate)
+ChannelMP3Common::ChannelMP3Common(SoundMixer *mixer, PlayingSoundHandle *handle)
 	: Channel(mixer, handle) {
 	mad_stream_init(&_stream);
 #ifdef _WIN32_WCE
 	// Lower sample rate to 11 kHz on WinCE if necessary
-	if (rate != 22050)
+	if (_syst->property(OSystem::PROP_GET_SAMPLE_RATE, 0) != 22050)
 		mad_stream_options(&_stream, MAD_OPTION_HALFSAMPLERATE);
 #endif
 	mad_frame_init(&_frame);
@@ -939,8 +938,8 @@
 	mad_stream_finish(&_stream);
 }
 
-ChannelMP3::ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, uint32 rate, void *sound, uint size, byte flags)
-	: ChannelMP3Common(mixer, handle, rate) {
+ChannelMP3::ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, void *sound, uint size, byte flags)
+	: ChannelMP3Common(mixer, handle) {
 	_posInFrame = 0xFFFFFFFF;
 	_position = 0;
 	_size = size;
@@ -967,7 +966,7 @@
 	sample += (1L << (MAD_F_FRACBITS - 16));
 
 	/* clip */
-	if (sample >= MAD_F_ONE)
+	if (sample > MAD_F_ONE - 1)
 		sample = MAD_F_ONE - 1;
 	else if (sample < -MAD_F_ONE)
 		sample = -MAD_F_ONE;
@@ -1029,8 +1028,8 @@
 
 #define MP3CD_BUFFERING_SIZE 131072
 
-ChannelMP3CDMusic::ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *handle, uint32 rate, File *file, mad_timer_t duration)
-	: ChannelMP3Common(mixer, handle, rate) {
+ChannelMP3CDMusic::ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, mad_timer_t duration)
+	: ChannelMP3Common(mixer, handle) {
 	_file = file;
 	_duration = duration;
 	_initialized = false;





More information about the Scummvm-git-logs mailing list