diff --git a/source/audiolib/src/driver_adlib.cpp b/source/audiolib/src/driver_adlib.cpp index 5cb4b7c71..57b83b933 100644 --- a/source/audiolib/src/driver_adlib.cpp +++ b/source/audiolib/src/driver_adlib.cpp @@ -200,6 +200,7 @@ static int AL_LeftPort = ADLIB_PORT; static int AL_RightPort = ADLIB_PORT; int AL_Stereo = TRUE; static int AL_MaxMidiChannel = 16; +int AL_AdditiveMode; // TODO: clean up this shit... #define OFFSET(structure, offset) (*((char **)&(structure)[offset])) @@ -331,9 +332,13 @@ static void AL_SetVoiceVolume(int const voice) if (timbre->Feedback & 0x01) { int const slot = slotVoice[voc][0]; + uint32_t t2; // amplitude - auto t2 = (Channel[channel].Volume * t1) >> 15; + if (AL_AdditiveMode) + t1 = (uint32_t)VoiceLevel[slot][port] * (velocity + 0x80); + + t2 = (Channel[channel].Volume * t1) >> 15; volume = t2 ^ 63; volume |= (uint32_t)VoiceKsl[slot][port]; diff --git a/source/audiolib/src/driver_adlib.h b/source/audiolib/src/driver_adlib.h index 1ddd90544..5b2e8d036 100644 --- a/source/audiolib/src/driver_adlib.h +++ b/source/audiolib/src/driver_adlib.h @@ -23,6 +23,7 @@ #include "opl3.h" extern int AL_Stereo; +extern int AL_AdditiveMode; int AdLibDrv_GetError(void); const char *AdLibDrv_ErrorString(int ErrorNumber); diff --git a/source/audiolib/src/fx_man.cpp b/source/audiolib/src/fx_man.cpp index c58bea115..292fe8b69 100644 --- a/source/audiolib/src/fx_man.cpp +++ b/source/audiolib/src/fx_man.cpp @@ -56,7 +56,7 @@ static int osdcmd_cvar_set_audiolib(osdcmdptr_t parm) if (!Bstrcasecmp(parm->name, "mus_emidicard")) MIDI_Restart(); - else if (!Bstrcasecmp(parm->name, "mus_adlibstereo")) + else if (!Bstrcasecmp(parm->name, "mus_al_stereo")) AL_SetStereo(AL_Stereo); return r; @@ -72,7 +72,8 @@ int FX_Init(int numvoices, int numchannels, int mixrate, void *initdata) static osdcvardata_t cvars_audiolib[] = { { "mus_emidicard", "force a specific EMIDI instrument set", (void *)&ASS_EMIDICard, CVAR_INT | CVAR_FUNCPTR, -1, 10 }, - { "mus_adlibstereo", "enable/disable OPL3 stereo mode", (void *)&AL_Stereo, CVAR_BOOL | CVAR_FUNCPTR, 0, 1 }, + { "mus_al_stereo", "enable/disable OPL3 stereo mode", (void *)&AL_Stereo, CVAR_BOOL | CVAR_FUNCPTR, 0, 1 }, + { "mus_al_additivemode", "enable/disable alternate additive AdLib timbre mode", (void *)&AL_AdditiveMode, CVAR_BOOL, 0, 1 }, }; if (!init++)