File tree Expand file tree Collapse file tree 4 files changed +18
-5
lines changed
Expand file tree Collapse file tree 4 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ To build that example you will need to have installed SDL2 library.
184184* Add support of MIDI Format 2 files
185185
186186# Changelog
187- ## 1.5 .2 dev
187+ ## 1.6 .2 dev
188188 * Fixed the random stuck problem in the DOS version of the ADLMIDI player.
189189 * Added support for HMI and HMP files!
190190 * Added support for in-track (local) loops.
@@ -196,6 +196,7 @@ To build that example you will need to have installed SDL2 library.
196196 * Added Jammie O'Connel's FM Synth volume model.
197197 * Added support for DMX OP2's Fixed Note feature for melodic instruments.
198198 * Fixed the unexpected playback distortion while playing IMF/CMF/KLM files using DosBox OPL3 emulator.
199+ * Fixed unexpected non-GM instruments from embedded bank appears when loading custom GM-only bank.
199200
200201## 1.6.1 2025-09-22
201202 * WinMM: Fixed random crash on waveOutOpen initialisation because of incorrect initialisation structure usage.
Original file line number Diff line number Diff line change @@ -116,8 +116,6 @@ bool MIDIplay::LoadBank(FileAndMemReader &fr)
116116
117117 Synth &synth = *m_synth;
118118
119- synth.setEmbeddedBank (m_setup.bankId );
120-
121119 synth.m_insBankSetup .scaleModulators = false ;
122120 synth.m_insBankSetup .deepTremolo = (wopl->opl_flags & WOPL_FLAG_DEEP_TREMOLO) != 0 ;
123121 synth.m_insBankSetup .deepVibrato = (wopl->opl_flags & WOPL_FLAG_DEEP_VIBRATO) != 0 ;
@@ -130,6 +128,8 @@ bool MIDIplay::LoadBank(FileAndMemReader &fr)
130128 uint16_t slots_counts[2 ] = {wopl->banks_count_melodic , wopl->banks_count_percussion };
131129 WOPLBank *slots_src_ins[2 ] = { wopl->banks_melodic , wopl->banks_percussive };
132130
131+ synth.m_insBanks .clear ();
132+
133133 for (size_t ss = 0 ; ss < 2 ; ss++)
134134 {
135135 for (size_t i = 0 ; i < slots_counts[ss]; i++)
@@ -148,6 +148,8 @@ bool MIDIplay::LoadBank(FileAndMemReader &fr)
148148 }
149149 }
150150
151+ synth.clearInstCache ();
152+
151153 synth.m_embeddedBank = Synth::CustomBankTag; // Use dynamic banks!
152154 // Percussion offset is count of instruments multipled to count of melodic banks
153155 applySetup ();
Original file line number Diff line number Diff line change @@ -471,14 +471,19 @@ void OPL3::setEmbeddedBank(uint32_t bank)
471471 }
472472
473473 // Reset caches once bank is changed
474- adl_fill_vector<const OplTimbre*>(m_insCache, &c_defaultInsCache);
475- adl_fill_vector<bool >(m_insCacheModified, false );
474+ clearInstCache ();
476475
477476#else
478477 ADL_UNUSED (bank);
479478#endif
480479}
481480
481+ void OPL3::clearInstCache ()
482+ {
483+ adl_fill_vector<const OplTimbre*>(m_insCache, &c_defaultInsCache);
484+ adl_fill_vector<bool >(m_insCacheModified, false );
485+ }
486+
482487void OPL3::writeReg (size_t chip, uint16_t address, uint8_t value)
483488{
484489 m_chips[chip]->writeReg (address, value);
Original file line number Diff line number Diff line change @@ -309,6 +309,11 @@ class OPL3
309309 */
310310 void setEmbeddedBank (uint32_t bank);
311311
312+ /* *
313+ * @brief Clears the selected instruments cache
314+ */
315+ void clearInstCache ();
316+
312317 /* *
313318 * @brief Write data to OPL3 chip register
314319 * @param chip Index of emulated chip. In hardware OPL3 builds, this parameter is ignored
You can’t perform that action at this time.
0 commit comments