[Scummvm-cvs-logs] SF.net SVN: scummvm:[42013] scummvm/branches/gsoc2009-mods

nolange at users.sourceforge.net nolange at users.sourceforge.net
Thu Jul 2 01:11:57 CEST 2009


Revision: 42013
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42013&view=rev
Author:   nolange
Date:     2009-07-01 23:11:56 +0000 (Wed, 01 Jul 2009)

Log Message:
-----------
added a skeleton for maxtrax modules. Not much happening yet, just reading and displaying a bit of information for maxtrax file

Modified Paths:
--------------
    scummvm/branches/gsoc2009-mods/backends/platform/sdl/sdl.cpp
    scummvm/branches/gsoc2009-mods/base/main.cpp
    scummvm/branches/gsoc2009-mods/dists/msvc9/scummvm-tfmx.vcproj
    scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp
    scummvm/branches/gsoc2009-mods/sound/mods/tfmx.h
    scummvm/branches/gsoc2009-mods/sound/module.mk
    scummvm/branches/gsoc2009-mods/tfmx/module.mk
    scummvm/branches/gsoc2009-mods/tfmx/tfmxplayer.cpp

Added Paths:
-----------
    scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp
    scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h
    scummvm/branches/gsoc2009-mods/tfmx/mxtxplayer.cpp

Modified: scummvm/branches/gsoc2009-mods/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/sdl/sdl.cpp	2009-07-01 20:53:47 UTC (rev 42012)
+++ scummvm/branches/gsoc2009-mods/backends/platform/sdl/sdl.cpp	2009-07-01 23:11:56 UTC (rev 42013)
@@ -90,7 +90,7 @@
 
 	int joystick_num = ConfMan.getInt("joystick_num");
 	joystick_num = 0;
-#if !defined(TFMX_CMDLINE_TOOL)
+#if !defined(TFMX_CMDLINE_TOOL) && !defined(MXTX_CMDLINE_TOOL)
 	uint32 sdlFlags =  SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
 #else
 	uint32 sdlFlags =  /*SDL_INIT_VIDEO |*/ SDL_INIT_AUDIO | SDL_INIT_TIMER;
@@ -115,7 +115,7 @@
 
 
 	_graphicsMutex = createMutex();
-#if !defined(TFMX_CMDLINE_TOOL)
+#if !defined(TFMX_CMDLINE_TOOL) && !defined(MXTX_CMDLINE_TOOL)
 	SDL_ShowCursor(SDL_DISABLE);
 	
 	// Enable unicode support if possible

Modified: scummvm/branches/gsoc2009-mods/base/main.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/base/main.cpp	2009-07-01 20:53:47 UTC (rev 42012)
+++ scummvm/branches/gsoc2009-mods/base/main.cpp	2009-07-01 23:11:56 UTC (rev 42013)
@@ -295,8 +295,8 @@
 
 }
 
-#if defined(TFMX_CMDLINE_TOOL)
-void tfmxmain(int argc, const char * const argv[]);
+#if defined(TFMX_CMDLINE_TOOL) || defined(MXTX_CMDLINE_TOOL)
+void modcmdmain(int argc, const char * const argv[]);
 
 extern "C" int scummvm_main(int argc, const char * const argv[]) {
 	Common::String specialDebug;
@@ -317,7 +317,7 @@
 	system.initBackend();
 
 	// pass control to my own main-function, including arguments
-	tfmxmain(argc,argv);
+	modcmdmain(argc,argv);
 
 	PluginManager::instance().unloadPlugins();
 	PluginManager::destroy();

Modified: scummvm/branches/gsoc2009-mods/dists/msvc9/scummvm-tfmx.vcproj
===================================================================
--- scummvm/branches/gsoc2009-mods/dists/msvc9/scummvm-tfmx.vcproj	2009-07-01 20:53:47 UTC (rev 42012)
+++ scummvm/branches/gsoc2009-mods/dists/msvc9/scummvm-tfmx.vcproj	2009-07-01 23:11:56 UTC (rev 42013)
@@ -223,7 +223,7 @@
 				Optimization="0"
 				InlineFunctionExpansion="0"
 				AdditionalIncludeDirectories="../../;../../engines"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;TFMX_CMDLINE_TOOL"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NOT_TFMX_CMDLINE_TOOL;MXTX_CMDLINE_TOOL"
 				MinimalRebuild="true"
 				ExceptionHandling="1"
 				BasicRuntimeChecks="3"
@@ -1145,6 +1145,14 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\sound\mods\maxtrax.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\..\sound\mods\maxtrax.h"
+					>
+				</File>
+				<File
 					RelativePath="..\..\sound\mods\module.cpp"
 					>
 				</File>
@@ -2085,6 +2093,10 @@
 			Name="TFMX"
 			>
 			<File
+				RelativePath="..\..\tfmx\mxtxplayer.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\TFMX\README.txt"
 				>
 			</File>

Added: scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp	                        (rev 0)
+++ scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp	2009-07-01 23:11:56 UTC (rev 42013)
@@ -0,0 +1,32 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/scummsys.h"
+#include "common/endian.h"
+#include "common/stream.h"
+#include "common/util.h"
+#include "common/debug.h"
+
+#include "sound/mods/maxtrax.h"
\ No newline at end of file


Property changes on: scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Id URL
Added: svn:eol-style
   + native

Added: scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h	                        (rev 0)
+++ scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h	2009-07-01 23:11:56 UTC (rev 42013)
@@ -0,0 +1,43 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef SOUND_MODS_MAXTRAX_H
+#define SOUND_MODS_MAXTRAX_H
+
+#include "sound/mods/paula.h"
+
+namespace Audio {
+
+class MaxTrax : public Paula {
+public:
+	MaxTrax(int rate, bool stereo);
+	virtual ~MaxTrax();
+
+	void interrupt();
+};
+
+}	// End of namespace Audio
+
+#endif
\ No newline at end of file


Property changes on: scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Id URL
Added: svn:eol-style
   + native

Modified: scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp	2009-07-01 20:53:47 UTC (rev 42012)
+++ scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp	2009-07-01 23:11:56 UTC (rev 42013)
@@ -993,4 +993,4 @@
 	return -1;
 }
 
-}
+}	// End of namespace Audio

Modified: scummvm/branches/gsoc2009-mods/sound/mods/tfmx.h
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/tfmx.h	2009-07-01 20:53:47 UTC (rev 42012)
+++ scummvm/branches/gsoc2009-mods/sound/mods/tfmx.h	2009-07-01 23:11:56 UTC (rev 42013)
@@ -291,6 +291,6 @@
 	void noteCommand(uint8 note, uint8 param1, uint8 param2, uint8 param3);
 };
 
-}
+}	// End of namespace Audio
 
 #endif

Modified: scummvm/branches/gsoc2009-mods/sound/module.mk
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/module.mk	2009-07-01 20:53:47 UTC (rev 42012)
+++ scummvm/branches/gsoc2009-mods/sound/module.mk	2009-07-01 23:11:56 UTC (rev 42013)
@@ -24,6 +24,7 @@
 	vorbis.o \
 	wave.o \
 	mods/infogrames.o \
+	mods/maxtrax.o \
 	mods/module.o \
 	mods/protracker.o \
 	mods/paula.o \

Modified: scummvm/branches/gsoc2009-mods/tfmx/module.mk
===================================================================
--- scummvm/branches/gsoc2009-mods/tfmx/module.mk	2009-07-01 20:53:47 UTC (rev 42012)
+++ scummvm/branches/gsoc2009-mods/tfmx/module.mk	2009-07-01 23:11:56 UTC (rev 42013)
@@ -1,6 +1,7 @@
 MODULE := tfmx
 
 MODULE_OBJS := \
+	mxtxplayer.o \
 	tfmxplayer.o \
 	tfmxdebug.o
 

Added: scummvm/branches/gsoc2009-mods/tfmx/mxtxplayer.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/tfmx/mxtxplayer.cpp	                        (rev 0)
+++ scummvm/branches/gsoc2009-mods/tfmx/mxtxplayer.cpp	2009-07-01 23:11:56 UTC (rev 42013)
@@ -0,0 +1,214 @@
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "common/stream.h"
+#include "common/file.h"
+#include "common/fs.h"
+#include "common/endian.h"
+#include "common/debug.h"
+
+#include "sound/mixer.h"
+#include "sound/mods/maxtrax.h"
+
+#if defined(MXTX_CMDLINE_TOOL)
+
+// #include "tfmx/tfmxdebug.h"
+
+#define FILEDIR "" 
+
+using namespace Common;
+
+#define MUSICFILE "introscr.mx"
+
+bool load(Common::SeekableReadStream &musicData) {
+	bool res = false;
+
+	char buf[2 * 1024];
+	uint16 tempo, flags;
+	uint16 numScores;
+
+	// 0x0000: 4 Bytes Header "MXTX"
+	// 0x0004: uint16 tempo
+	// 0x0006: uint16 flags. bit0 = lowpassfilter, bit1 = attackvolume, bit15 = microtonal
+	musicData.read(buf, 4);
+	tempo = musicData.readUint16BE();
+	flags = musicData.readUint16BE();
+	buf[4] = '\0';
+	debug("Header: %s %02X %02X", buf, tempo, flags);
+
+	if (flags & (1 << 15)) {
+		// uint16 microtonal[128]
+		musicData.skip(128 * 2);
+	}
+
+	// uint16 number of Scores
+	numScores = musicData.readUint16BE();
+	debug("#Scores: %d", numScores);
+	int scoresLoaded = 0;
+	byte *scorePtr; // array of scorestructures
+	for (int i = 0; i < numScores; ++i) {
+		uint32 numEvents = musicData.readUint32BE();
+		uint32 dataLength = numEvents * 6;
+		const int scoremax = 128; // some variable which is set upon initialisation of player
+		if (scoresLoaded < scoremax) {
+			// allocate dataLength zeroed bytes
+			// increase _globaldata+glob_TotalScores and _maxtrax+mxtx_TotalScores
+			// load events data
+			debug("score %i: %i Events", scoresLoaded, numEvents);
+			for (int j = 0; j < numEvents; ++j) {
+				byte command, data;
+				uint16 startTime, stopTime;
+				command = musicData.readByte();
+				data = musicData.readByte();
+				startTime = musicData.readUint16BE();
+				stopTime = musicData.readUint16BE();
+				debug("cmd, data, start, stop: %02X, %02X, %04X, %04X", command, data, startTime, stopTime);
+
+			}
+			debug("");
+			// store pointer to events and # events in scorePtr, then increase scorePtr by structsize
+			scoresLoaded++;
+		} else
+			musicData.skip(dataLength);
+	}
+
+	uint16 numSamples;
+	// uint16 number of Samples
+	numSamples = numSamples.readUint16BE();
+	for (int i = 0; i < numSamples; ++i) {
+		// load disksample structure
+		uint16 number = musicData.readUint16BE();
+		uint16 tune = musicData.readUint16BE();
+		uint16 volume = musicData.readUint16BE();
+		uint16 octaves = musicData.readUint16BE();
+		uint32 attackLen = musicData.readUint32BE();
+		uint32 sustainLen = musicData.readUint32BE();
+		uint16 attackCount = musicData.readUint16BE();
+		uint16 releaseCount = musicData.readUint16BE();
+
+		byte *samplePtr = 0; // samplestructure ptrs
+		samplePtr += number;
+
+		byte *patchPtr = 0; // array of patchstructs
+		patchPtr += number;
+
+		// Tune and Volume Info
+		// copy tune, volume to patch_Tune, patch_Volume
+
+		// Attack Segment
+		int attacksize = attackCount * 4;
+		// allocate attacksize bytes
+		// store allocated Ptr in patch_Attack
+		// store attackCount in patch_AttackCount
+
+		// read attack segment
+		for (int j = 0; j < attackCount; ++j) {
+			uint16 envDuration = musicData.readUint16BE();
+			uint16 envVolume = musicData.readUint16BE();
+			// store into patch_Attack
+		}
+
+		// Release Segment
+		int releasesize = releaseCount * 4;
+		// allocate releasesize bytes
+		// store allocated Ptr in patch_Release
+		// store attackCount in patch_ReleaseCount
+
+		// read release segment
+		for (int j = 0; j < releaseCount; ++j) {
+			uint16 envDuration = musicData.readUint16BE();
+			uint16 envVolume = musicData.readUint16BE();
+			// store into patch_Release
+		}
+
+
+
+
+
+
+
+
+
+
+
+
+
+	}
+
+	/*		
+
+		STRUCTURE	PatchData,0
+			APTR	patch_Sample				; Amiga sample data		
+			APTR	patch_Attack				; array of env. segments	
+			APTR	patch_Release				; array of env. segments	
+			WORD	patch_AttackCount			; number of attack env.	
+			WORD	patch_ReleaseCount			; number of release env.	
+			WORD	patch_Volume				; sample volume 			
+			WORD	patch_Tune					; sample tuning			
+			BYTE	patch_Number				; self-identifing			
+			BYTE	patch_pad
+			LABEL	patch_sizeof
+			
+		STRUCTURE	DiskSample,0
+			WORD	dsamp_Number
+			WORD	dsamp_Tune
+			WORD	dsamp_Volume
+			WORD	dsamp_Octaves
+			LONG	dsamp_AttackLength
+			LONG	dsamp_SustainLength
+			WORD	dsamp_AttackCount
+			WORD	dsamp_ReleaseCount
+			LABEL	dsamp_sizeof
+
+		STRUCTURE	CookedEvent,0
+			BYTE	cev_Command
+			BYTE	cev_Data
+			WORD	cev_StartTime
+			WORD	cev_StopTime
+			LABEL	cev_sizeof
+
+		STRUCTURE	EnvelopeData,0
+			WORD	env_Duration				; duration in milliseconds	
+			WORD	env_Volume					; volume of envelope		
+			LABEL	env_sizeof
+
+		STRUCTURE	SampleData,0
+			APTR	samp_NextSample
+			APTR	samp_Waveform
+			LONG	samp_AttackSize
+			LONG	samp_SustainSize
+			LABEL	samp_sizeof
+			*/
+	return res;
+}
+
+void *loadMtmxfile(const char *mdatName) {
+	FSNode fileDir(FILEDIR);
+	FSNode musicNode = fileDir.getChild(mdatName);
+	SeekableReadStream *musicIn = musicNode.createReadStream();
+	if (0 == musicIn) {
+		debug("Couldnt load file %s", mdatName);
+		return 0;
+	}
+
+	load(*musicIn);
+
+
+	delete musicIn;
+
+	return 0;
+}
+
+void modcmdmain(const int argc, const char *const argv[]) {
+	debug("Started Scumm&VM");
+	debug("Sound celebrating utility for malcoms menace & Various Malfunctions");
+	debug("");
+
+	loadMtmxfile(MUSICFILE);
+
+#ifdef _MSC_VER
+	printf("\npress a key");
+	getc(stdin);
+#endif
+}
+
+#endif // #if defined(MXTX_CMDLINE_TOOL)
\ No newline at end of file


Property changes on: scummvm/branches/gsoc2009-mods/tfmx/mxtxplayer.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Id URL
Added: svn:eol-style
   + native

Modified: scummvm/branches/gsoc2009-mods/tfmx/tfmxplayer.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/tfmx/tfmxplayer.cpp	2009-07-01 20:53:47 UTC (rev 42012)
+++ scummvm/branches/gsoc2009-mods/tfmx/tfmxplayer.cpp	2009-07-01 23:11:56 UTC (rev 42013)
@@ -7,9 +7,10 @@
 #include "common/debug.h"
 
 #include "sound/mixer.h"
-#include "sound/mods/protracker.h"
 #include "sound/mods/tfmx.h"
 
+#if defined(TFMX_CMDLINE_TOOL)
+
 #include "tfmx/tfmxdebug.h"
 
 #define FILEDIR "" 
@@ -46,7 +47,7 @@
 
 void runFlac(int chan, int bits, int sr, const char *fileName);
 
-void tfmxmain(const int argc, const char *const argv[]) {
+void modcmdmain(const int argc, const char *const argv[]) {
 	debug("Started Scumm&VM");
 	debug("Sound celebrating utility for monkey melodies & Various Malfunctions");
 	debug("");
@@ -167,4 +168,4 @@
 	system(cmd);
 }
 
-
+#endif // #if defined(TFMX_CMDLINE_TOOL)


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