[Scummvm-cvs-logs] SF.net SVN: scummvm: [26862] scummvm/trunk/engines/cine/sound_driver.cpp

cyx at users.sourceforge.net cyx at users.sourceforge.net
Fri May 18 00:18:52 CEST 2007


Revision: 26862
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26862&view=rev
Author:   cyx
Date:     2007-05-17 15:18:51 -0700 (Thu, 17 May 2007)

Log Message:
-----------
removed unneeded if blocks

Modified Paths:
--------------
    scummvm/trunk/engines/cine/sound_driver.cpp

Modified: scummvm/trunk/engines/cine/sound_driver.cpp
===================================================================
--- scummvm/trunk/engines/cine/sound_driver.cpp	2007-05-17 22:13:31 UTC (rev 26861)
+++ scummvm/trunk/engines/cine/sound_driver.cpp	2007-05-17 22:18:51 UTC (rev 26862)
@@ -258,29 +258,27 @@
 void AdlibSoundDriverINS::setChannelFrequency(int channel, int frequency) {
 	assert(channel < 4);
 	AdlibSoundInstrument *ins = &_instrumentsTable[channel];
-	if (ins) {
-		if (ins->mode != 0 && ins->channel == 6) {
-			channel = 6;
+	if (ins->mode != 0 && ins->channel == 6) {
+		channel = 6;
+	}
+	if (ins->mode == 0 || ins->channel == 6) {
+		int freq, note, oct;
+		findNote(frequency, &note, &oct);
+		if (channel == 6) {
+			note %= 12;
 		}
-		if (ins->mode == 0 || ins->channel == 6) {
-			int freq, note, oct;
-			findNote(frequency, &note, &oct);
-			if (channel == 6) {
-				note %= 12;
-			}
-			freq = _freqTable[note % 12];
-			OPLWriteReg(_opl, 0xA0 | channel, freq);
-			freq = ((note / 12) << 2) | ((freq & 0x300) >> 8);
-			if (ins->mode == 0) {
-				freq |= 0x20;
-			}
-			OPLWriteReg(_opl, 0xB0 | channel, freq);
+		freq = _freqTable[note % 12];
+		OPLWriteReg(_opl, 0xA0 | channel, freq);
+		freq = ((note / 12) << 2) | ((freq & 0x300) >> 8);
+		if (ins->mode == 0) {
+			freq |= 0x20;
 		}
-		if (ins->mode != 0) {
-			_vibrato |= 1 << (10 - ins->channel);
-			OPLWriteReg(_opl, 0xBD, _vibrato);
-		}
+		OPLWriteReg(_opl, 0xB0 | channel, freq);
 	}
+	if (ins->mode != 0) {
+		_vibrato |= 1 << (10 - ins->channel);
+		OPLWriteReg(_opl, 0xBD, _vibrato);
+	}
 }
 
 void AdlibSoundDriverINS::playSound(const byte *data, int size, int channel, int volume) {
@@ -322,38 +320,36 @@
 void AdlibSoundDriverADL::setChannelFrequency(int channel, int frequency) {
 	assert(channel < 4);
 	AdlibSoundInstrument *ins = &_instrumentsTable[channel];
-	if (ins) {
-		if (ins->mode != 0) {
-			channel = ins->channel;
-			if (channel == 9) {
-				channel = 8;
-			} else if (channel == 10) {
-				channel = 7;
-			}
+	if (ins->mode != 0) {
+		channel = ins->channel;
+		if (channel == 9) {
+			channel = 8;
+		} else if (channel == 10) {
+			channel = 7;
 		}
-		int freq, note, oct;
-		findNote(frequency, &note, &oct);
-		
-		note += oct * 12;
-		if (ins->amDepth) {
-			note = ins->amDepth;
-		}
-		if (note < 0) {
-			note = 0;
-		}
+	}
+	int freq, note, oct;
+	findNote(frequency, &note, &oct);
+	
+	note += oct * 12;
+	if (ins->amDepth) {
+		note = ins->amDepth;
+	}
+	if (note < 0) {
+		note = 0;
+	}
 
-		freq = _freqTable[note % 12];
-		OPLWriteReg(_opl, 0xA0 | channel, freq);
-		freq = ((note / 12) << 2) | ((freq & 0x300) >> 8);
-		if (ins->mode == 0) {
-			freq |= 0x20;
-		}
-		OPLWriteReg(_opl, 0xB0 | channel, freq);
-		if (ins->mode != 0) {
-			_vibrato |= 1 << (10 - channel);
-			OPLWriteReg(_opl, 0xBD, _vibrato);
-		}
+	freq = _freqTable[note % 12];
+	OPLWriteReg(_opl, 0xA0 | channel, freq);
+	freq = ((note / 12) << 2) | ((freq & 0x300) >> 8);
+	if (ins->mode == 0) {
+		freq |= 0x20;
 	}
+	OPLWriteReg(_opl, 0xB0 | channel, freq);
+	if (ins->mode != 0) {
+		_vibrato |= 1 << (10 - channel);
+		OPLWriteReg(_opl, 0xBD, _vibrato);
+	}
 }
 
 void AdlibSoundDriverADL::playSound(const byte *data, int size, int channel, int volume) {


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