diff options
author | Vitaly Novichkov <admin@wohlnet.ru> | 2018-06-25 20:37:03 +0300 |
---|---|---|
committer | Vitaly Novichkov <admin@wohlnet.ru> | 2018-06-25 20:37:03 +0300 |
commit | c5509c43b4010ecc3d4f8b464996b26756b645e6 (patch) | |
tree | f53e3f62b424b4f3052eece54d304039d8e1aada /src/adlmidi_private.cpp | |
parent | e3a353a6b84b47ad4204b110249bc74b16554985 (diff) | |
parent | e1bb226e1b8235a2aa80141fc07a305b8a5f1818 (diff) | |
download | libADLMIDI-c5509c43b4010ecc3d4f8b464996b26756b645e6.tar.gz libADLMIDI-c5509c43b4010ecc3d4f8b464996b26756b645e6.tar.bz2 libADLMIDI-c5509c43b4010ecc3d4f8b464996b26756b645e6.zip |
Merge branch 'master' into stable
Diffstat (limited to 'src/adlmidi_private.cpp')
-rw-r--r-- | src/adlmidi_private.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/adlmidi_private.cpp b/src/adlmidi_private.cpp index 3bc73a4..ecedd9e 100644 --- a/src/adlmidi_private.cpp +++ b/src/adlmidi_private.cpp @@ -36,20 +36,22 @@ void adl_audioTickHandler(void *instance, uint32_t chipId, uint32_t rate) int adlRefreshNumCards(ADL_MIDIPlayer *device) { - unsigned n_fourop[2] = {0, 0}, n_total[2] = {0, 0}; + size_t n_fourop[2] = {0, 0}, n_total[2] = {0, 0}; MIDIplay *play = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer); //Automatically calculate how much 4-operator channels is necessary - if(play->opl.AdlBank == ~0u) +#ifndef DISABLE_EMBEDDED_BANKS + if(play->m_synth.m_embeddedBank == OPL3::CustomBankTag) +#endif { //For custom bank - OPL3::BankMap::iterator it = play->opl.dynamic_banks.begin(); - OPL3::BankMap::iterator end = play->opl.dynamic_banks.end(); + OPL3::BankMap::iterator it = play->m_synth.m_insBanks.begin(); + OPL3::BankMap::iterator end = play->m_synth.m_insBanks.end(); for(; it != end; ++it) { - uint16_t bank = it->first; - unsigned div = (bank & OPL3::PercussionTag) ? 1 : 0; - for(unsigned i = 0; i < 128; ++i) + size_t bank = it->first; + size_t div = (bank & OPL3::PercussionTag) ? 1 : 0; + for(size_t i = 0; i < 128; ++i) { adlinsdata2 &ins = it->second.ins[i]; if(ins.flags & adlinsdata::Flag_NoSound) @@ -60,12 +62,13 @@ int adlRefreshNumCards(ADL_MIDIPlayer *device) } } } +#ifndef DISABLE_EMBEDDED_BANKS else { //For embedded bank - for(unsigned a = 0; a < 256; ++a) + for(size_t a = 0; a < 256; ++a) { - unsigned insno = banks[play->m_setup.AdlBank][a]; + size_t insno = banks[play->m_setup.bankId][a]; if(insno == 198) continue; ++n_total[a / 128]; @@ -74,8 +77,9 @@ int adlRefreshNumCards(ADL_MIDIPlayer *device) ++n_fourop[a / 128]; } } +#endif - unsigned numFourOps = 0; + size_t numFourOps = 0; // All 2ops (no 4ops) if((n_fourop[0] == 0) && (n_fourop[1] == 0)) @@ -96,7 +100,9 @@ int adlRefreshNumCards(ADL_MIDIPlayer *device) : (play->m_setup.NumCards == 1 ? 1 : play->m_setup.NumCards * 4); */ - play->opl.NumFourOps = play->m_setup.NumFourOps = (numFourOps * play->m_setup.NumCards); + play->m_synth.m_numFourOps = play->m_setup.numFourOps = static_cast<unsigned>(numFourOps * play->m_setup.numChips); + // Update channel categories and set up four-operator channels + play->m_synth.updateChannelCategories(); return 0; } |