From f7af370f8ffa065db1339b31237c70ec6de27f54 Mon Sep 17 00:00:00 2001 From: Hyunin Song Date: Sun, 22 Oct 2017 22:56:14 +0900 Subject: [PATCH 1/4] Ignore release frames for single-streamed instruments --- src/core/InstrumentSoundShaping.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core/InstrumentSoundShaping.cpp b/src/core/InstrumentSoundShaping.cpp index 22327ae8eed..62b16244379 100644 --- a/src/core/InstrumentSoundShaping.cpp +++ b/src/core/InstrumentSoundShaping.cpp @@ -299,13 +299,18 @@ f_cnt_t InstrumentSoundShaping::envFrames( const bool _only_vol ) const f_cnt_t InstrumentSoundShaping::releaseFrames() const { + f_cnt_t ret_val = m_instrumentTrack->instrument() + ? m_instrumentTrack->instrument()->desiredReleaseFrames() + : 0; + if( !m_instrumentTrack->instrument()->flags().testFlag( Instrument::IsSingleStreamed ) ) + { + return ret_val; + } + if( m_envLfoParameters[Volume]->isUsed() ) { return m_envLfoParameters[Volume]->releaseFrames(); } - f_cnt_t ret_val = m_instrumentTrack->instrument() - ? m_instrumentTrack->instrument()->desiredReleaseFrames() - : 0; for( int i = Volume+1; i < NumTargets; ++i ) { From aace2534c9ef82d2cf21fc9b25be036a2457284b Mon Sep 17 00:00:00 2001 From: Hyunjin Song Date: Mon, 23 Oct 2017 07:22:14 +0900 Subject: [PATCH 2/4] Add safety check logic If m_instrumentTrack->instrument() is NULL, there's no reason to return non-zero value in InstrumentSoundShaping::releaseFrames(). And such situation shouldn't occur anymore. --- src/core/InstrumentSoundShaping.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/InstrumentSoundShaping.cpp b/src/core/InstrumentSoundShaping.cpp index 62b16244379..af8be934cda 100644 --- a/src/core/InstrumentSoundShaping.cpp +++ b/src/core/InstrumentSoundShaping.cpp @@ -299,9 +299,13 @@ f_cnt_t InstrumentSoundShaping::envFrames( const bool _only_vol ) const f_cnt_t InstrumentSoundShaping::releaseFrames() const { - f_cnt_t ret_val = m_instrumentTrack->instrument() - ? m_instrumentTrack->instrument()->desiredReleaseFrames() - : 0; + if( !m_instrumentTrack->instrument() ) + { + return 0; + } + + f_cnt_t ret_val = m_instrumentTrack->instrument()->desiredReleaseFrames(); + if( !m_instrumentTrack->instrument()->flags().testFlag( Instrument::IsSingleStreamed ) ) { return ret_val; From 2cb62a4415b99c5b5c214658d7efc37ed33c2b59 Mon Sep 17 00:00:00 2001 From: Hyunjin Song Date: Mon, 23 Oct 2017 07:23:54 +0900 Subject: [PATCH 3/4] Fix whitespace --- src/core/InstrumentSoundShaping.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/InstrumentSoundShaping.cpp b/src/core/InstrumentSoundShaping.cpp index af8be934cda..bbc16c99cf6 100644 --- a/src/core/InstrumentSoundShaping.cpp +++ b/src/core/InstrumentSoundShaping.cpp @@ -303,9 +303,9 @@ f_cnt_t InstrumentSoundShaping::releaseFrames() const { return 0; } - + f_cnt_t ret_val = m_instrumentTrack->instrument()->desiredReleaseFrames(); - + if( !m_instrumentTrack->instrument()->flags().testFlag( Instrument::IsSingleStreamed ) ) { return ret_val; From 6ad5b0bd2b3d4bf5024acde5f450b6ba0c3e6191 Mon Sep 17 00:00:00 2001 From: Hyunjin Song Date: Mon, 23 Oct 2017 07:55:40 +0900 Subject: [PATCH 4/4] Fix wrong condition --- src/core/InstrumentSoundShaping.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/InstrumentSoundShaping.cpp b/src/core/InstrumentSoundShaping.cpp index bbc16c99cf6..56011de04c5 100644 --- a/src/core/InstrumentSoundShaping.cpp +++ b/src/core/InstrumentSoundShaping.cpp @@ -306,7 +306,7 @@ f_cnt_t InstrumentSoundShaping::releaseFrames() const f_cnt_t ret_val = m_instrumentTrack->instrument()->desiredReleaseFrames(); - if( !m_instrumentTrack->instrument()->flags().testFlag( Instrument::IsSingleStreamed ) ) + if( m_instrumentTrack->instrument()->flags().testFlag( Instrument::IsSingleStreamed ) ) { return ret_val; }