diff options
author | Vitaly Novichkov <admin@wohlnet.ru> | 2018-06-26 18:17:18 +0300 |
---|---|---|
committer | Vitaly Novichkov <admin@wohlnet.ru> | 2018-06-26 18:17:18 +0300 |
commit | 400e3d750b14ec3f260fc2e69e362be581b257bb (patch) | |
tree | bb83957bdd868f1a4bb15c2fe5fd3dc050eefc9a /src/adlmidi_midiplay.cpp | |
parent | 7394b15b9547c444999503fae5f42e340854c9eb (diff) | |
download | libADLMIDI-400e3d750b14ec3f260fc2e69e362be581b257bb.tar.gz libADLMIDI-400e3d750b14ec3f260fc2e69e362be581b257bb.tar.bz2 libADLMIDI-400e3d750b14ec3f260fc2e69e362be581b257bb.zip |
Don't busy chip channels with blank notes!
Diffstat (limited to 'src/adlmidi_midiplay.cpp')
-rw-r--r-- | src/adlmidi_midiplay.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index 4f57374..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 }; @@ -500,6 +514,7 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity) 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; @@ -1045,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]; |