From 9544965f28ce42b69f97e6aaeb881c9a20bfbad4 Mon Sep 17 00:00:00 2001 From: JP Cimalando Date: Mon, 23 Jul 2018 10:37:13 +0200 Subject: preserve the data of operator 3-4 in internal storage, regardless of being 2op/4op --- src/adlmidi_midiplay.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/adlmidi_midiplay.cpp') diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index b226ce1..191021e 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -395,6 +395,7 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity) } //uint16_t i[2] = { ains->adlno1, ains->adlno2 }; + bool is_2op = !(ains->flags & (adlinsdata::Flag_Pseudo4op|adlinsdata::Flag_Real4op)); bool pseudo_4op = ains->flags & adlinsdata::Flag_Pseudo4op; #ifndef __WATCOMC__ MIDIchannel::NoteInfo::Phys voices[MIDIchannel::NoteInfo::MaxNumPhysChans] = @@ -457,7 +458,7 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity) if(ccount == 1 && static_cast(a) == adlchannel[0]) continue; // ^ Don't use the same channel for primary&secondary - if(voices[0].ains == voices[1].ains || pseudo_4op/*i[0] == i[1] || pseudo_4op*/) + if(is_2op || pseudo_4op) { // Only use regular channels uint32_t expected_mode = 0; @@ -1878,7 +1879,7 @@ ADLMIDI_EXPORT void AdlInstrumentTester::DoNote(int note) } double hertz = 172.00093 * std::exp(0.057762265 * (tone + 0.0)); int32_t adlchannel[2] = { 0, 3 }; - if(ains.adl[0] == ains.adl[1]) + if((ains.flags & (adlinsdata::Flag_Pseudo4op|adlinsdata::Flag_Real4op)) == 0) { adlchannel[1] = -1; adlchannel[0] = 6; // single-op @@ -1960,7 +1961,7 @@ ADLMIDI_EXPORT void AdlInstrumentTester::NextAdl(int offset) } std::printf("%s%s%s%u\t", ToneIndication, - ains.adl[0] != ains.adl[1] ? "[2]" : " ", + (ains.flags & (adlinsdata::Flag_Pseudo4op|adlinsdata::Flag_Real4op)) ? "[2]" : " ", (P->ins_idx == a) ? "->" : "\t", i ); -- cgit v1.2.3 From 8dd415d5a26cb1366d62aec6788c0f3f26b33a2b Mon Sep 17 00:00:00 2001 From: JP Cimalando Date: Wed, 25 Jul 2018 03:55:12 +0200 Subject: handle correctly in case of 2op mode --- src/adlmidi_midiplay.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/adlmidi_midiplay.cpp') diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index 191021e..d66101e 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -401,7 +401,7 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity) MIDIchannel::NoteInfo::Phys voices[MIDIchannel::NoteInfo::MaxNumPhysChans] = { {0, ains->adl[0], false}, - {0, ains->adl[1], pseudo_4op} + {0, (!is_2op) ? ains->adl[1] : ains->adl[0], pseudo_4op} }; #else /* Unfortunately, WatCom can't brace-initialize structure that incluses structure fields */ MIDIchannel::NoteInfo::Phys voices[MIDIchannel::NoteInfo::MaxNumPhysChans]; @@ -409,7 +409,7 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity) voices[0].ains = ains->adl[0]; voices[0].pseudo4op = false; voices[1].chip_chan = 0; - voices[1].ains = ains->adl[1]; + voices[1].ains = (!is_2op) ? ains->adl[1] : ains->adl[0]; voices[1].pseudo4op = pseudo_4op; #endif /* __WATCOMC__ */ -- cgit v1.2.3