AUDIO: Fix AdLib volume when ENABLE_OPL3 is not defined

This should ensure that when ENABLE_OPL3 is not defined, the old
code (using a lookup table) is used for calculating vol1 and vol2
(unless, of course, _scummSmallHeader is true). I hope I got it
right this time.
This commit is contained in:
Torbjörn Andersson 2012-12-01 11:48:51 +01:00
parent 5cd7e5d777
commit 8881f71ac5

View File

@ -2000,11 +2000,11 @@ void MidiDriver_ADLIB::mcKeyOn(AdLibVoice *voice, const AdLibInstrument *instr,
if (!_scummSmallHeader) {
#ifdef ENABLE_OPL3
if (!_opl3Mode)
vol1 = (instr->modScalingOutputLevel & 0x3F) + g_volumeLookupTable[velocity >> 1][instr->modWaveformSelect >> 2];
if (_opl3Mode)
vol1 = (instr->modScalingOutputLevel & 0x3F) + (velocity * ((instr->modWaveformSelect >> 3) + 1)) / 64;
else
#endif
vol1 = (instr->modScalingOutputLevel & 0x3F) + (velocity * ((instr->modWaveformSelect >> 3) + 1)) / 64;
vol1 = (instr->modScalingOutputLevel & 0x3F) + g_volumeLookupTable[velocity >> 1][instr->modWaveformSelect >> 2];
} else {
vol1 = 0x3f - (instr->modScalingOutputLevel & 0x3F);
}
@ -2014,11 +2014,11 @@ void MidiDriver_ADLIB::mcKeyOn(AdLibVoice *voice, const AdLibInstrument *instr,
if (!_scummSmallHeader) {
#ifdef ENABLE_OPL3
if (!_opl3Mode)
vol2 = (instr->carScalingOutputLevel & 0x3F) + g_volumeLookupTable[velocity >> 1][instr->carWaveformSelect >> 2];
if (_opl3Mode)
vol2 = (instr->carScalingOutputLevel & 0x3F) + (velocity * ((instr->carWaveformSelect >> 3) + 1)) / 64;
else
#endif
vol2 = (instr->carScalingOutputLevel & 0x3F) + (velocity * ((instr->carWaveformSelect >> 3) + 1)) / 64;
vol2 = (instr->carScalingOutputLevel & 0x3F) + g_volumeLookupTable[velocity >> 1][instr->carWaveformSelect >> 2];
} else {
vol2 = 0x3f - (instr->carScalingOutputLevel & 0x3F);
}