[Scummvm-cvs-logs] SF.net SVN: scummvm: [28111] scummvm/trunk/engines

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Jul 15 21:24:00 CEST 2007


Revision: 28111
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28111&view=rev
Author:   fingolfin
Date:     2007-07-15 12:24:00 -0700 (Sun, 15 Jul 2007)

Log Message:
-----------
Fixed sound factory messup caused by my previous commit

Modified Paths:
--------------
    scummvm/trunk/engines/agos/sound.cpp
    scummvm/trunk/engines/queen/sound.cpp
    scummvm/trunk/engines/saga/sound.cpp
    scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
    scummvm/trunk/engines/scumm/smush/smush_player.cpp
    scummvm/trunk/engines/scumm/sound.cpp
    scummvm/trunk/engines/sword1/sound.cpp
    scummvm/trunk/engines/sword2/music.cpp

Modified: scummvm/trunk/engines/agos/sound.cpp
===================================================================
--- scummvm/trunk/engines/agos/sound.cpp	2007-07-15 18:29:05 UTC (rev 28110)
+++ scummvm/trunk/engines/agos/sound.cpp	2007-07-15 19:24:00 UTC (rev 28111)
@@ -292,7 +292,9 @@
 
 	uint32 size = _offsets[sound + i] - _offsets[sound];
 
-	return Audio::makeMP3Stream(_file, size);
+	Common::MemoryReadStream *tmp = _file->readStream(size);
+	assert(tmp);
+	return Audio::makeMP3Stream(tmp, true);
 }
 
 void MP3Sound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {
@@ -321,7 +323,9 @@
 
 	uint32 size = _offsets[sound + i] - _offsets[sound];
 
-	return Audio::makeVorbisStream(_file, size);
+	Common::MemoryReadStream *tmp = _file->readStream(size);
+	assert(tmp);
+	return Audio::makeVorbisStream(tmp, true);
 }
 
 void VorbisSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {
@@ -350,7 +354,9 @@
 
 	uint32 size = _offsets[sound + i] - _offsets[sound];
 
-	return Audio::makeFlacStream(_file, size);
+	Common::MemoryReadStream *tmp = _file->readStream(size);
+	assert(tmp);
+	return Audio::makeFlacStream(tmp, true);
 }
 
 void FlacSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {

Modified: scummvm/trunk/engines/queen/sound.cpp
===================================================================
--- scummvm/trunk/engines/queen/sound.cpp	2007-07-15 18:29:05 UTC (rev 28110)
+++ scummvm/trunk/engines/queen/sound.cpp	2007-07-15 19:24:00 UTC (rev 28111)
@@ -67,7 +67,9 @@
 	MP3Sound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {}
 protected:
 	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
-		_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeMP3Stream(f, size));
+		Common::MemoryReadStream *tmp = f->readStream(size);
+		assert(tmp);
+		_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeMP3Stream(tmp, true));
 	}
 };
 #endif
@@ -78,7 +80,9 @@
 	OGGSound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {}
 protected:
 	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
-		_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeVorbisStream(f, size));
+		Common::MemoryReadStream *tmp = f->readStream(size);
+		assert(tmp);
+		_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeVorbisStream(tmp, true));
 	}
 };
 #endif
@@ -89,7 +93,9 @@
 	FLACSound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {}
 protected:
 	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
-		_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeFlacStream(f, size));
+		Common::MemoryReadStream *tmp = f->readStream(size);
+		assert(tmp);
+		_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeFlacStream(tmp, true));
 	}
 };
 #endif // #ifdef USE_FLAC

Modified: scummvm/trunk/engines/saga/sound.cpp
===================================================================
--- scummvm/trunk/engines/saga/sound.cpp	2007-07-15 18:29:05 UTC (rev 28110)
+++ scummvm/trunk/engines/saga/sound.cpp	2007-07-15 19:24:00 UTC (rev 28111)
@@ -84,27 +84,34 @@
 		_mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume);
 	} else {
 		Audio::AudioStream *stream = NULL;
+		Common::MemoryReadStream *tmp = NULL;
 
 		switch (buffer.soundType) {
 #ifdef USE_MAD
 			case kSoundMP3:
 				debug(1, "Playing MP3 compressed sound");
 				buffer.soundFile->seek((long)buffer.fileOffset, SEEK_SET);
-				stream = Audio::makeMP3Stream(buffer.soundFile, buffer.size);
+				tmp = buffer.soundFile->readStream(buffer.size);
+				assert(tmp);
+				stream = Audio::makeMP3Stream(tmp, true);
 				break;
 #endif
 #ifdef USE_VORBIS
 			case kSoundOGG:
 				debug(1, "Playing OGG compressed sound");
 				buffer.soundFile->seek((long)buffer.fileOffset, SEEK_SET);
-				stream = Audio::makeVorbisStream(buffer.soundFile, buffer.size);
+				tmp = buffer.soundFile->readStream(buffer.size);
+				assert(tmp);
+				stream = Audio::makeVorbisStream(tmp, true);
 				break;
 #endif
 #ifdef USE_FLAC
 			case kSoundFLAC:
 				debug(1, "Playing FLAC compressed sound");
 				buffer.soundFile->seek((long)buffer.fileOffset, SEEK_SET);
-				stream = Audio::makeFlacStream(buffer.soundFile, buffer.size);
+				tmp = buffer.soundFile->readStream(buffer.size);
+				assert(tmp);
+				stream = Audio::makeFlacStream(tmp, true);
 				break;
 #endif
 			default:

Modified: scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
===================================================================
--- scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp	2007-07-15 18:29:05 UTC (rev 28110)
+++ scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp	2007-07-15 19:24:00 UTC (rev 28111)
@@ -615,13 +615,15 @@
 				oggMode = true;
 			}
 			if (!soundHandle->compressedStream) {
+				Common::MemoryReadStream *tmp = cmpFile->readStream(len);
+				assert(tmp);
 #ifdef USE_VORBIS
 				if (oggMode)
-					soundHandle->compressedStream = Audio::makeVorbisStream(cmpFile, len);
+					soundHandle->compressedStream = Audio::makeVorbisStream(tmp, true);
 #endif
 #ifdef USE_MAD
 				if (!oggMode)
-					soundHandle->compressedStream = Audio::makeMP3Stream(cmpFile, len);
+					soundHandle->compressedStream = Audio::makeMP3Stream(tmp, true);
 #endif
 				assert(soundHandle->compressedStream);
 			}

Modified: scummvm/trunk/engines/scumm/smush/smush_player.cpp
===================================================================
--- scummvm/trunk/engines/scumm/smush/smush_player.cpp	2007-07-15 18:29:05 UTC (rev 28110)
+++ scummvm/trunk/engines/scumm/smush/smush_player.cpp	2007-07-15 19:24:00 UTC (rev 28111)
@@ -1183,7 +1183,7 @@
 	strcpy(fname + (i - filename), ".ogg");
 	if (file->open(fname)) {
 		_compressedFileMode = true;
-		_vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeVorbisStream(file, true, 0, 0));
+		_vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeVorbisStream(file, true));
 		return;
 	}
 #endif
@@ -1192,7 +1192,7 @@
 	strcpy(fname + (i - filename), ".mp3");
 	if (file->open(fname)) {
 		_compressedFileMode = true;
-		_vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeMP3Stream(file, true, 0, 0));
+		_vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeMP3Stream(file, true));
 		return;
 	}
 #endif

Modified: scummvm/trunk/engines/scumm/sound.cpp
===================================================================
--- scummvm/trunk/engines/scumm/sound.cpp	2007-07-15 18:29:05 UTC (rev 28110)
+++ scummvm/trunk/engines/scumm/sound.cpp	2007-07-15 19:24:00 UTC (rev 28111)
@@ -607,24 +607,31 @@
 
 	if (!_soundsPaused && _mixer->isReady()) {
 		Audio::AudioStream *input = NULL;
+		Common::MemoryReadStream *tmp = NULL;
 
 		switch (_soundMode) {
 		case kMP3Mode:
 	#ifdef USE_MAD
 			assert(size > 0);
-			input = Audio::makeMP3Stream(_sfxFile, size);
+			tmp = _sfxFile->readStream(size);
+			assert(tmp);
+			input = Audio::makeMP3Stream(tmp, true);
 	#endif
 			break;
 		case kVorbisMode:
 	#ifdef USE_VORBIS
 			assert(size > 0);
-			input = Audio::makeVorbisStream(_sfxFile, size);
+			tmp = _sfxFile->readStream(size);
+			assert(tmp);
+			input = Audio::makeVorbisStream(tmp, true);
 	#endif
 			break;
 		case kFlacMode:
 	#ifdef USE_FLAC
 			assert(size > 0);
-			input = Audio::makeFlacStream(_sfxFile, size);
+			tmp = _sfxFile->readStream(size);
+			assert(tmp);
+			input = Audio::makeFlacStream(tmp, true);
 	#endif
 			break;
 		default:

Modified: scummvm/trunk/engines/sword1/sound.cpp
===================================================================
--- scummvm/trunk/engines/sword1/sound.cpp	2007-07-15 18:29:05 UTC (rev 28110)
+++ scummvm/trunk/engines/sword1/sound.cpp	2007-07-15 19:24:00 UTC (rev 28111)
@@ -201,7 +201,9 @@
 #ifdef USE_FLAC
 		else if (_cowMode == CowFlac) {
 			_cowFile.seek(index);
-			_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeFlacStream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
+			Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize);
+			assert(tmp);
+			_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeFlacStream(tmp, true), SOUND_SPEECH_ID, speechVol, speechPan);
 			// with compressed audio, we can't calculate the wave volume.
 			// so default to talking.
 			for (int cnt = 0; cnt < 480; cnt++)
@@ -212,7 +214,9 @@
 #ifdef USE_VORBIS
 		else if (_cowMode == CowVorbis) {
 			_cowFile.seek(index);
-			_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeVorbisStream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
+			Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize);
+			assert(tmp);
+			_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeVorbisStream(tmp, true), SOUND_SPEECH_ID, speechVol, speechPan);
 			// with compressed audio, we can't calculate the wave volume.
 			// so default to talking.
 			for (int cnt = 0; cnt < 480; cnt++)
@@ -223,7 +227,9 @@
 #ifdef USE_MAD
 		else if (_cowMode == CowMp3) {
 			_cowFile.seek(index);
-			_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeMP3Stream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
+			Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize);
+			assert(tmp);
+			_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeMP3Stream(tmp, true), SOUND_SPEECH_ID, speechVol, speechPan);
 			// with compressed audio, we can't calculate the wave volume.
 			// so default to talking.
 			for (int cnt = 0; cnt < 480; cnt++)

Modified: scummvm/trunk/engines/sword2/music.cpp
===================================================================
--- scummvm/trunk/engines/sword2/music.cpp	2007-07-15 18:29:05 UTC (rev 28110)
+++ scummvm/trunk/engines/sword2/music.cpp	2007-07-15 19:24:00 UTC (rev 28111)
@@ -139,21 +139,29 @@
 	}
 
 	fh->file.seek(pos, SEEK_SET);
+	
+	Common::MemoryReadStream *tmp = 0;
 
 	switch (fh->fileType) {
 	case kCLUMode:
 		return makeCLUStream(&fh->file, enc_len);
 #ifdef USE_MAD
 	case kMP3Mode:
-		return Audio::makeMP3Stream(&fh->file, enc_len);
+		tmp = fh->file.readStream(enc_len);
+		assert(tmp);
+		return Audio::makeMP3Stream(tmp, true);
 #endif
 #ifdef USE_VORBIS
 	case kVorbisMode:
-		return Audio::makeVorbisStream(&fh->file, enc_len);
+		tmp = fh->file.readStream(enc_len);
+		assert(tmp);
+		return Audio::makeVorbisStream(tmp, true);
 #endif
 #ifdef USE_FLAC
 	case kFlacMode:
-		return Audio::makeFlacStream(&fh->file, enc_len);
+		tmp = fh->file.readStream(enc_len);
+		assert(tmp);
+		return Audio::makeFlacStream(tmp, true);
 #endif
 	default:
 		return NULL;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list