From 932768dac0c010d9fb6690db00d7aace20b78a1f Mon Sep 17 00:00:00 2001 From: Hannu Haahti Date: Thu, 17 Jul 2014 16:19:00 +0300 Subject: [PATCH] add option to keep effects running even without input --- include/config_mgr.h | 11 +++++++++++ include/setup_dialog.h | 1 + src/core/Effect.cpp | 7 +++++++ src/gui/setup_dialog.cpp | 17 +++++++++++++++++ 4 files changed, 36 insertions(+) diff --git a/include/config_mgr.h b/include/config_mgr.h index ec3babf3c..0708daa52 100644 --- a/include/config_mgr.h +++ b/include/config_mgr.h @@ -163,6 +163,16 @@ public: return( m_recentlyOpenedProjects ); } + const bool isAutoquitDisabled() const + { + return m_isAutoquitDisabled; + } + + void setAutoquitDisabled( bool value ) + { + m_isAutoquitDisabled = value; + } + void addRecentlyOpenedProject( const QString & _file ); const QString & value( const QString & _class, @@ -209,6 +219,7 @@ private: QString m_backgroundArtwork; QStringList m_recentlyOpenedProjects; + bool m_isAutoquitDisabled; typedef QVector > stringPairVector; typedef QMap settingsMap; diff --git a/include/setup_dialog.h b/include/setup_dialog.h index 53c2be08f..00a51c22f 100644 --- a/include/setup_dialog.h +++ b/include/setup_dialog.h @@ -110,6 +110,7 @@ private slots: void toggleAnimateAFP( bool _enabled ); void toggleNoteLabels( bool en ); void toggleDisplayWaveform( bool en ); + void toggleDisableAutoquit( bool en ); private: diff --git a/src/core/Effect.cpp b/src/core/Effect.cpp index fc94132cb..c49834d4c 100644 --- a/src/core/Effect.cpp +++ b/src/core/Effect.cpp @@ -31,6 +31,8 @@ #include "EffectControls.h" #include "EffectView.h" +#include "config_mgr.h" + Effect::Effect( const Plugin::Descriptor * _desc, Model * _parent, @@ -131,6 +133,11 @@ Effect * Effect::instantiate( const QString& pluginName, void Effect::checkGate( double _out_sum ) { + if( configManager::inst()->isAutoquitDisabled() ) + { + return; + } + // Check whether we need to continue processing input. Restart the // counter if the threshold has been exceeded. if( _out_sum - gate() <= typeInfo::minEps() ) diff --git a/src/gui/setup_dialog.cpp b/src/gui/setup_dialog.cpp index 6ed9e5848..437bfb27a 100644 --- a/src/gui/setup_dialog.cpp +++ b/src/gui/setup_dialog.cpp @@ -289,6 +289,15 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) : connect( displayWaveform, SIGNAL( toggled( bool ) ), this, SLOT( toggleDisplayWaveform( bool ) ) ); + ledCheckBox * disableAutoquit = new ledCheckBox( + tr( "Keep effects running even without input" ), + misc_tw ); + labelNumber++; + disableAutoquit->move( XDelta, YDelta*labelNumber ); + disableAutoquit->setChecked( configManager::inst()->isAutoquitDisabled() ); + connect( disableAutoquit, SIGNAL( toggled( bool ) ), + this, SLOT( toggleDisableAutoquit( bool ) ) ); + misc_tw->setFixedHeight( YDelta*labelNumber + HeaderSize ); @@ -813,6 +822,8 @@ void setupDialog::accept() QString::number( m_printNoteLabels ) ); configManager::inst()->setValue( "ui", "displaywaveform", QString::number( m_displayWaveform ) ); + configManager::inst()->setValue( "ui", "disableautoquit", + QString::number( configManager::inst()->isAutoquitDisabled() ) ); configManager::inst()->setWorkingDir( m_workingDir ); @@ -1002,6 +1013,12 @@ void setupDialog::toggleDisplayWaveform( bool en ) } +void setupDialog::toggleDisableAutoquit( bool en ) +{ + configManager::inst()->setAutoquitDisabled( en ); +} + + void setupDialog::toggleOneInstrumentTrackWindow( bool _enabled ) { m_oneInstrumentTrackWindow = _enabled;