Subversion Repositories eduke32

Compare Revisions

Ignore whitespace Rev 8724 → Rev 8725

/source/audiolib/src/_al_midi.h
96,5 → 96,6
static void AL_ControlChange(int channel, int type, int data);
static void AL_ProgramChange(int channel, int patch);
static void AL_SetPitchBend(int channel, int lsb, int msb);
static void AL_SetVolume(int volume);
 
#endif
/source/audiolib/src/driver_adlib.cpp
51,6 → 51,8
 
int AdLibDrv_GetError(void) { return ErrorCode; }
 
static int AL_Volume = MIDI_MaxVolume;
 
const char *AdLibDrv_ErrorString(int const ErrorNumber)
{
const char *ErrorString;
86,6 → 88,9
funcs->ProgramChange = AL_ProgramChange;
funcs->ChannelAftertouch = nullptr;
funcs->PitchBend = AL_SetPitchBend;
funcs->SetVolume = AL_SetVolume;
 
AL_Volume = MIDI_MaxVolume;
return AdLibErr_Ok;
}
132,11 → 137,11
OPL3_GenerateResampled(AL_GetChip(), buf);
if (MV_Channels == 2)
{
*buffer16++ = clamp(buf[0]<<AL_PostAmp, INT16_MIN, INT16_MAX);
*buffer16++ = clamp(buf[1]<<AL_PostAmp, INT16_MIN, INT16_MAX);
*buffer16++ = clamp((buf[0]<<AL_PostAmp)*AL_Volume/MIDI_MaxVolume, INT16_MIN, INT16_MAX);
*buffer16++ = clamp((buf[1]<<AL_PostAmp)*AL_Volume/MIDI_MaxVolume, INT16_MIN, INT16_MAX);
}
else
*buffer16++ = clamp(((buf[0]<<AL_PostAmp)+(buf[1]<<AL_PostAmp))/2, INT16_MIN, INT16_MAX);
*buffer16++ = clamp(((buf[0]<<AL_PostAmp)+(buf[1]<<AL_PostAmp))*AL_Volume/(2*MIDI_MaxVolume), INT16_MIN, INT16_MAX);
}
}
 
755,6 → 760,12
}
 
 
static void AL_SetVolume(int volume)
{
AL_Volume = clamp(volume, 0, MIDI_MaxVolume);
}
 
 
static void AL_Shutdown(void)
{
AL_ResetVoices();
/source/audiolib/src/midi.cpp
559,8 → 559,11
if (_MIDI_Funcs == nullptr || _MIDI_Funcs->ControlChange == nullptr)
return;
 
volume *= _MIDI_TotalVolume;
volume = tabledivide32_noinline(volume, MIDI_MaxVolume);
if (_MIDI_Funcs->SetVolume == nullptr)
{
volume *= _MIDI_TotalVolume;
volume = tabledivide32_noinline(volume, MIDI_MaxVolume);
}
 
_MIDI_Funcs->ControlChange(channel, MIDI_VOLUME, volume);
}