[Scummvm-cvs-logs] CVS: scummvm/scumm sound.h,1.40,1.41 sound.cpp,1.188,1.189

Max Horn fingolfin at users.sourceforge.net
Tue Jul 29 10:14:04 CEST 2003


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

Modified Files:
	sound.h sound.cpp 
Log Message:
cleanup

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- sound.h	22 Jul 2003 20:27:54 -0000	1.40
+++ sound.h	29 Jul 2003 12:39:41 -0000	1.41
@@ -159,7 +159,6 @@
 	void stopSfxSound();
 	bool isSfxFinished() const;
 	void playSfxSound(void *sound, uint32 size, uint rate, bool isUnsigned, PlayingSoundHandle *handle);
-	void playSfxSound_MP3(void *sound, uint32 size, PlayingSoundHandle *handle);
 	void playSfxSound_Vorbis(void *sound, uint32 size, PlayingSoundHandle *handle);
 
 	int getCachedTrack(int track);

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.188
retrieving revision 1.189
diff -u -d -r1.188 -r1.189
--- sound.cpp	29 Jul 2003 00:05:19 -0000	1.188
+++ sound.cpp	29 Jul 2003 12:39:41 -0000	1.189
@@ -943,25 +943,24 @@
 	int rate, comp;
 	byte *data;
 
-	if (_scumm->_noDigitalSamples)
+	if (_soundsPaused || _scumm->_noDigitalSamples)
 		return;
 
 	if (file_size > 0) {
 		int alloc_size = file_size;
+		if (_vorbis_mode) {
+			data = (byte *)calloc(alloc_size, 1);
+	
+			if (file->read(data, file_size) != (uint)file_size) {
+				// no need to free the memory since error will shut down
+				error("startSfxSound: cannot read %d bytes", size);
+			}
+			playSfxSound_Vorbis(data, file_size, handle);
+		} else {
 #ifdef USE_MAD
-		if (!_vorbis_mode)
-			alloc_size += MAD_BUFFER_GUARD;
+			_scumm->_mixer->playMP3(handle, file, file_size);
 #endif
-		data = (byte *)calloc(alloc_size, 1);
-
-		if (file->read(data, file_size) != (uint)file_size) {
-			/* no need to free the memory since error will shut down */
-			error("startSfxSound: cannot read %d bytes", size);
 		}
-		if (_vorbis_mode)
-			playSfxSound_Vorbis(data, file_size, handle);
-		else
-			playSfxSound_MP3(data, file_size, handle);
 		return;
 	}
 
@@ -1429,21 +1428,12 @@
 }
 
 void Sound::playSfxSound(void *sound, uint32 size, uint rate, bool isUnsigned, PlayingSoundHandle *handle) {
-	if (_soundsPaused)
-		return;
 	byte flags = SoundMixer::FLAG_AUTOFREE;
 	if (isUnsigned)
 		flags |= SoundMixer::FLAG_UNSIGNED;
 	_scumm->_mixer->playRaw(handle, sound, size, rate, flags);
 }
 
-void Sound::playSfxSound_MP3(void *sound, uint32 size, PlayingSoundHandle *handle) {
-#ifdef USE_MAD
-	if (!_soundsPaused && !_scumm->_noDigitalSamples)
-		_scumm->_mixer->playMP3(handle, sound, size, SoundMixer::FLAG_AUTOFREE);
-#endif
-}
-
 #ifdef USE_VORBIS
 // Provide a virtual file to vorbisfile based on preloaded data
 struct data_file_info {
@@ -1508,20 +1498,19 @@
 
 void Sound::playSfxSound_Vorbis(void *sound, uint32 size, PlayingSoundHandle *handle) {
 #ifdef USE_VORBIS
-	if (!_soundsPaused && !_scumm->_noDigitalSamples) {
-		OggVorbis_File *ov_file = new OggVorbis_File;
-		data_file_info *f = new data_file_info;
-		f->data = (char *) sound;
-		f->size = size;
-		f->curr_pos = 0;
-	
-		if (ov_open_callbacks((void *) f, ov_file, NULL, 0, data_wrap) < 0) {
-			warning("Invalid file format");
-			delete ov_file;
-			delete f;
-		} else
-			_scumm->_mixer->playVorbis(handle, ov_file, 0, false);
-	}
+	OggVorbis_File *ov_file = new OggVorbis_File;
+	data_file_info *f = new data_file_info;
+	f->data = (char *) sound;
+	f->size = size;
+	f->curr_pos = 0;
+
+	if (ov_open_callbacks((void *) f, ov_file, NULL, 0, data_wrap) < 0) {
+		warning("Invalid file format");
+		delete ov_file;
+		delete f;
+		free(sound);
+	} else
+		_scumm->_mixer->playVorbis(handle, ov_file, 0, false);
 #endif
 }
 





More information about the Scummvm-git-logs mailing list