Fix mus_adlibstereo

git-svn-id: https://svn.eduke32.com/eduke32@8233 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/audiolib/include/al_midi.h
This commit is contained in:
terminx 2019-10-20 03:13:15 +00:00 committed by Christoph Oelckers
parent 247e6bcc26
commit 5de8dad179
2 changed files with 16 additions and 25 deletions

View file

@ -198,7 +198,7 @@ static AdLibChannel Channel[NUMADLIBCHANNELS];
static int AL_LeftPort = ADLIB_PORT; static int AL_LeftPort = ADLIB_PORT;
static int AL_RightPort = ADLIB_PORT; static int AL_RightPort = ADLIB_PORT;
int AL_Stereo; int AL_Stereo = TRUE;
static int AL_SendStereo; static int AL_SendStereo;
static int AL_MaxMidiChannel = 16; static int AL_MaxMidiChannel = 16;
@ -632,24 +632,6 @@ static void AL_FlushCard(int const port)
} }
static void AL_StereoOn(void)
{
if (AL_Stereo && !AL_SendStereo)
AL_SendStereo = TRUE;
AL_SendOutputToPort(AL_RightPort, 0x5, 1);
}
static void AL_StereoOff(void)
{
if (AL_Stereo && AL_SendStereo)
AL_SendStereo = FALSE;
AL_SendOutputToPort(AL_RightPort, 0x5, 0);
}
static void AL_Reset(void) static void AL_Reset(void)
{ {
AL_SendOutputToPort(ADLIB_PORT, 1, 0x20); AL_SendOutputToPort(ADLIB_PORT, 1, 0x20);
@ -658,13 +640,24 @@ static void AL_Reset(void)
// Set the values: AM Depth, VIB depth & Rhythm // Set the values: AM Depth, VIB depth & Rhythm
AL_SendOutputToPort(ADLIB_PORT, 0xBD, 0); AL_SendOutputToPort(ADLIB_PORT, 0xBD, 0);
AL_StereoOn(); AL_SetStereo(AL_Stereo);
AL_FlushCard(AL_LeftPort); AL_FlushCard(AL_LeftPort);
AL_FlushCard(AL_RightPort); AL_FlushCard(AL_RightPort);
} }
void AL_SetStereo(int const stereo)
{
if (stereo == AL_SendStereo)
return;
AL_SendStereo = stereo;
AL_SendOutputToPort(AL_RightPort, 0x5, AL_SendStereo);
AL_Reset();
}
static void AL_NoteOff(int const channel, int const key, int velocity) static void AL_NoteOff(int const channel, int const key, int velocity)
{ {
UNREFERENCED_PARAMETER(velocity); UNREFERENCED_PARAMETER(velocity);
@ -841,7 +834,7 @@ static void AL_SetPitchBend(int const channel, int const lsb, int const msb)
static void AL_Shutdown(void) static void AL_Shutdown(void)
{ {
AL_StereoOff(); AL_SetStereo(FALSE);
AL_ResetVoices(); AL_ResetVoices();
AL_Reset(); AL_Reset();
} }
@ -851,7 +844,6 @@ static int AL_Init(int const rate)
{ {
OPL3_Reset(&chip, rate); OPL3_Reset(&chip, rate);
AL_Stereo = TRUE;
AL_LeftPort = ADLIB_PORT; AL_LeftPort = ADLIB_PORT;
AL_RightPort = ADLIB_PORT + 2; AL_RightPort = ADLIB_PORT + 2;

View file

@ -55,10 +55,9 @@ static int osdcmd_cvar_set_audiolib(osdcmdptr_t parm)
if (r != OSDCMD_OK) return r; if (r != OSDCMD_OK) return r;
if (!Bstrcasecmp(parm->name, "mus_emidicard")) if (!Bstrcasecmp(parm->name, "mus_emidicard"))
{
MIDI_Restart(); MIDI_Restart();
return r; else if (!Bstrcasecmp(parm->name, "mus_adlibstereo"))
} AL_SetStereo(AL_Stereo);
return r; return r;
} }