Skip to content

Commit

Permalink
sequencer: enable end silence skipping
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcima committed Aug 28, 2018
1 parent 6c49548 commit 66d2b29
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions libADLMIDI-test.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions libADLMIDI.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 13 additions & 0 deletions src/midi_sequencer_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 66d2b29

Please sign in to comment.