From ef5362909fcc968194c17a3a0fb381af2edfe4cb Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sun, 30 Mar 2008 20:20:32 +0000 Subject: [PATCH] made controls have a track to allow automation of LADSPA-controls, compare out_sum against getGate()+0.0001f as getGate() might be 0 while out_sum in many cases never will reach 0,0...0 again - fixes high CPU-usage even after stop playing git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@817 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 26 ++++++++++++++++++++++++- include/effect_chain.h | 5 +++++ plugins/ladspa_effect/ladspa_effect.cpp | 15 ++++++++------ 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ae574fdc..83c4040d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,28 @@ -2008-03-24 Paul Giblock +2008-03-30 Tobias Doerffel + + * include/effect_chain.h: + * plugins/ladspa_effect/ladspa_effect.cpp: + - made controls have a track to allow automation of LADSPA-controls + - compare out_sum against getGate()+0.0001f as getGate() might be 0 + while out_sum in many cases never will reach 0,0...0 again - fixes + high CPU-usage even after stop playing + + * include/automatable_button.h: + * src/widgets/automatable_button.cpp: + on model-change, ensure QPushButton's state is correct + + * src/widgets/effect_rack_view.cpp: + properly handle changed models + + * src/tracks/instrument_track.cpp: + when model has changed, also set new model for effect-view + + * src/core/effect_chain.cpp: + - use track as parent + - correct initialization of m_enabledModel which fixes crashes on + model-updates + +2008-03-30 Paul Giblock * plugins/sf2_player/sf2_player.cpp: * plugins/sf2_player/sf2_player.h: diff --git a/include/effect_chain.h b/include/effect_chain.h index 00e560e68..162db717a 100644 --- a/include/effect_chain.h +++ b/include/effect_chain.h @@ -54,6 +54,11 @@ public: void clear( void ); + track * getTrack( void ) + { + return( m_track ); + } + private: typedef QVector effectList; diff --git a/plugins/ladspa_effect/ladspa_effect.cpp b/plugins/ladspa_effect/ladspa_effect.cpp index 1941ae7c8..ce7a548d0 100644 --- a/plugins/ladspa_effect/ladspa_effect.cpp +++ b/plugins/ladspa_effect/ladspa_effect.cpp @@ -33,6 +33,7 @@ #include "ladspa_control.h" #include "ladspa_subplugin_features.h" #include "mixer.h" +#include "effect_chain.h" #undef SINGLE_SOURCE_COMPILE @@ -292,8 +293,10 @@ ladspaEffect::ladspaEffect( model * _parent, { manager->activate( m_key, m_handles[proc] ); } - - m_controls = new ladspaControls( this, NULL /* TODO!! */ ); + track * t = dynamic_cast( _parent ) ? + dynamic_cast( _parent )->getTrack() : + NULL; + m_controls = new ladspaControls( this, t ); } @@ -332,7 +335,7 @@ bool FASTCALL ladspaEffect::processAudioBuffer( surroundSampleFrame * _buf, { return( FALSE ); } - + // Copy the LMMS audio buffer to the LADSPA input buffer and initialize // the control ports. Need to change this to handle non-in-place-broken // plugins--would speed things up to use the same buffer for both @@ -433,10 +436,10 @@ bool FASTCALL ladspaEffect::processAudioBuffer( surroundSampleFrame * _buf, } } } - + // Check whether we need to continue processing input. Restart the // counter if the threshold has been exceeded. - if( out_sum <= getGate() ) + if( out_sum <= getGate()+0.0001f ) { incrementBufferCount(); if( getBufferCount() > getTimeout() ) @@ -449,7 +452,7 @@ bool FASTCALL ladspaEffect::processAudioBuffer( surroundSampleFrame * _buf, { resetBufferCount(); } - + return( isRunning() ); }