From a6256daf01e9ffe1fcb32557f9f9712432f855fd Mon Sep 17 00:00:00 2001 From: JP Cimalando Date: Thu, 24 Jan 2019 06:47:36 +0100 Subject: drum note length extension --- src/adlmidi_midiplay.hpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/adlmidi_midiplay.hpp') diff --git a/src/adlmidi_midiplay.hpp b/src/adlmidi_midiplay.hpp index fd58b13..d3e5ea4 100644 --- a/src/adlmidi_midiplay.hpp +++ b/src/adlmidi_midiplay.hpp @@ -156,6 +156,10 @@ public: bool isPercussion; //! Note that plays missing instrument. Doesn't using any chip channels bool isBlank; + //! Whether releasing and on extended life time defined by TTL + bool isOnExtendedLifeTime; + //! Time-to-live until release (short percussion note fix) + double ttl; //! Patch selected const adlinsdata2 *ains; enum -- cgit v1.2.3 From 60bc095f2f431b4e6421307fc7ab62c6cc9ce0c2 Mon Sep 17 00:00:00 2001 From: JP Cimalando Date: Thu, 24 Jan 2019 11:29:29 +0100 Subject: cache the extended note count per channel --- src/adlmidi_midiplay.hpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/adlmidi_midiplay.hpp') diff --git a/src/adlmidi_midiplay.hpp b/src/adlmidi_midiplay.hpp index d3e5ea4..d7d8022 100644 --- a/src/adlmidi_midiplay.hpp +++ b/src/adlmidi_midiplay.hpp @@ -254,6 +254,8 @@ public: char _padding2[5]; //! Count of gliding notes in this channel unsigned gliding_note_count; + //! Count of notes having a TTL countdown in this channel + unsigned extended_note_count; //! Active notes in the channel pl_list activenotes; @@ -275,7 +277,10 @@ public: notes_iterator find_or_create_activenote(unsigned note) { notes_iterator it = find_activenote(note); - if(it.is_end()) { + if(!it.is_end()) + cleanupNote(it); + else + { NoteInfo ni; ni.note = note; it = activenotes.insert(activenotes.end(), ni); @@ -352,10 +357,23 @@ public: bendsense = cent * (1.0 / (128 * 8192)); } + /** + * @brief Clean up the state of the active note before removal + */ + void cleanupNote(notes_iterator i) + { + NoteInfo &info = i->value; + if(info.glideRate != HUGE_VAL) + --gliding_note_count; + if(info.ttl > 0) + --extended_note_count; + } + MIDIchannel() : activenotes(128) { gliding_note_count = 0; + extended_note_count = 0; reset(); } }; -- cgit v1.2.3 From 3bdda83b7d5417785f5df0120d4f2d73af4253d4 Mon Sep 17 00:00:00 2001 From: JP Cimalando Date: Fri, 25 Jan 2019 08:16:31 +0100 Subject: force note-on to do immediate note killing --- src/adlmidi_midiplay.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/adlmidi_midiplay.hpp') diff --git a/src/adlmidi_midiplay.hpp b/src/adlmidi_midiplay.hpp index d7d8022..1067252 100644 --- a/src/adlmidi_midiplay.hpp +++ b/src/adlmidi_midiplay.hpp @@ -963,8 +963,9 @@ private: * @brief Off the note * @param midCh MIDI channel * @param note Note to off + * @param forceNow Do not delay the key-off to a later time */ - void noteOff(size_t midCh, uint8_t note); + void noteOff(size_t midCh, uint8_t note, bool forceNow = false); /** * @brief Update processing of vibrato to amount of seconds -- cgit v1.2.3