diff options
author | Vitaly Novichkov <Wohlstand@users.noreply.github.com> | 2018-08-30 12:07:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-30 12:07:33 +0300 |
commit | cf121066a365286bd1427f54064b487799623ec9 (patch) | |
tree | c0cf0337c72d1cd29acb03f99ff08188a445f11a | |
parent | 980cb1f9059286abcbb7de7d5ecf54c9a39489bf (diff) | |
parent | 0d9bc6794e57526af28ce45a57d91ec78e39b354 (diff) | |
download | libADLMIDI-cf121066a365286bd1427f54064b487799623ec9.tar.gz libADLMIDI-cf121066a365286bd1427f54064b487799623ec9.tar.bz2 libADLMIDI-cf121066a365286bd1427f54064b487799623ec9.zip |
Merge pull request #162 from jpcima/refresh-4ops
API to return 4op channels to the original count
-rw-r--r-- | include/adlmidi.h | 1 | ||||
-rw-r--r-- | src/adlmidi.cpp | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/include/adlmidi.h b/include/adlmidi.h index 6ae184e..e2bc035 100644 --- a/include/adlmidi.h +++ b/include/adlmidi.h @@ -329,6 +329,7 @@ extern ADLMIDI_DECLSPEC int adl_loadEmbeddedBank(struct ADL_MIDIPlayer *device, * If you want to specify custom number of four operator channels, * please call this function after bank change (adl_setBank() or adl_openBank()), * otherwise, value will be overwritten by auto-calculated. + * If the count is specified as -1, an auto-calculated amount is used instead. * * @param device Instance of the library * @param ops4 Count of four-op channels to allocate between all emulating chips diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp index c7c5cf3..26a21e4 100644 --- a/src/adlmidi.cpp +++ b/src/adlmidi.cpp @@ -351,6 +351,10 @@ ADLMIDI_EXPORT int adl_setNumFourOpsChn(ADL_MIDIPlayer *device, int ops4) { if(!device) return -1; + + if(ops4 == -1) + return adlRefreshNumCards(device); + MidiPlayer *play = GET_MIDI_PLAYER(device); if((unsigned int)ops4 > 6 * play->m_setup.numChips) { @@ -364,7 +368,7 @@ ADLMIDI_EXPORT int adl_setNumFourOpsChn(ADL_MIDIPlayer *device, int ops4) play->m_synth.m_numFourOps = play->m_setup.numFourOps; play->m_synth.updateChannelCategories(); - return 0; //adlRefreshNumCards(device); + return 0; } ADLMIDI_EXPORT int adl_getNumFourOpsChn(struct ADL_MIDIPlayer *device) |