NotePlayHandle: only use detuning automation if it exists at all

This commit is contained in:
Tobias Doerffel
2014-01-20 23:36:38 +01:00
parent 80b8e91fd1
commit 2bc8d12826
2 changed files with 4 additions and 7 deletions

View File

@@ -233,7 +233,6 @@ private:
private:
DetuningHelper * m_detuning;
float m_value;
} ;

View File

@@ -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<float>::isEqual( v, m_baseDetuning->value() ) )
{
m_baseDetuning->setValue( v );