[Scummvm-cvs-logs] CVS: scummvm/simon sound.cpp,1.35,1.36

Max Horn fingolfin at users.sourceforge.net
Tue Jul 29 05:40:09 CEST 2003


Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1:/tmp/cvs-serv27526/simon

Modified Files:
	sound.cpp 
Log Message:
cleanup

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- sound.cpp	24 Jul 2003 17:49:03 -0000	1.35
+++ sound.cpp	29 Jul 2003 12:39:41 -0000	1.36
@@ -23,7 +23,6 @@
 #include "common/engine.h"
 
 #define SOUND_BIG_ENDIAN true
-#define FLAG_SIGNED 0
 
 class BaseSound {
 protected:
@@ -35,25 +34,25 @@
 	BaseSound(SoundMixer *mixer, File *file, uint32 base = 0, bool bigendian = false);
 	BaseSound(SoundMixer *mixer, File *file, uint32 *offsets, bool bigendian = false);
 	virtual ~BaseSound();
-	virtual int playSound(uint sound, PlayingSoundHandle *handle, byte flags = SoundMixer::FLAG_UNSIGNED) = 0;
+	virtual int playSound(uint sound, PlayingSoundHandle *handle, byte flags) = 0;
 };
 
 class WavSound : public BaseSound {
 public:
 	WavSound(SoundMixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {};
 	WavSound(SoundMixer *mixer, File *file, uint32 *offsets) : BaseSound(mixer, file, offsets) {};
-	int playSound(uint sound, PlayingSoundHandle *handle, byte flags = SoundMixer::FLAG_UNSIGNED);
+	int playSound(uint sound, PlayingSoundHandle *handle, byte flags);
 };
 
 class VocSound : public BaseSound {
 public:
 	VocSound(SoundMixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {};
-	int playSound(uint sound, PlayingSoundHandle *handle, byte flags = SoundMixer::FLAG_UNSIGNED);
+	int playSound(uint sound, PlayingSoundHandle *handle, byte flags);
 };
 class RawSound : public BaseSound {
 public:
 	RawSound(SoundMixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {};
-	int playSound(uint sound, PlayingSoundHandle *handle, byte flags = SoundMixer::FLAG_UNSIGNED);
+	int playSound(uint sound, PlayingSoundHandle *handle, byte flags);
 };
 
 
@@ -234,7 +233,7 @@
 class MP3Sound : public BaseSound {
 public:
 	MP3Sound(SoundMixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {};
-	int playSound(uint sound, PlayingSoundHandle *handle, byte flags = SoundMixer::FLAG_UNSIGNED);
+	int playSound(uint sound, PlayingSoundHandle *handle, byte flags);
 };
 
 int MP3Sound::playSound(uint sound, PlayingSoundHandle *handle, byte flags)
@@ -242,16 +241,11 @@
 	if (_offsets == NULL)
 		return 0;
 
-	flags |= SoundMixer::FLAG_AUTOFREE;
-
 	_file->seek(_offsets[sound], SEEK_SET);
 
 	uint32 size = _offsets[sound+1] - _offsets[sound];
 
-	byte *buffer = (byte *)malloc(size);
-	_file->read(buffer, size);
-
-	return _mixer->playMP3(handle, buffer, size, flags);
+	return _mixer->playMP3(handle, _file, size);
 }
 #endif
 
@@ -449,10 +443,7 @@
 	if (_voice_handle)
 		_mixer->stop(_voice_index);
 
-	if (_game == GAME_SIMON1CD32)
-		_voice_index = _voice->playSound(sound, &_voice_handle, FLAG_SIGNED);
-	else	
-		_voice_index = _voice->playSound(sound, &_voice_handle);
+	_voice_index = _voice->playSound(sound, &_voice_handle, (_game == GAME_SIMON1CD32) ? 0 : SoundMixer::FLAG_UNSIGNED);
 }
 
 void SimonSound::playEffects(uint sound) {
@@ -462,10 +453,7 @@
 	if (_effects_paused)
 		return;
 
-	if (_game == GAME_SIMON1CD32)
-		_effects->playSound(sound, &_effects_handle, FLAG_SIGNED);
-	else
-		_effects->playSound(sound, &_effects_handle);
+	_effects->playSound(sound, &_effects_handle, (_game == GAME_SIMON1CD32) ? 0 : SoundMixer::FLAG_UNSIGNED);
 }
 
 void SimonSound::playAmbient(uint sound) {





More information about the Scummvm-git-logs mailing list