From 91558f59359eedef8d67dacacb838da498e3c3ef Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Fri, 23 May 2025 21:35:53 +0300 Subject: Improve stability of 2-voice instruments on single OPL2 --- src/adlmidi_midiplay.hpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/adlmidi_midiplay.hpp') diff --git a/src/adlmidi_midiplay.hpp b/src/adlmidi_midiplay.hpp index 6ab0915..e5058b9 100644 --- a/src/adlmidi_midiplay.hpp +++ b/src/adlmidi_midiplay.hpp @@ -962,6 +962,13 @@ private: */ int64_t calculateChipChannelGoodness(size_t c, const MIDIchannel::NoteInfo::Phys &ins) const; + /** + * @brief If no free chip channels, try to kill at least one second voice of pseudo-4-op instruments and steal the released channel + * @param new_chan Value of released chip channel to reuse + * @return true if any channel was been stolen, or false when nothing happen + */ + bool killSecondVoicesIfOverflow(int32_t &new_chan); + /** * @brief A new note will be played on this channel using this instrument. * @param c Wanted chip channel -- cgit v1.2.3