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

nolange at users.sourceforge.net nolange at users.sourceforge.net
Wed Jun 10 17:51:08 CEST 2009


Revision: 41434
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41434&view=rev
Author:   nolange
Date:     2009-06-10 15:51:08 +0000 (Wed, 10 Jun 2009)

Log Message:
-----------
Finally fixed weird volume effects by fixing "wait on keyup"
Added commandline option to output to flac

Modified Paths:
--------------
    scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp
    scummvm/branches/gsoc2009-mods/tfmx/tfmxplayer.cpp

Modified: scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp	2009-06-10 15:33:37 UTC (rev 41433)
+++ scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp	2009-06-10 15:51:08 UTC (rev 41434)
@@ -86,6 +86,12 @@
 			} else
 				--channel.macroWait;
 		}
+
+		// TODO: handling pending DMAOff?
+
+		// set volume after macros were run.
+		uint8 finVol = _playerCtx.volume * channel.volume >> 6;
+		Paula::setChannelVolume(channel.paulaChannel, finVol);
 	}
 
 	// Patterns are only processed each _playerCtx.timerCount + 1 tick
@@ -174,9 +180,6 @@
 	// Fade
 
 	// Volume
-	// FIXME
-	uint8 finVol = _playerCtx.volume * channel.volume >> 6;
-	Paula::setChannelVolume(channel.paulaChannel, finVol);
 }
 
 static void warnMacroUnimplemented(const byte *macroPtr, int level) {
@@ -207,7 +210,7 @@
 		// TODO: implement PArameters
 		Paula::disableChannel(channel.paulaChannel);
 		channel.deferWait = macroPtr[1] >= 1;
-		if	(channel.deferWait) {
+		if (channel.deferWait) {
 			// if set, then we expect a DMA On in the same tick.
 			channel.period = 4;
 			Paula::setChannelPeriod(channel.paulaChannel, channel.period);
@@ -216,15 +219,17 @@
 			// would halt the macroprogamm to continue instead.
 			// those commands are: Wait, WaitDMA, AddPrevNote, AddNote, SetNote, <unknown Cmd>
 			// DMA On is affected aswell
-			// TODO remember time disabled?.
+			// TODO remember time disabled, remember pending dmaoff?.
 		} else {
 			//TODO ?
+			Paula::disableChannel(channel.paulaChannel);
 		}
-		channel.volume = 0;
-		Paula::setChannelVolume(channel.paulaChannel, channel.volume);
 
-		if (macroPtr[2] != 0 || macroPtr[3] != 0)
-			debug("DMA Off: Parameters not implemented %02X%02X%02X", macroPtr[1], macroPtr[2], macroPtr[3]);
+		if (macroPtr[2])
+			channel.volume = macroPtr[3];
+		else if (macroPtr[3])
+			channel.volume = channel.relVol * 3 + macroPtr[3];
+		debug("DMA Off: %02X %02X%02X%02X", macroPtr[0], macroPtr[1], macroPtr[2], macroPtr[3]);
 		return true;
 
 	case 0x01:	// DMA On
@@ -349,6 +354,7 @@
 		} else if (channel.macroLoopCount == 0xFF)
 			channel.macroLoopCount = macroPtr[3];
 		--channel.macroLoopCount;
+		--channel.macroStep;
 		return false;
 
 	case 0x15:	// Subroutine. Parameters: MacroIndex, Macrostep(W)
@@ -840,6 +846,7 @@
 		clearEffects(_channelCtx[i]);
 		_channelCtx[i].vibValue = 0;
 		stopChannel(_channelCtx[i]);
+		_channelCtx[i].volume = 0;
 	}
 
 	noteCommand((uint8)note, (uint8)macro, (uint8)channel, 0);
@@ -885,6 +892,7 @@
 		clearEffects(_channelCtx[i]);
 		_channelCtx[i].vibValue = 0;
 		stopChannel(_channelCtx[i]);
+		_channelCtx[i].volume = 0;
 	}
 
 	setTimerBaseValue(kPalCiaClock);

Modified: scummvm/branches/gsoc2009-mods/tfmx/tfmxplayer.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/tfmx/tfmxplayer.cpp	2009-06-10 15:33:37 UTC (rev 41433)
+++ scummvm/branches/gsoc2009-mods/tfmx/tfmxplayer.cpp	2009-06-10 15:51:08 UTC (rev 41434)
@@ -99,39 +99,37 @@
 	}
 
 	int i = 1;
-	int playflag = 0;
+	int playflag = 1;
+	bool hasCmd = false;
 
 	
-	if (i < argc && argv[i][0] == '-' && strlen(argv[i]) == 2) {
+	while (i < argc && argv[i][0] == '-') {
 		int param;
-		switch (argv[i++][1]) {
-		case 'm':
-			if (i < argc) {
-				param = atoi(argv[i]);
+		if (!strcmp("-m", argv[i])) {
+			if (i + 1 < argc) {
+				param = atoi(argv[++i]);
 				debug( "play Macro %02X", param);
 				dumpMacro(*player, param);
-				playflag = 1;
 				player->doMacro(param,param);
-				++i;
+				hasCmd = true;
 			}
-			break;
-		case 's':
-			if (i < argc) {
-				param = atoi(argv[i]);
+		} else if (!strcmp("-s", argv[i])) {
+			if (i + 1 < argc) {
+				param = atoi(argv[++i]);
 				debug( "play Song %02X", param);
 				dumpTrackstepsBySong(*player, param);
-				playflag = 1;
 				player->doSong(param);
-				++i;
+				hasCmd = true;
 			}
+		} else  if (!strcmp("-flac", argv[i])) {
+			playflag = 2;
 		}
+		++i;
 	}
 
-	if (!playflag) {
-		playflag = 1;
-		player->doMacro(0x17,0x1B);
-		//player->doSong(4);
-		//dumpTrackstepsBySong(*player, 4);
+	if (!hasCmd) {
+		player->doSong(4);
+		dumpTrackstepsBySong(*player, 4);
 	}
 
 


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