aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi_load.cpp
diff options
context:
space:
mode:
authorWohlstand <admin@wohlnet.ru>2020-09-02 22:49:04 +0300
committerWohlstand <admin@wohlnet.ru>2020-09-02 22:49:04 +0300
commitd29b0cacf3e7a1da793fc2692a958dcf6c4b9c75 (patch)
tree38397165639eec8a5e6369b2a6aca733d6e6dd06 /src/adlmidi_load.cpp
parentefdf769050aaf344ddac660386009b58fa156ad2 (diff)
downloadlibADLMIDI-d29b0cacf3e7a1da793fc2692a958dcf6c4b9c75.tar.gz
libADLMIDI-d29b0cacf3e7a1da793fc2692a958dcf6c4b9c75.tar.bz2
libADLMIDI-d29b0cacf3e7a1da793fc2692a958dcf6c4b9c75.zip
When playing XMIDI files, set defaults of AIL
- Default volume in AIL is 127 - Default pitch bend sensitivity is a full octave up, and full octave down: MSB=12, LSB=0
Diffstat (limited to 'src/adlmidi_load.cpp')
-rw-r--r--src/adlmidi_load.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/adlmidi_load.cpp b/src/adlmidi_load.cpp
index 3e790db..40e0d4c 100644
--- a/src/adlmidi_load.cpp
+++ b/src/adlmidi_load.cpp
@@ -181,7 +181,7 @@ bool MIDIplay::LoadMIDI_post()
uint16_t ins_count = static_cast<uint16_t>(instruments.size());
for(uint16_t i = 0; i < ins_count; ++i)
{
- const uint8_t *InsData = instruments[i].data;
+ const uint8_t *insData = instruments[i].data;
size_t bank = i / 256;
bank = ((bank & 127) + ((bank >> 7) << 8));
if(bank > 127 + (127 << 8))
@@ -194,18 +194,18 @@ bool MIDIplay::LoadMIDI_post()
adlinsdata2 &adlins = synth.m_insBanks[bank].ins[i % 128];
adldata adl;
adl.modulator_E862 =
- ((static_cast<uint32_t>(InsData[8] & 0x07) << 24) & 0xFF000000) //WaveForm
- | ((static_cast<uint32_t>(InsData[6]) << 16) & 0x00FF0000) //Sustain/Release
- | ((static_cast<uint32_t>(InsData[4]) << 8) & 0x0000FF00) //Attack/Decay
- | ((static_cast<uint32_t>(InsData[0]) << 0) & 0x000000FF); //MultKEVA
+ ((static_cast<uint32_t>(insData[8] & 0x07) << 24) & 0xFF000000) //WaveForm
+ | ((static_cast<uint32_t>(insData[6]) << 16) & 0x00FF0000) //Sustain/Release
+ | ((static_cast<uint32_t>(insData[4]) << 8) & 0x0000FF00) //Attack/Decay
+ | ((static_cast<uint32_t>(insData[0]) << 0) & 0x000000FF); //MultKEVA
adl.carrier_E862 =
- ((static_cast<uint32_t>(InsData[9] & 0x07) << 24) & 0xFF000000) //WaveForm
- | ((static_cast<uint32_t>(InsData[7]) << 16) & 0x00FF0000) //Sustain/Release
- | ((static_cast<uint32_t>(InsData[5]) << 8) & 0x0000FF00) //Attack/Decay
- | ((static_cast<uint32_t>(InsData[1]) << 0) & 0x000000FF); //MultKEVA
- adl.modulator_40 = InsData[2];
- adl.carrier_40 = InsData[3];
- adl.feedconn = InsData[10] & 0x0F;
+ ((static_cast<uint32_t>(insData[9] & 0x07) << 24) & 0xFF000000) //WaveForm
+ | ((static_cast<uint32_t>(insData[7]) << 16) & 0x00FF0000) //Sustain/Release
+ | ((static_cast<uint32_t>(insData[5]) << 8) & 0x0000FF00) //Attack/Decay
+ | ((static_cast<uint32_t>(insData[1]) << 0) & 0x000000FF); //MultKEVA
+ adl.modulator_40 = insData[2];
+ adl.carrier_40 = insData[3];
+ adl.feedconn = insData[10] & 0x0F;
adl.finetune = 0;
adlins.adl[0] = adl;
adlins.adl[1] = adl;
@@ -246,11 +246,16 @@ bool MIDIplay::LoadMIDI_post()
}
else
{
+ if(format == MidiSequencer::Format_XMIDI)
+ synth.m_musicMode = Synth::MODE_XMIDI;
+
synth.m_numChips = m_setup.numChips;
if(m_setup.numFourOps < 0)
adlCalculateFourOpChannels(this, true);
}
+ resetMIDIDefaults();
+
m_setup.tick_skip_samples_delay = 0;
synth.reset(m_setup.emulator, m_setup.PCM_RATE, this); // Reset OPL3 chip
//opl.Reset(); // ...twice (just in case someone misprogrammed OPL3 previously)