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

marwanhilmi at users.sourceforge.net marwanhilmi at users.sourceforge.net
Tue Jul 1 03:55:41 CEST 2008


Revision: 32862
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32862&view=rev
Author:   marwanhilmi
Date:     2008-06-30 18:55:40 -0700 (Mon, 30 Jun 2008)

Log Message:
-----------
Basic setup of readPattern() in place. Added some comments/ideas. Some small changes.

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-01 00:28:38 UTC (rev 32861)
+++ scummvm/branches/gsoc2008-tfmx/sound/mods/tfmx.cpp	2008-07-01 01:55:40 UTC (rev 32862)
@@ -28,6 +28,14 @@
 
 namespace Audio {
 
+const uint16 Tfmx::notes[] =
+	{0x06AE,0x064E,0x05F4,0x059E,0x054D,0x0501,
+	 0x04B9,0x0475,0x0435,0x03F9,0x03C0,0x038C,0x0358,0x032A,0x02FC,0x02D0,0x02A8,0x0282,
+	 0x025E,0x023B,0x021B,0x01FD,0x01E0,0x01C6,0x001AC,0x0194,0x017D,0x0168,0x0154,0x0140,
+	 0x012F,0x011E,0x010E,0x00FE,0x00F0,0x00E3,0x00D6,0x00CA,0x00BF,0x00B4,0x00AA,0x00A0,
+	 0x0097,0x008F,0x0087,0x007F,0x0078,0x0071,0x00D6,0x00CA,0x00BF,0x00B4,0x00AA,0x00A0,
+	 0x0097,0x008F,0x0087,0x007F,0x0078,0x0071,0x00D6,0x00CA,0x00BF,0x00B4};
+
 Tfmx::Tfmx(bool stereo, int rate, int interruptFreq)
 	: Paula(stereo, rate, interruptFreq) {
 	//blank now
@@ -95,7 +103,10 @@
 	}
 	
 	//trackstep read test
-	readTrackstep( 0 );
+	//readTrackstep( 0 );
+
+	//pattern read test
+	readPattern(12);
 }
 bool Tfmx::load(Common::SeekableReadStream &stream) {
 	return true;
@@ -112,7 +123,7 @@
 
 	uint32 startPosition;   //offset into file from start for trackstart
 	uint32 endPosition;     //offset into file from start for trackend
-	int32 numCommands;		//number of 1 word track commands
+	int32 numCommands;		//number of 1 word track commands or patterns
 	int32 numSteps;         //number of tracksteps; not yet useful
 	startPosition = (_songs[songNumber].startPosition * 16) + _trackTableOffset;
 	//the file specifies the start position of the last line, so you need to add 16
@@ -124,7 +135,7 @@
 	Common::MemoryReadStream dataStream(_data, _dataSize);
 	Common::SeekableSubReadStream trackSubStream(&dataStream, startPosition, endPosition);
 
-	//read entire track by each 1 word command
+	//read entire track by each 1 word command into an array - could just directly manipulate stream
 	//can then read to determine if it is a pattern or a command
 	//temporary solution - will need to organize by the 8-track per trackstep structure
 	uint16 *tracks;
@@ -133,7 +144,7 @@
 		tracks[i] = trackSubStream.readUint16BE();
 	}
 	//you can now read track[] command by command. Maybe trackSubStream can be deleted?
-	
+
 	//start track reading
 	//need to implement tempo/timing system here
 	for (int i = 0; i < numCommands; i++) {
@@ -174,13 +185,35 @@
 			//could just skip the masking for patternNumber and shift it 8 bits to the right
 			uint8 patternNumber = (tracks[i] & 0xFF00) >> 8;
 			uint8 patternTranspose = (tracks[i] & 0x00FF);
-			readPattern(patternNumber);
+			//readPattern(patternNumber);
 		}
 	}
 }
 void Tfmx::readPattern(uint8 patternNumber) {
 	//TODO: setup lookup routine which reads pattern number and then finds corresponding address
 	//maybe a stream containing the pattern should be created in same way it was done in readTrackstep()
+
+	uint32 startPosition;
+	uint32 endPosition;
+	int32 numCommands;		//number of longword pattern commands or notes
+	startPosition = _patternPointers[patternNumber];
+	endPosition = _patternPointers[patternNumber + 1];
+	numCommands = (endPosition - startPosition) / 4;
+
+	Common::MemoryReadStream dataStream(_data, _dataSize);
+	Common::SeekableSubReadStream patternSubStream(&dataStream, startPosition, endPosition);
+
+	uint32 *pattern;
+	pattern = new uint32[numCommands];
+	for (int i = 0; i < numCommands; i++) {
+		pattern[i] = patternSubStream.readUint32BE();
+	}
+	//pattern[] should now have each command or note ready for processing
+
+	//TODO: read pattern[] and determine if it is a command or note.
+	// Commands will be processed as nessecary. 
+	// Notes will be read as note structures and then passes to a seperate function for processing.
+
 }
 void Tfmx::readNote(Note _aNote) {
 }

Modified: scummvm/branches/gsoc2008-tfmx/sound/mods/tfmx.h
===================================================================
--- scummvm/branches/gsoc2008-tfmx/sound/mods/tfmx.h	2008-07-01 00:28:38 UTC (rev 32861)
+++ scummvm/branches/gsoc2008-tfmx/sound/mods/tfmx.h	2008-07-01 01:55:40 UTC (rev 32862)
@@ -57,6 +57,8 @@
 		uint32 _patternPointers[128];
 		uint32 _macroPointers[128]; 
 
+		static const uint16 notes[]; //note table , needs verification
+
 		struct Note {
 			uint8 noteValue;
 			uint8 macroNumber;
@@ -73,9 +75,18 @@
 
 		struct Channel {
 			//empty 
+			//need to implement channel structure properly
+			//will have data to send to Paula via interrupt()
 			uint8 crap;
 		}_channels[4];
 
+		struct Track {
+			//empty
+			//should setup as 8-track array 
+			//each track gets updated as trackstep progresses at predefined speed
+			uint8 crap2;
+		}_trackz[8];
+
 		//functions used in playback (in order by relationship)
 		void loadSongs();
 		void readTrackstep(uint8 songNumber);


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