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

nolange at users.sourceforge.net nolange at users.sourceforge.net
Fri Jul 10 17:04:41 CEST 2009


Revision: 42339
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42339&view=rev
Author:   nolange
Date:     2009-07-10 15:04:41 +0000 (Fri, 10 Jul 2009)

Log Message:
-----------
added initialisation of channels

Modified Paths:
--------------
    scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp
    scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h

Modified: scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp	2009-07-10 14:58:58 UTC (rev 42338)
+++ scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp	2009-07-10 15:04:41 UTC (rev 42339)
@@ -48,6 +48,9 @@
 
 	uint32 colorClock = kPalSystemClock / 2;
 
+	for (int i = 0; i < kNumChannels; ++i)
+		resetChannel(_channelCtx[i], (i & 1) != 0);
+
 	// init extraChannel
 	// extraChannel. chan_Number = 16, chan_Flags = chan_VoicesActive = 0
 }
@@ -263,7 +266,7 @@
 			if (voice.channel->volume < (1 << 7))
 				vol = (vol * voice.channel->volume) >> 7;
 
-			newVolume = (byte)MAX(vol, (uint16)0x64);
+			newVolume = (byte)MIN(vol, (uint16)0x64);
 			voice.lastVolume = newVolume;
 
 			if ((voice.flags & VoiceContext::kFlagPortamento) != 0) {
@@ -499,6 +502,23 @@
 	}
 }
 
+void MaxTrax::resetChannel(ChannelContext &chan, bool rightChannel) {
+	chan.modulation = 0;
+	chan.modulationTime = 1000;
+	chan.microtonal = -1;
+	chan.portamento = 500;
+	chan.pitchBend = 64 << 7;
+	chan.pitchReal = 0;
+	chan.pitchBendRange = 24;
+	chan.volume = 128;
+	chan.flags &= ~ChannelContext::kFlagPortamento & ~ChannelContext::kFlagMicrotonal;
+	chan.flags |= ChannelContext::kFlagAltered;
+	if (rightChannel)
+		chan.flags |= ChannelContext::kFlagRightChannel;
+	else
+		chan.flags &= ~ChannelContext::kFlagRightChannel;
+}
+
 void MaxTrax::freeScores() {
 	if (_scores) {
 		for (int i = 0; i < _numScores; ++i)

Modified: scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h	2009-07-10 14:58:58 UTC (rev 42338)
+++ scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h	2009-07-10 15:04:41 UTC (rev 42339)
@@ -202,6 +202,7 @@
 	void stopMusic();
 	void freePatches();
 	void freeScores();
+	void resetChannel(ChannelContext &chan, bool rightChannel);
 
 	int calcNote(VoiceContext &voice);
 	int8 noteOn(ChannelContext &channel, byte note, uint16 volume, uint16 pri);


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