diff options
author | Wohlstand <admin@wohlnet.ru> | 2017-11-08 23:11:01 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2017-11-08 23:11:01 +0300 |
commit | 17b5e86f44f3d71e8fe43c40f57c12a9649c7ad5 (patch) | |
tree | 20b9fae8246c878feb2331e55fa8221c532804b2 /src/adlmidi_private.cpp | |
parent | f87e983001067c693fec5d0aaf7282c22dc6acb6 (diff) | |
download | libADLMIDI-17b5e86f44f3d71e8fe43c40f57c12a9649c7ad5.tar.gz libADLMIDI-17b5e86f44f3d71e8fe43c40f57c12a9649c7ad5.tar.bz2 libADLMIDI-17b5e86f44f3d71e8fe43c40f57c12a9649c7ad5.zip |
Fixed zero four-operators bug when using a bigger non-GM bank
Diffstat (limited to 'src/adlmidi_private.cpp')
-rw-r--r-- | src/adlmidi_private.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/adlmidi_private.cpp b/src/adlmidi_private.cpp index f13aa8c..f06e30e 100644 --- a/src/adlmidi_private.cpp +++ b/src/adlmidi_private.cpp @@ -36,11 +36,17 @@ int adlRefreshNumCards(ADL_MIDIPlayer *device) //For custom bank for(size_t a = 0; a < play->opl.dynamic_metainstruments.size(); ++a) { - ++n_total[a / 128]; + size_t div = (a >= play->opl.dynamic_percussion_offset) ? 1 : 0; + ++n_total[div]; adlinsdata &ins = play->opl.dynamic_metainstruments[a]; if((ins.adlno1 != ins.adlno2) && ((ins.flags & adlinsdata::Flag_Pseudo4op) == 0)) - ++n_fourop[a / 128]; + ++n_fourop[div]; } + + play->m_setup.NumFourOps = + (n_fourop[0] >= 128 * 7 / 8) ? play->m_setup.NumCards * 6 + : (n_fourop[0] < 128 * 1 / 8) ? 0 + : (play->m_setup.NumCards == 1 ? 1 : play->m_setup.NumCards * 4); } else { @@ -55,12 +61,13 @@ int adlRefreshNumCards(ADL_MIDIPlayer *device) if((ins.adlno1 != ins.adlno2) && ((ins.flags & adlinsdata::Flag_Pseudo4op) == 0)) ++n_fourop[a / 128]; } + + play->m_setup.NumFourOps = + (n_fourop[0] >= (n_total[0] % 128) * 7 / 8) ? play->m_setup.NumCards * 6 + : (n_fourop[0] < (n_total[0] % 128) * 1 / 8) ? 0 + : (play->m_setup.NumCards == 1 ? 1 : play->m_setup.NumCards * 4); } - play->m_setup.NumFourOps = - (n_fourop[0] >= n_total[0] * 7 / 8) ? play->m_setup.NumCards * 6 - : (n_fourop[0] < n_total[0] * 1 / 8) ? 0 - : (play->m_setup.NumCards == 1 ? 1 : play->m_setup.NumCards * 4); play->opl.NumFourOps = play->m_setup.NumFourOps; if(n_fourop[0] >= n_total[0] * 15 / 16 && play->m_setup.NumFourOps == 0) |