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

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Mon Jul 6 20:15:50 CEST 2009


Revision: 42187
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42187&view=rev
Author:   eriktorbjorn
Date:     2009-07-06 18:15:50 +0000 (Mon, 06 Jul 2009)

Log Message:
-----------
GCC thinks it's wrong to goto past variables being initialised (even if they
aren't used afterwards). Fixed that, and some warnings.

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-06 17:37:54 UTC (rev 42186)
+++ scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp	2009-07-06 18:15:50 UTC (rev 42187)
@@ -181,6 +181,7 @@
 
 	_playerCtx.musicPlaying = true;
 	Paula::startPaula();
+	return true;
 }
 
 void MaxTrax::killVoice(byte num) {
@@ -199,6 +200,8 @@
 }
 
 int8 MaxTrax::noteOn(ChannelContext &channel, const byte note, uint16 volume, uint16 pri) {
+	bool processNote = true;
+
 	if (channel.microtonal >= 0)
 		_microtonal[note % 127] = channel.microtonal;
 	if (!volume)
@@ -223,7 +226,7 @@
 			voice.flags |= VoiceContext::kFlagPortamento;
 			voice.endNote = channel.lastNote = note;
 			voice.noteVolume = (_playerCtx.handleVolume) ? volume + 1 : 128;
-			goto endFunction;
+			processNote = false;
 		}
 	} else {
 		// TODO:
@@ -231,74 +234,75 @@
 		// return if no channel found
 		voiceNum = (channel.flags & ChannelContext::kFlagRightChannel) != 0 ? 0 : 1;
 	}
-	assert(voiceNum >= 0 && voiceNum < ARRAYSIZE(_voiceCtx));
+	if (processNote) {
+		assert(voiceNum >= 0 && voiceNum < ARRAYSIZE(_voiceCtx));
 
-	VoiceContext &voice = _voiceCtx[voiceNum];
-	voice.flags = 0;
-	if (voice.channel) {
-		killVoice(voiceNum);
-		voice.flags |= VoiceContext::kFlagStolen;
-	}
-	voice.channel = &channel;
-	voice.patch = &patch;
-	voice.baseNote = note;
+		VoiceContext &voice = _voiceCtx[voiceNum];
+		voice.flags = 0;
+		if (voice.channel) {
+			killVoice(voiceNum);
+			voice.flags |= VoiceContext::kFlagStolen;
+		}
+		voice.channel = &channel;
+		voice.patch = &patch;
+		voice.baseNote = note;
 
-	// calc note period
-	voice.priority = (byte)pri;
-	voice.status = VoiceContext::kStatusStart;
+		// calc note period
+		voice.priority = (byte)pri;
+		voice.status = VoiceContext::kStatusStart;
 
-	voice.noteVolume = (_playerCtx.handleVolume) ? volume + 1 : 128;
+		voice.noteVolume = (_playerCtx.handleVolume) ? volume + 1 : 128;
 
-	// ifeq HAS_FULLCHANVOL macro
-	if (channel.volume < 128)
-		voice.noteVolume = (voice.noteVolume * channel.volume) >> 7;
+		// ifeq HAS_FULLCHANVOL macro
+		if (channel.volume < 128)
+			voice.noteVolume = (voice.noteVolume * channel.volume) >> 7;
 
-	voice.baseVolume = 0;
-	voice.lastTicks = 0;
+		voice.baseVolume = 0;
+		voice.lastTicks = 0;
 
-	uint16 period = voice.lastPeriod;
-	if (!period)
-		period = 1000;
+		uint16 period = voice.lastPeriod;
+		if (!period)
+			period = 1000;
 
-	int useOctave = 0;
-	// get samplestart for the given octave
-	const int8 *samplePtr = patch.samplePtr + (patch.sampleTotalLen << useOctave) - patch.sampleTotalLen;
-	if (patch.sampleAttackLen) {
-		Paula::setChannelSampleStart(voiceNum, samplePtr);
-		Paula::setChannelSampleLen(voiceNum, patch.sampleAttackLen << useOctave);
-		Paula::setChannelPeriod(voiceNum, period);
-		Paula::setChannelVolume(voiceNum, 0);
-
-		Paula::enableChannel(voiceNum);
-		// wait  for dma-clear
-	}
-
-	if (patch.sampleTotalLen > patch.sampleAttackLen) {
-		Paula::setChannelSampleStart(voiceNum, samplePtr + patch.sampleAttackLen);
-		Paula::setChannelSampleLen(voiceNum, (patch.sampleTotalLen - patch.sampleAttackLen) << useOctave);
-		if (!patch.sampleAttackLen) {
-			// need to enable channel
+		int useOctave = 0;
+		// get samplestart for the given octave
+		const int8 *samplePtr = patch.samplePtr + (patch.sampleTotalLen << useOctave) - patch.sampleTotalLen;
+		if (patch.sampleAttackLen) {
+			Paula::setChannelSampleStart(voiceNum, samplePtr);
+			Paula::setChannelSampleLen(voiceNum, patch.sampleAttackLen << useOctave);
 			Paula::setChannelPeriod(voiceNum, period);
 			Paula::setChannelVolume(voiceNum, 0);
 
 			Paula::enableChannel(voiceNum);
+			// wait  for dma-clear
 		}
-		// another pointless wait for DMA-Clear???
-	}
 
-	channel.voicesActive++;
-	if (&channel < &_channelCtx[kNumChannels]) {
-		const byte flagsSet = ChannelContext::kFlagMono | ChannelContext::kFlagPortamento;
-		if ((channel.flags & flagsSet) == flagsSet && channel.lastNote < 0x80 && channel.lastNote != voice.baseNote) {
-			voice.portaTicks = 0;
-			voice.endNote = voice.baseNote;
-			voice.baseNote = channel.lastNote;
-			voice.flags |= VoiceContext::kFlagPortamento;
+		if (patch.sampleTotalLen > patch.sampleAttackLen) {
+			Paula::setChannelSampleStart(voiceNum, samplePtr + patch.sampleAttackLen);
+			Paula::setChannelSampleLen(voiceNum, (patch.sampleTotalLen - patch.sampleAttackLen) << useOctave);
+			if (!patch.sampleAttackLen) {
+				// need to enable channel
+				Paula::setChannelPeriod(voiceNum, period);
+				Paula::setChannelVolume(voiceNum, 0);
+
+				Paula::enableChannel(voiceNum);
+			}
+			// another pointless wait for DMA-Clear???
 		}
-		if ((channel.flags & ChannelContext::kFlagPortamento) != 0)
-			channel.lastNote = note;
+
+		channel.voicesActive++;
+		if (&channel < &_channelCtx[kNumChannels]) {
+			const byte flagsSet = ChannelContext::kFlagMono | ChannelContext::kFlagPortamento;
+			if ((channel.flags & flagsSet) == flagsSet && channel.lastNote < 0x80 && channel.lastNote != voice.baseNote) {
+				voice.portaTicks = 0;
+				voice.endNote = voice.baseNote;
+				voice.baseNote = channel.lastNote;
+				voice.flags |= VoiceContext::kFlagPortamento;
+			}
+			if ((channel.flags & ChannelContext::kFlagPortamento) != 0)
+				channel.lastNote = note;
+		}
 	}
-endFunction:
 	_playerCtx.addedNote = true;
 	_playerCtx.lastVoice = voiceNum;
 	return voiceNum;

Modified: scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h	2009-07-06 17:37:54 UTC (rev 42186)
+++ scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h	2009-07-06 18:15:50 UTC (rev 42187)
@@ -217,8 +217,8 @@
 	static void outPutEvent(const Event &ev, int num = -1) {
 		struct {
 			byte cmd;
-			char *name;
-			char *param;
+			const char *name;
+			const char *param;
 		} COMMANDS[] = {
 			{0x80, "TEMPO   ", "TEMPO, N/A      "},
 			{0xa0, "SPECIAL ", "CHAN, SPEC # | VAL"},
@@ -253,4 +253,4 @@
 };
 }	// End of namespace Audio
 
-#endif
\ No newline at end of file
+#endif


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