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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Jan 19 12:22:15 CET 2010


Revision: 47377
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47377&view=rev
Author:   fingolfin
Date:     2010-01-19 11:22:14 +0000 (Tue, 19 Jan 2010)

Log Message:
-----------
Convert more engines from Mixer::playRaw to Mixer::playInputStream

Modified Paths:
--------------
    scummvm/trunk/engines/cine/sound.cpp
    scummvm/trunk/engines/drascula/sound.cpp
    scummvm/trunk/engines/saga/sound.cpp
    scummvm/trunk/engines/sword1/sound.cpp
    scummvm/trunk/engines/teenagent/teenagent.cpp
    scummvm/trunk/engines/tinsel/sound.cpp

Modified: scummvm/trunk/engines/cine/sound.cpp
===================================================================
--- scummvm/trunk/engines/cine/sound.cpp	2010-01-19 11:21:25 UTC (rev 47376)
+++ scummvm/trunk/engines/cine/sound.cpp	2010-01-19 11:22:14 UTC (rev 47377)
@@ -32,6 +32,7 @@
 
 #include "sound/audiostream.h"
 #include "sound/fmopl.h"
+#include "sound/raw.h"
 #include "sound/mods/soundfx.h"
 
 namespace Cine {
@@ -844,7 +845,8 @@
 void PaulaSound::playSoundChannel(int channel, int frequency, uint8 *data, int size, int volume) {
 	assert(frequency > 0);
 	frequency = PAULA_FREQ / frequency;
-	_mixer->playRaw(Audio::Mixer::kSFXSoundType, &_channelsTable[channel], data, size, DisposeAfterUse::YES, frequency, 0);
+	Audio::AudioStream *stream = Audio::makeRawMemoryStream(data, size, DisposeAfterUse::YES, frequency, 0);
+	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_channelsTable[channel], stream);
 	_mixer->setChannelVolume(_channelsTable[channel], volume * Audio::Mixer::kMaxChannelVolume / 63);
 }
 

Modified: scummvm/trunk/engines/drascula/sound.cpp
===================================================================
--- scummvm/trunk/engines/drascula/sound.cpp	2010-01-19 11:21:25 UTC (rev 47376)
+++ scummvm/trunk/engines/drascula/sound.cpp	2010-01-19 11:22:14 UTC (rev 47377)
@@ -23,9 +23,12 @@
  *
  */
 
+#include "sound/audiocd.h"
+#include "sound/audiostream.h"
 #include "sound/mixer.h"
+#include "sound/raw.h"
 #include "sound/voc.h"
-#include "sound/audiocd.h"
+
 #include "common/config-manager.h"
 
 #include "drascula/drascula.h"
@@ -182,8 +185,9 @@
 		if (ConfMan.getBool("speech_mute"))
 			memset(soundData, 0x80, soundSize); // Mute speech but keep the pause
 
-		_mixer->playRaw(Audio::Mixer::kSpeechSoundType, &_soundHandle, soundData, soundSize - 64, DisposeAfterUse::YES,
+		Audio::AudioStream *stream = Audio::makeRawMemoryStream(soundData, soundSize - 64, DisposeAfterUse::YES,
 						11025, Audio::Mixer::FLAG_UNSIGNED);
+		_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_soundHandle, stream);
 	} else
 		warning("playFile: Could not open %s", fname);
 }

Modified: scummvm/trunk/engines/saga/sound.cpp
===================================================================
--- scummvm/trunk/engines/saga/sound.cpp	2010-01-19 11:21:25 UTC (rev 47376)
+++ scummvm/trunk/engines/saga/sound.cpp	2010-01-19 11:22:14 UTC (rev 47377)
@@ -31,6 +31,7 @@
 #include "sound/audiostream.h"
 #include "sound/mixer.h"
 #include "sound/adpcm.h"
+#include "sound/raw.h"
 
 namespace Saga {
 

Modified: scummvm/trunk/engines/sword1/sound.cpp
===================================================================
--- scummvm/trunk/engines/sword1/sound.cpp	2010-01-19 11:21:25 UTC (rev 47376)
+++ scummvm/trunk/engines/sword1/sound.cpp	2010-01-19 11:22:14 UTC (rev 47377)
@@ -260,7 +260,7 @@
 					if (SwordEngine::isPsx()) { ;
 						uint32 size = READ_LE_UINT32(sampleData);
 						Audio::AudioStream *audStream = Audio::makeLoopingAudioStream(new Audio::VagStream(new Common::MemoryReadStream(sampleData + 4, size-4)), (_fxList[elem->id].type == FX_LOOP) ? 0 : 1);
-						_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &elem->handle, audStream, elem->id, volume, pan, DisposeAfterUse::NO, false, false);
+						_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &elem->handle, audStream, elem->id, volume, pan, DisposeAfterUse::NO);
 					} else {
 						uint32 size = READ_LE_UINT32(sampleData + 0x28);
 						uint8 flags;
@@ -351,17 +351,24 @@
 
 	debug(6, "startSpeech(%d, %d): locIndex %d, sampleSize %d, index %d", roomNo, localNo, locIndex, sampleSize, index);
 
+	Audio::AudioStream *stream = 0;
+
 	if (sampleSize) {
 		uint8 speechVol = (_speechVolR + _speechVolL) / 2;
 		int8 speechPan = (_speechVolR - _speechVolL) / 2;
 		if ((_cowMode == CowWave) || (_cowMode == CowDemo)) {
 			uint32 size;
 			int16 *data = uncompressSpeech(index + _cowHeaderSize, sampleSize, &size);
-			if (data)
-				_mixer->playRaw(Audio::Mixer::kSpeechSoundType, &_speechHandle, data, size, DisposeAfterUse::YES, 11025, SPEECH_FLAGS, SOUND_SPEECH_ID, speechVol, speechPan);
+			if (data) {
+				stream = Audio::makeRawMemoryStream((byte *)data, size, DisposeAfterUse::YES, 11025, SPEECH_FLAGS);
+				_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, stream, SOUND_SPEECH_ID, speechVol, speechPan);
+			}
 		} else if (_cowMode == CowPSX && sampleSize != 0xffffffff) {
 			_cowFile.seek(index * 2048);
-			_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, new Audio::VagStream(_cowFile.readStream(sampleSize)), SOUND_SPEECH_ID, speechVol, speechPan);
+			Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize);
+			assert(tmp);
+			stream = new Audio::VagStream(tmp);
+			_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, stream, 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++)
@@ -373,7 +380,8 @@
 			_cowFile.seek(index);
 			Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize);
 			assert(tmp);
-			_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeFlacStream(tmp, DisposeAfterUse::YES), SOUND_SPEECH_ID, speechVol, speechPan);
+			stream = Audio::makeFlacStream(tmp, DisposeAfterUse::YES);
+			_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, stream, 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++)
@@ -386,7 +394,8 @@
 			_cowFile.seek(index);
 			Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize);
 			assert(tmp);
-			_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeVorbisStream(tmp, DisposeAfterUse::YES), SOUND_SPEECH_ID, speechVol, speechPan);
+			stream = Audio::makeVorbisStream(tmp, DisposeAfterUse::YES);
+			_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, stream, 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++)
@@ -399,7 +408,8 @@
 			_cowFile.seek(index);
 			Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize);
 			assert(tmp);
-			_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeMP3Stream(tmp, DisposeAfterUse::YES), SOUND_SPEECH_ID, speechVol, speechPan);
+			stream = Audio::makeMP3Stream(tmp, DisposeAfterUse::YES);
+			_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, stream, 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/teenagent/teenagent.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.cpp	2010-01-19 11:21:25 UTC (rev 47376)
+++ scummvm/trunk/engines/teenagent/teenagent.cpp	2010-01-19 11:22:14 UTC (rev 47377)
@@ -29,6 +29,7 @@
 #include "common/system.h"
 #include "engines/advancedDetector.h"
 #include "sound/mixer.h"
+#include "sound/raw.h"
 #include "graphics/cursorman.h"
 #include "graphics/thumbnail.h"
 #include "teenagent/console.h"
@@ -893,11 +894,12 @@
 	}
 
 	uint size = in->size();
-	char *data = new char[size];
+	byte *data = (byte *)malloc(size);
 	in->read(data, size);
 	//debug(0, "playing %u samples...", size);
 
-	_mixer->playRaw(Audio::Mixer::kSFXSoundType, &_soundHandle, data, size, DisposeAfterUse::YES, 11025, 0);
+	Audio::AudioStream *stream = Audio::makeRawMemoryStream(data, size, DisposeAfterUse::YES, 11025, 0);
+	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream);
 }
 
 

Modified: scummvm/trunk/engines/tinsel/sound.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/sound.cpp	2010-01-19 11:21:25 UTC (rev 47376)
+++ scummvm/trunk/engines/tinsel/sound.cpp	2010-01-19 11:22:14 UTC (rev 47377)
@@ -43,6 +43,7 @@
 #include "sound/vag.h"
 #include "sound/flac.h"
 #include "sound/mp3.h"
+#include "sound/raw.h"
 #include "sound/vorbis.h"
 
 #include "gui/message.h"
@@ -153,8 +154,7 @@
 			#endif
 			break;
 		default:
-			_vm->_mixer->playRaw(type, &curChan.handle, sampleBuf, sampleLen, DisposeAfterUse::YES, 22050,
-				Audio::Mixer::FLAG_UNSIGNED);
+			sampleStream = Audio::makeRawMemoryStream(sampleBuf, sampleLen, DisposeAfterUse::YES, 22050, Audio::Mixer::FLAG_UNSIGNED);
 			break;
 		}
 		if (sampleStream) {


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