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

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Thu Feb 15 23:07:44 CET 2007


Revision: 25615
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25615&view=rev
Author:   drmccoy
Date:     2007-02-15 14:07:44 -0800 (Thu, 15 Feb 2007)

Log Message:
-----------
- Changed the speaker stuff again
- Added the spanish gob2 version from bug report #1659884

Modified Paths:
--------------
    scummvm/trunk/engines/gob/detection.cpp
    scummvm/trunk/engines/gob/inter_v1.cpp
    scummvm/trunk/engines/gob/sound.cpp
    scummvm/trunk/engines/gob/sound.h

Modified: scummvm/trunk/engines/gob/detection.cpp
===================================================================
--- scummvm/trunk/engines/gob/detection.cpp	2007-02-15 21:43:56 UTC (rev 25614)
+++ scummvm/trunk/engines/gob/detection.cpp	2007-02-15 22:07:44 UTC (rev 25615)
@@ -316,6 +316,18 @@
 		GF_GOB2,
 		"intro"
 	},
+	{ // Supplied by arcepi in bug report #1659884
+		{
+			"gob2",
+			"",
+			AD_ENTRY1s("intro.stk", "5f53c56e3aa2f1e76c2e4f0caa15887f", 829232),
+			ES_ESP,
+			kPlatformPC,
+			Common::ADGF_NO_FLAGS
+		},
+		GF_GOB2,
+		"intro"
+	},
 	{
 		{
 			"gob2",

Modified: scummvm/trunk/engines/gob/inter_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v1.cpp	2007-02-15 21:43:56 UTC (rev 25614)
+++ scummvm/trunk/engines/gob/inter_v1.cpp	2007-02-15 22:07:44 UTC (rev 25615)
@@ -1467,8 +1467,9 @@
 
 		if (flag != 1) {
 			if (flag != 2) {
+				_vm->_snd->speakerOnUpdate(flag);
 				if (flag < 20) {
-					_vm->_util->delay(flag * 2);
+					_vm->_util->delay(flag);
 					_noBusyWait = true;
 				}
 				else

Modified: scummvm/trunk/engines/gob/sound.cpp
===================================================================
--- scummvm/trunk/engines/gob/sound.cpp	2007-02-15 21:43:56 UTC (rev 25614)
+++ scummvm/trunk/engines/gob/sound.cpp	2007-02-15 22:07:44 UTC (rev 25615)
@@ -36,6 +36,7 @@
 	_periodSamples = 0;
 	_remainingSamples = 0;
 	_sampleValue = 0;
+	_mixedSamples = 0;
 }
 
 void Snd::SquareWaveStream::playNote(int freq, int32 ms, uint rate) {
@@ -50,8 +51,31 @@
 		_remainingSamples = (_rate * ms) / 1000;
 		_beepForever = false;
 	}
+	_mixedSamples = 0;
 }
 
+void Snd::SquareWaveStream::stop(uint32 milis) {
+	if (!_beepForever)
+		return;
+
+	if (milis)
+		update(milis);
+	else
+		_remainingSamples = 0;
+}
+
+void Snd::SquareWaveStream::update(uint32 milis) {
+	uint32 neededSamples;
+
+	if (!_beepForever || !_remainingSamples)
+		return;
+
+	neededSamples = (_rate * milis) / 1000;
+	_remainingSamples =
+		neededSamples > _mixedSamples ? neededSamples - _mixedSamples : 0;
+	_beepForever = false;
+}
+
 int Snd::SquareWaveStream::readBuffer(int16 *buffer, const int numSamples) {
 	for (int i = 0; i < numSamples; i++) {
 		if (!_remainingSamples) {
@@ -65,6 +89,7 @@
 		}
 		if (!_beepForever)
 			_remainingSamples--;
+		_mixedSamples++;
 	}
 
 	return numSamples;
@@ -107,12 +132,17 @@
 
 void Snd::speakerOn(int16 frequency, int32 length) {
 	_speakerStream.playNote(frequency, length, _vm->_mixer->getOutputRate());
+	_speakerStartTimeKey = _vm->_util->getTimeKey();
 }
 
 void Snd::speakerOff(void) {
-	_speakerStream.stop();
+	_speakerStream.stop(_vm->_util->getTimeKey() - _speakerStartTimeKey);
 }
 
+void Snd::speakerOnUpdate(uint32 milis) {
+	_speakerStream.update(milis);
+}
+
 void Snd::stopSound(int16 fadeLength)
 {
 	Common::StackLock slock(_mutex);

Modified: scummvm/trunk/engines/gob/sound.h
===================================================================
--- scummvm/trunk/engines/gob/sound.h	2007-02-15 21:43:56 UTC (rev 25614)
+++ scummvm/trunk/engines/gob/sound.h	2007-02-15 22:07:44 UTC (rev 25615)
@@ -51,6 +51,7 @@
 	Snd(GobEngine *vm);
 	void speakerOn(int16 frequency, int32 length);
 	void speakerOff(void);
+	void speakerOnUpdate(uint32 milis);
 	SoundDesc *loadSoundData(const char *path);
 	void stopSound(int16 fadeLength);
 	void playSample(SoundDesc *sndDesc, int16 repCount, int16 frequency, int16 fadeLength = 0);
@@ -79,6 +80,7 @@
 		uint32 _periodLength;
 		uint32 _periodSamples;
 		uint32 _remainingSamples;
+		uint32 _mixedSamples;
 		int16 _sampleValue;
 
 	public:
@@ -86,7 +88,8 @@
 		~SquareWaveStream() {}
 
 		void playNote(int freq, int32 ms, uint rate);
-		void stop(void) { _remainingSamples = 0; }
+		void update(uint32 milis);
+		void stop(uint32 milis);
 
 		int readBuffer(int16 *buffer, const int numSamples);
 
@@ -98,6 +101,8 @@
 
 	SquareWaveStream _speakerStream;
 	Audio::SoundHandle _speakerHandle;
+	uint32 _speakerStartTimeKey;
+
 	Audio::SoundHandle *_activeHandle;
 	Audio::SoundHandle _compositionHandle;
 	


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