From 8881f71ac5ae68422f27703928911e246b38c4b6 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 1 Dec 2012 11:48:51 +0100 Subject: 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. --- audio/softsynth/adlib.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'audio/softsynth/adlib.cpp') diff --git a/audio/softsynth/adlib.cpp b/audio/softsynth/adlib.cpp index 00fa9ca88b..0cadea7f22 100644 --- a/audio/softsynth/adlib.cpp +++ b/audio/softsynth/adlib.cpp @@ -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); } -- cgit v1.2.3