aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--libADLMIDI-test.pro1
-rw-r--r--libADLMIDI.pro1
-rw-r--r--src/midi_sequencer_impl.hpp13
4 files changed, 16 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 91baffb..aeec85e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -226,6 +226,7 @@ if(WITH_MIDI_SEQUENCER)
list(APPEND libADLMIDI_SOURCES
${libADLMIDI_SOURCE_DIR}/src/adlmidi_sequencer.cpp
)
+ add_definitions(-DENABLE_END_SILENCE_SKIPPING)
endif()
if(NOT WITH_MUS_SUPPORT OR NOT WITH_MIDI_SEQUENCER)
diff --git a/libADLMIDI-test.pro b/libADLMIDI-test.pro
index d98d6bd..ec5dd1a 100644
--- a/libADLMIDI-test.pro
+++ b/libADLMIDI-test.pro
@@ -18,6 +18,7 @@ LIBS += -lSDL2 -lpthread -ldl
#DEFINES += DISABLE_EMBEDDED_BANKS
#DEFINES += ADLMIDI_USE_DOSBOX_OPL
#DEFINES += ENABLE_BEGIN_SILENCE_SKIPPING
+DEFINES += ENABLE_END_SILENCE_SKIPPING
#DEFINES += DEBUG_TRACE_ALL_EVENTS
#DEFINES += DEBUG_TRACE_ALL_CHANNELS
diff --git a/libADLMIDI.pro b/libADLMIDI.pro
index 92c6009..0044b76 100644
--- a/libADLMIDI.pro
+++ b/libADLMIDI.pro
@@ -12,6 +12,7 @@ INSTALLINCLUDESTO = ADLMIDI
include($$PWD/../audio_codec_common.pri)
DEFINES += ADLMIDI_DISABLE_CPP_EXTRAS
+DEFINES += ENABLE_END_SILENCE_SKIPPING
macx: QMAKE_CXXFLAGS_WARN_ON += -Wno-absolute-value
diff --git a/src/midi_sequencer_impl.hpp b/src/midi_sequencer_impl.hpp
index 0fe6192..e54c7ee 100644
--- a/src/midi_sequencer_impl.hpp
+++ b/src/midi_sequencer_impl.hpp
@@ -614,6 +614,19 @@ bool BW_MidiSequencer::buildSmfTrackData(const std::vector<std::vector<uint8_t>
}
}
+#ifdef ENABLE_END_SILENCE_SKIPPING
+ //Have track end on its own row? Clear any delay on the row before
+ if(event.subtype == MidiEvent::ST_ENDTRACK && evtPos.events.size() == 1)
+ {
+ if (!m_trackData[tk].empty())
+ {
+ MidiTrackRow &previous = m_trackData[tk].back();
+ previous.delay = 0;
+ previous.timeDelay = 0;
+ }
+ }
+#endif
+
if((evtPos.delay > 0) || (event.subtype == MidiEvent::ST_ENDTRACK))
{
evtPos.absPos = abs_position;