[Scummvm-cvs-logs] SF.net SVN: scummvm: [33019] scummvm/branches/gsoc2008-tfmx/sound/mods

marwanhilmi at users.sourceforge.net marwanhilmi at users.sourceforge.net
Sun Jul 13 04:13:48 CEST 2008


Revision: 33019
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33019&view=rev
Author:   marwanhilmi
Date:     2008-07-12 19:13:48 -0700 (Sat, 12 Jul 2008)

Log Message:
-----------
Added loader to macro processing function. 

Modified Paths:
--------------
    scummvm/branches/gsoc2008-tfmx/sound/mods/tfmx.cpp
    scummvm/branches/gsoc2008-tfmx/sound/mods/tfmx.h

Modified: scummvm/branches/gsoc2008-tfmx/sound/mods/tfmx.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/sound/mods/tfmx.cpp	2008-07-13 00:58:56 UTC (rev 33018)
+++ scummvm/branches/gsoc2008-tfmx/sound/mods/tfmx.cpp	2008-07-13 02:13:48 UTC (rev 33019)
@@ -388,6 +388,33 @@
 void Tfmx::updateNote(uint8 trackNumber) {
 }
 void Tfmx::doMacros(uint8 trackNumber) {
+	//Quick copy and paste: will load macro in similiar fashion as pattern data and then be able to cycle through it
+	uint32 startPosition;
+	uint32 endPosition;
+	int32 numCommands;		//number of longword pattern commands or notes
+	startPosition = _macroPointers[_tracks[trackNumber].pattern.note.macroNumber]; // -> might need this for jump commands: + _tracks[trackNumber].pattern.note.macroOffset;
+	endPosition = _macroPointers[_tracks[trackNumber].pattern.note.macroNumber + 1];
+	numCommands = (endPosition - startPosition) / 4; //long word commands also - so 4 per line
+
+	Common::MemoryReadStream dataStream(_data, _dataSize);
+	Common::SeekableSubReadStream macroSubStream(&dataStream, startPosition, endPosition);
+
+	_tracks[trackNumber].macro.data = new uint32[numCommands];
+	for (int i = 0; i < numCommands; i++) {
+		_tracks[trackNumber].macro.data[i] = macroSubStream.readUint32BE();
+	}
+	//
+
+	//now macro data is accessible
+	//IMPORTANT CASES TO SETUP FOR SAMPLE LOADING
+	//00 : DMA Reset
+	//01 : DMA Start
+	//02 : Sample Offset
+	//03 : Sample Length
+	//04 : Wait
+	//07 : End Macro
+	//13 : DMA Off
+
 }
 void Tfmx::stopPlayer() {
 	for(int i = 0; i < 8; i++) {

Modified: scummvm/branches/gsoc2008-tfmx/sound/mods/tfmx.h
===================================================================
--- scummvm/branches/gsoc2008-tfmx/sound/mods/tfmx.h	2008-07-13 00:58:56 UTC (rev 33018)
+++ scummvm/branches/gsoc2008-tfmx/sound/mods/tfmx.h	2008-07-13 02:13:48 UTC (rev 33019)
@@ -86,6 +86,8 @@
 		}_songs[32];
 		
 		//Note structure
+		//Will eliminate after revision and read these properties directly 
+		//into Macro structure and Channel structure
 		struct Note {
 			uint8 noteNumber;
 			uint8 macroNumber;
@@ -113,6 +115,13 @@
 		//	uint16 loopCount;
 		};
 
+		//Macro structure for macro data; very similiar to pattern data
+		struct Macro {
+			uint32 *data;
+			//uint8 number;
+			//will need some other properties here
+		};
+
 		//Sample structure; initialized by macro commands
 		struct Sample {
 			int8 *data;
@@ -127,8 +136,9 @@
 			uint16 data;
 			bool updateFlag;
 			bool activeFlag;
+			Pattern pattern;
+			Macro macro;
 			Sample sample;
-			Pattern pattern;
 		//	uint16 volume;
 		//	bool loopFlag;
 		//	uint16 loopCount;


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