From 2bc8d12826bf8ad2bbef268ce573592a4fd2c585 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Mon, 20 Jan 2014 23:36:38 +0100 Subject: [PATCH] NotePlayHandle: only use detuning automation if it exists at all --- include/note_play_handle.h | 1 - src/core/note_play_handle.cpp | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/include/note_play_handle.h b/include/note_play_handle.h index 84ec7c20f..2c2b2e3f1 100644 --- a/include/note_play_handle.h +++ b/include/note_play_handle.h @@ -233,7 +233,6 @@ private: private: - DetuningHelper * m_detuning; float m_value; } ; diff --git a/src/core/note_play_handle.cpp b/src/core/note_play_handle.cpp index a8f0604fd..9654cde23 100644 --- a/src/core/note_play_handle.cpp +++ b/src/core/note_play_handle.cpp @@ -34,8 +34,7 @@ notePlayHandle::BaseDetuning::BaseDetuning( DetuningHelper *detuning ) : - m_detuning( detuning ), - m_value( m_detuning->automationPattern()->valueAt( 0 ) ) + m_value( detuning ? detuning->automationPattern()->valueAt( 0 ) : 0 ) { } @@ -503,12 +502,11 @@ void notePlayHandle::updateFrequency() -void notePlayHandle::processMidiTime( const midiTime & _time ) +void notePlayHandle::processMidiTime( const midiTime& time ) { - if( _time >= songGlobalParentOffset()+pos() ) + if( detuning() && time >= songGlobalParentOffset()+pos() ) { - const float v = detuning()->automationPattern()-> - valueAt( _time - songGlobalParentOffset() - pos() ); + const float v = detuning()->automationPattern()->valueAt( time - songGlobalParentOffset() - pos() ); if( !typeInfo::isEqual( v, m_baseDetuning->value() ) ) { m_baseDetuning->setValue( v );