aboutsummaryrefslogtreecommitdiff
path: root/engines/cine
diff options
context:
space:
mode:
authorGregory Montoir2007-05-17 22:18:51 +0000
committerGregory Montoir2007-05-17 22:18:51 +0000
commit3ab295a0ee252fe1d86d0eddd553a4d2c5a0a081 (patch)
treee4d99ed77bae46e61c34a447836bfe6a781f03d4 /engines/cine
parente9827d0884318822b20d13dbe6465c78194e5ea2 (diff)
downloadscummvm-rg350-3ab295a0ee252fe1d86d0eddd553a4d2c5a0a081.tar.gz
scummvm-rg350-3ab295a0ee252fe1d86d0eddd553a4d2c5a0a081.tar.bz2
scummvm-rg350-3ab295a0ee252fe1d86d0eddd553a4d2c5a0a081.zip
removed unneeded if blocks
svn-id: r26862
Diffstat (limited to 'engines/cine')
-rw-r--r--engines/cine/sound_driver.cpp94
1 files changed, 45 insertions, 49 deletions
diff --git a/engines/cine/sound_driver.cpp b/engines/cine/sound_driver.cpp
index 19d94e38a3..dfc5de125f 100644
--- a/engines/cine/sound_driver.cpp
+++ b/engines/cine/sound_driver.cpp
@@ -258,28 +258,26 @@ void AdlibSoundDriverINS::loadInstrument(const byte *data, AdlibSoundInstrument
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) {
- 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);
+ 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) {
- _vibrato |= 1 << (10 - ins->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 - ins->channel);
+ OPLWriteReg(_opl, 0xBD, _vibrato);
}
}
@@ -322,37 +320,35 @@ void AdlibSoundDriverADL::loadInstrument(const byte *data, AdlibSoundInstrument
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;
- }
- }
- int freq, note, oct;
- findNote(frequency, &note, &oct);
-
- note += oct * 12;
- if (ins->amDepth) {
- note = ins->amDepth;
- }
- if (note < 0) {
- note = 0;
+ 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;
+ }
- 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);
}
}