diff options
author | Vitaly Novichkov <admin@wohlnet.ru> | 2018-06-27 02:51:42 +0300 |
---|---|---|
committer | Vitaly Novichkov <admin@wohlnet.ru> | 2018-06-27 02:51:42 +0300 |
commit | b72a1445e4fe65354b5b2e874bca5a0ef2cd82e0 (patch) | |
tree | bb83957bdd868f1a4bb15c2fe5fd3dc050eefc9a /src | |
parent | c5509c43b4010ecc3d4f8b464996b26756b645e6 (diff) | |
parent | 400e3d750b14ec3f260fc2e69e362be581b257bb (diff) | |
download | libADLMIDI-b72a1445e4fe65354b5b2e874bca5a0ef2cd82e0.tar.gz libADLMIDI-b72a1445e4fe65354b5b2e874bca5a0ef2cd82e0.tar.bz2 libADLMIDI-b72a1445e4fe65354b5b2e874bca5a0ef2cd82e0.zip |
Merge branch 'master' into stable
Diffstat (limited to 'src')
-rw-r--r-- | src/adlmidi_midiplay.cpp | 29 | ||||
-rw-r--r-- | src/adlmidi_private.hpp | 4 |
2 files changed, 30 insertions, 3 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index b300270..9841f73 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -397,13 +397,27 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity) if((m_synth.m_rhythmMode == 1) && PercussionMap[midiins & 0xFF]) voices[1] = voices[0];//i[1] = i[0]; + bool isBlankNote = (ains->flags & adlinsdata::Flag_NoSound); + if(hooks.onDebugMessage) { - if((ains->flags & adlinsdata::Flag_NoSound) && - caugh_missing_instruments.insert(static_cast<uint8_t>(midiins)).second) + if(isBlankNote && caugh_missing_instruments.insert(static_cast<uint8_t>(midiins)).second) hooks.onDebugMessage(hooks.onDebugMessage_userData, "[%i] Playing missing instrument %i", channel, midiins); } + if(isBlankNote) + { + // Don't even try to play the blank instrument! But, insert the dummy note. + std::pair<MIDIchannel::activenoteiterator, bool> + dummy = midiChan.activenotes_insert(note); + dummy.first->isBlank = true; + dummy.first->ains = NULL; + dummy.first->chip_channels_count = 0; + // Record the last note on MIDI channel as source of portamento + midiChan.portamentoSource = static_cast<int8_t>(note); + return false; + } + // Allocate AdLib channel (the physical sound channel for the note) int32_t adlchannel[MIDIchannel::NoteInfo::MaxNumPhysChans] = { -1, -1 }; @@ -499,6 +513,8 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity) ir.first->currentTone = tone; ir.first->glideRate = HUGE_VAL; ir.first->midiins = midiins; + ir.first->isPercussion = isPercussion; + ir.first->isBlank = isBlankNote; ir.first->ains = ains; ir.first->chip_channels_count = 0; @@ -1044,6 +1060,13 @@ void MIDIplay::noteUpdate(size_t midCh, my_loc.MidCh = static_cast<uint16_t>(midCh); my_loc.note = info.note; + if(info.isBlank) + { + if(props_mask & Upd_Off) + m_midiChannels[midCh].activenotes_erase(i); + return; + } + for(unsigned ccount = 0, ctotal = info.chip_channels_count; ccount < ctotal; ccount++) { const MIDIchannel::NoteInfo::Phys &ins = info.chip_channels[ccount]; @@ -1295,7 +1318,7 @@ int64_t MIDIplay::calculateChipChannelGoodness(size_t c, const MIDIchannel::Note } // Percussion is inferior to melody - s += 50 * (int64_t)(k->midiins / 128); + s += k->isPercussion ? 50 : 0; /* if(k->second.midiins >= 25 && k->second.midiins < 40 diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp index ffec1b2..7b59003 100644 --- a/src/adlmidi_private.hpp +++ b/src/adlmidi_private.hpp @@ -582,6 +582,10 @@ public: double glideRate; //! Patch selected on noteon; index to bank.ins[] size_t midiins; + //! Is note the percussion instrument + bool isPercussion; + //! Note that plays missing instrument. Doesn't using any chip channels + bool isBlank; //! Patch selected const adlinsdata2 *ains; enum |