Browse Source

Handle more sources of vst automation via audioMasterAutomate

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.1-alpha2
falkTX 6 years ago
parent
commit
c76dd69eb5
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 25 additions and 10 deletions
  1. +25
    -10
      source/backend/plugin/CarlaPluginVST2.cpp

+ 25
- 10
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -79,6 +79,7 @@ public:
fIsInitializing(true), fIsInitializing(true),
fIsProcessing(false), fIsProcessing(false),
fChangingValuesThread(kNullThread), fChangingValuesThread(kNullThread),
fIdleThread(kNullThread),
fMainThread(pthread_self()), fMainThread(pthread_self()),
fProcThread(kNullThread), fProcThread(kNullThread),
#ifdef CARLA_OS_MAC #ifdef CARLA_OS_MAC
@@ -569,7 +570,10 @@ public:
void idle() override void idle() override
{ {
if (fNeedIdle) if (fNeedIdle)
{
const ScopedValueSetter<pthread_t> svs(fIdleThread, pthread_self(), kNullThread);
dispatcher(effIdle); dispatcher(effIdle);
}


CarlaPlugin::idle(); CarlaPlugin::idle();
} }
@@ -1894,30 +1898,40 @@ protected:


const pthread_t thisThread = pthread_self(); const pthread_t thisThread = pthread_self();


/**/ if (fProcThread != kNullThread && pthread_equal(thisThread, fProcThread))
if (pthread_equal(thisThread, kNullThread))
{
carla_stderr("audioMasterAutomate called with null thread!?");
setParameterValue(uindex, fixedValue, false, true, true);
}
// Called from plugin process thread, nasty! (likely MIDI learn)
else if (pthread_equal(thisThread, fProcThread))
{ {
// Called from plugin process thread, nasty! (likely MIDI learn)
CARLA_SAFE_ASSERT(fIsProcessing); CARLA_SAFE_ASSERT(fIsProcessing);
pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, 0, fixedValue); pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, 0, fixedValue);
} }
else if (fChangingValuesThread != kNullThread && pthread_equal(thisThread, fChangingValuesThread))
// Called from effSetChunk or effSetProgram
else if (pthread_equal(thisThread, fChangingValuesThread))
{ {
// Called from effSetChunk or effSetProgram
carla_debug("audioMasterAutomate called while setting state");
pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, 0, fixedValue); pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, 0, fixedValue);
} }
// Called from effIdle
else if (pthread_equal(thisThread, fIdleThread))
{
carla_debug("audioMasterAutomate called from idle thread");
pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, 0, fixedValue);
}
// Called from UI?
else if (fUI.isVisible) else if (fUI.isVisible)
{ {
// Called from UI?
carla_debug("audioMasterAutomate called while UI visible");
CarlaPlugin::setParameterValue(uindex, fixedValue, false, true, true); CarlaPlugin::setParameterValue(uindex, fixedValue, false, true, true);
} }
// Unknown
else else
{ {
// Unknown
// TODO - check if plugin or UI is initializing
carla_stdout("audioMasterAutomate called from unknown source"); carla_stdout("audioMasterAutomate called from unknown source");

setParameterValue(uindex, fixedValue, true, true, true);
//pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, 0, fixedValue);
setParameterValue(uindex, fixedValue, false, true, true);
} }
break; break;
} }
@@ -2478,6 +2492,7 @@ private:
bool fIsInitializing; bool fIsInitializing;
bool fIsProcessing; bool fIsProcessing;
pthread_t fChangingValuesThread; pthread_t fChangingValuesThread;
pthread_t fIdleThread;
pthread_t fMainThread; pthread_t fMainThread;
pthread_t fProcThread; pthread_t fProcThread;




Loading…
Cancel
Save