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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Thu Oct 19 07:37:34 CEST 2006


Revision: 24387
          http://svn.sourceforge.net/scummvm/?rev=24387&view=rev
Author:   kirben
Date:     2006-10-18 22:37:22 -0700 (Wed, 18 Oct 2006)

Log Message:
-----------
Add option to load a module via stream

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.cpp
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/sound/mods/module.cpp
    scummvm/trunk/sound/mods/module.h
    scummvm/trunk/sound/mods/protracker.cpp
    scummvm/trunk/sound/mods/protracker.h

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2006-10-19 05:28:05 UTC (rev 24386)
+++ scummvm/trunk/engines/agos/agos.cpp	2006-10-19 05:37:22 UTC (rev 24387)
@@ -34,6 +34,7 @@
 #include "agos/vga.h"
 
 #include "sound/mididrv.h"
+#include "sound/mods/protracker.h"
 
 #ifdef PALMOS_68K
 #include "globals.h"
@@ -386,6 +387,7 @@
 
 	_vgaTickCounter = 0;
 
+	_modPlayer = 0;
 	_moviePlay = 0;
 	_sound = 0;
 
@@ -510,9 +512,12 @@
 	setupGame();
 
 	_debugger = new Debugger(this);
-	_moviePlay = new MoviePlayer(this, _mixer);
+	_modPlayer = new Modules::ProtrackerPlayer();
 	_sound = new Sound(this, gss, _mixer);
 
+	_modPlayer->init(_system);
+	_moviePlay = new MoviePlayer(this, _mixer);
+
 	if (ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute") == 1) {
 		if (getGameId() == GID_SIMON1DOS)
 			midi._enable_sfx ^= 1;
@@ -757,6 +762,7 @@
 	delete [] _windowList;
 
 	delete _debugger;
+	delete _modPlayer;
 	delete _moviePlay;
 	delete _sound;
 }
@@ -1353,8 +1359,7 @@
 			if (getGameType() != GType_FF && getGameType() != GType_PP && _keyPressed == 35)
 				displayBoxStars();
 			if (processSpecialKeys() != 0) {
-				_needHitAreaRecalc++;
-				return;
+				goto out_of_here;
 			}
 			if (_lastHitArea3 == (HitArea *) -1)
 				goto startOver;
@@ -1472,6 +1477,7 @@
 		}
 	}
 
+out_of_here:
 	if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
 		clearMenuStrip();
 
@@ -2434,7 +2440,6 @@
 	if (getPlatform() == Common::kPlatformAtariST) {
 		// TODO: Add support for music format used by Elvira 2
 	} else if (getPlatform() == Common::kPlatformAmiga) {
-		/*
 		_modPlayer->stop();
 
 		char filename[15];
@@ -2447,7 +2452,7 @@
 
 		f.open(filename);
 		if (f.isOpen() == false) {
-			error("loadMusic: Can't load music from '%s'", filename);
+			error("loadMusic: Can't load module from '%s'", filename);
 		}
 
 		if (!(getGameType() == GType_ELVIRA1 && getFeatures() & GF_DEMO) &&
@@ -2468,7 +2473,6 @@
 			_modPlayer->loadModuleStream(f);
 		}
 		_modPlayer->start();
-		*/
 	} else if (getGameType() == GType_SIMON2) {
 		midi.stop();
 		_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET);

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-10-19 05:28:05 UTC (rev 24386)
+++ scummvm/trunk/engines/agos/agos.h	2006-10-19 05:37:22 UTC (rev 24387)
@@ -33,8 +33,11 @@
 #include "agos/midi.h"
 #include "agos/sound.h"
 #include "agos/vga.h"
+
 #include "common/advancedDetector.h"
 
+#include "sound/mods/protracker.h"
+
 namespace AGOS {
 
 /* Various other settings */
@@ -492,6 +495,7 @@
 	int _vgaTickCounter;
 
 	MoviePlayer *_moviePlay;
+	Modules::ProtrackerPlayer *_modPlayer;
 
 	Sound *_sound;
 

Modified: scummvm/trunk/sound/mods/module.cpp
===================================================================
--- scummvm/trunk/sound/mods/module.cpp	2006-10-19 05:28:05 UTC (rev 24386)
+++ scummvm/trunk/sound/mods/module.cpp	2006-10-19 05:37:22 UTC (rev 24387)
@@ -46,6 +46,14 @@
 
 	Common::MemoryReadStream st(buf, bufsz);
 
+	bool result = loadStream(st);
+
+	delete[] buf;
+	
+	return result;
+}
+
+bool Module::loadStream(Common::SeekableReadStream &st) {
 	st.read(songname, 20);
 	songname[0] = '\0';
 
@@ -155,8 +163,6 @@
 
 	assert(st.eos());
 
-	delete[] buf;
-
 	return true;
 }
 

Modified: scummvm/trunk/sound/mods/module.h
===================================================================
--- scummvm/trunk/sound/mods/module.h	2006-10-19 05:28:05 UTC (rev 24386)
+++ scummvm/trunk/sound/mods/module.h	2006-10-19 05:37:22 UTC (rev 24387)
@@ -24,6 +24,8 @@
 #ifndef SOUND_MODS_MODULE_H
 #define SOUND_MODS_MODULE_H
 
+#include "common/file.h"
+
 namespace Modules {
 
 /*
@@ -68,6 +70,7 @@
 	~Module();
 
 	bool load(const char *fn);
+	bool loadStream(Common::SeekableReadStream &st);
 };
 
 } // End of namespace Modules

Modified: scummvm/trunk/sound/mods/protracker.cpp
===================================================================
--- scummvm/trunk/sound/mods/protracker.cpp	2006-10-19 05:28:05 UTC (rev 24386)
+++ scummvm/trunk/sound/mods/protracker.cpp	2006-10-19 05:37:22 UTC (rev 24387)
@@ -78,6 +78,14 @@
 	_module->load(fn);
 }
 
+void ProtrackerPlayer::loadModuleStream(Common::SeekableReadStream &fs) {
+	if (_module)
+		delete _module;
+
+	_module = new Module();
+	_module->loadStream(fs);
+}
+
 void ProtrackerPlayer::generateSound() {
 	_generatedSamplesOverflow += 5.0 * 44100.0 / (2.0 * _bpm);
 	int samples = (int)floor(_generatedSamplesOverflow);

Modified: scummvm/trunk/sound/mods/protracker.h
===================================================================
--- scummvm/trunk/sound/mods/protracker.h	2006-10-19 05:28:05 UTC (rev 24386)
+++ scummvm/trunk/sound/mods/protracker.h	2006-10-19 05:37:22 UTC (rev 24387)
@@ -139,6 +139,7 @@
 	void stop();
 
 	void loadModule(const char *fn);
+	void loadModuleStream(Common::SeekableReadStream &fs);
 
 	void mix(byte *buf, int len);
 


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