aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi_private.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/adlmidi_private.cpp')
-rw-r--r--src/adlmidi_private.cpp28
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;
}