Add mus_al_additive to control the behavior mentioned in r8232 and rename mus_adlibstereo to mus_al_stereo

git-svn-id: https://svn.eduke32.com/eduke32@8238 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-10-20 11:41:50 +00:00 committed by Christoph Oelckers
parent e82ddb23d3
commit dafd71c72f
3 changed files with 10 additions and 3 deletions

View file

@ -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];

View file

@ -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);

View file

@ -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++)