mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-12 20:17:49 +00:00
AUDIO: Add default for OPL channel volume
This adds an option to the AdLib multisource driver to set the MIDI channel volume that will be used to initialize to OPL 4x registers.
This commit is contained in:
parent
111b237e02
commit
d8491ecea4
@ -377,6 +377,7 @@ MidiDriver_ADLIB_Multisource::MidiDriver_ADLIB_Multisource(OPL::Config::OplType
|
||||
_isOpen(false),
|
||||
_accuracyMode(ACCURACY_MODE_SB16_WIN95),
|
||||
_allocationMode(ALLOCATION_MODE_DYNAMIC),
|
||||
_defaultChannelVolume(0),
|
||||
_noteSelect(NOTE_SELECT_MODE_0),
|
||||
_modulationDepth(MODULATION_DEPTH_HIGH),
|
||||
_vibratoDepth(VIBRATO_DEPTH_HIGH),
|
||||
@ -421,6 +422,13 @@ int MidiDriver_ADLIB_Multisource::open() {
|
||||
if (!_opl->init())
|
||||
return MERR_CANNOT_CONNECT;
|
||||
|
||||
// Set default MIDI channel volume on control data.
|
||||
for (int i = 0; i < MAXIMUM_SOURCES; i++) {
|
||||
for (int j = 0; j < MIDI_CHANNEL_COUNT; j++) {
|
||||
_controlData[i][j].volume = _defaultChannelVolume;
|
||||
}
|
||||
}
|
||||
|
||||
// Set default OPL register values.
|
||||
initOpl();
|
||||
|
||||
@ -987,8 +995,9 @@ void MidiDriver_ADLIB_Multisource::initOpl() {
|
||||
break;
|
||||
case 1:
|
||||
baseReg = OPL_REGISTER_BASE_LEVEL;
|
||||
// Set default volume to 3F (maximum attenuation).
|
||||
value = OPL_LEVEL_DEFAULT;
|
||||
// Set volume to the default MIDI channel volume.
|
||||
// Convert from MIDI to OPL register value.
|
||||
value = 0x3F - (_defaultChannelVolume >> 1);
|
||||
break;
|
||||
case 2:
|
||||
baseReg = OPL_REGISTER_BASE_DECAY_ATTACK;
|
||||
|
@ -1006,6 +1006,9 @@ protected:
|
||||
// Controls the OPL channel allocation behavior.
|
||||
ChannelAllocationMode _allocationMode;
|
||||
|
||||
// The default MIDI channel volume (set when opening the driver).
|
||||
uint8 _defaultChannelVolume;
|
||||
|
||||
// OPL global settings. Set these, then call oplInit or open to apply the
|
||||
// new values.
|
||||
NoteSelectMode _noteSelect;
|
||||
|
Loading…
Reference in New Issue
Block a user