Signed-off-by: falkTX <falktx@falktx.com>pull/277/head
@@ -23,6 +23,7 @@ START_NAMESPACE_DISTRHO | |||||
uint32_t d_lastBufferSize = 0; | uint32_t d_lastBufferSize = 0; | ||||
double d_lastSampleRate = 0.0; | double d_lastSampleRate = 0.0; | ||||
bool d_lastCanRequestParameterValueChanges = false; | |||||
/* ------------------------------------------------------------------------------------------------------------ | /* ------------------------------------------------------------------------------------------------------------ | ||||
* Static fallback data, see DistrhoPluginInternal.hpp */ | * Static fallback data, see DistrhoPluginInternal.hpp */ | ||||
@@ -112,7 +113,7 @@ bool Plugin::writeMidiEvent(const MidiEvent& midiEvent) noexcept | |||||
#if DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST | #if DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST | ||||
bool Plugin::canRequestParameterValueChanges() const noexcept | bool Plugin::canRequestParameterValueChanges() const noexcept | ||||
{ | { | ||||
return pData->requestParameterValueChangeCallbackFunc != nullptr; | |||||
return pData->canRequestParameterValueChanges; | |||||
} | } | ||||
bool Plugin::requestParameterValueChange(const uint32_t index, const float value) noexcept | bool Plugin::requestParameterValueChange(const uint32_t index, const float value) noexcept | ||||
@@ -31,6 +31,7 @@ static const uint32_t kMaxMidiEvents = 512; | |||||
extern uint32_t d_lastBufferSize; | extern uint32_t d_lastBufferSize; | ||||
extern double d_lastSampleRate; | extern double d_lastSampleRate; | ||||
extern bool d_lastCanRequestParameterValueChanges; | |||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
// DSP callbacks | // DSP callbacks | ||||
@@ -78,6 +79,7 @@ struct Plugin::PrivateData { | |||||
uint32_t bufferSize; | uint32_t bufferSize; | ||||
double sampleRate; | double sampleRate; | ||||
bool canRequestParameterValueChanges; | |||||
PrivateData() noexcept | PrivateData() noexcept | ||||
: isProcessing(false), | : isProcessing(false), | ||||
@@ -103,7 +105,8 @@ struct Plugin::PrivateData { | |||||
writeMidiCallbackFunc(nullptr), | writeMidiCallbackFunc(nullptr), | ||||
requestParameterValueChangeCallbackFunc(nullptr), | requestParameterValueChangeCallbackFunc(nullptr), | ||||
bufferSize(d_lastBufferSize), | bufferSize(d_lastBufferSize), | ||||
sampleRate(d_lastSampleRate) | |||||
sampleRate(d_lastSampleRate), | |||||
canRequestParameterValueChanges(d_lastCanRequestParameterValueChanges) | |||||
{ | { | ||||
DISTRHO_SAFE_ASSERT(bufferSize != 0); | DISTRHO_SAFE_ASSERT(bufferSize != 0); | ||||
DISTRHO_SAFE_ASSERT(d_isNotZero(sampleRate)); | DISTRHO_SAFE_ASSERT(d_isNotZero(sampleRate)); | ||||
@@ -1367,6 +1367,7 @@ static LV2_Handle lv2_instantiate(const LV2_Descriptor*, double sampleRate, cons | |||||
} | } | ||||
d_lastSampleRate = sampleRate; | d_lastSampleRate = sampleRate; | ||||
d_lastCanRequestParameterValueChanges = ctrlInPortChangeReq != nullptr; | |||||
return new PluginLv2(sampleRate, uridMap, worker, ctrlInPortChangeReq, usingNominal); | return new PluginLv2(sampleRate, uridMap, worker, ctrlInPortChangeReq, usingNominal); | ||||
} | } | ||||
@@ -1286,6 +1286,7 @@ static intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t | |||||
// set valid but dummy values | // set valid but dummy values | ||||
d_lastBufferSize = 512; | d_lastBufferSize = 512; | ||||
d_lastSampleRate = 44100.0; | d_lastSampleRate = 44100.0; | ||||
d_lastCanRequestParameterValueChanges = true; | |||||
} | } | ||||
// Create dummy plugin to get data from | // Create dummy plugin to get data from | ||||
@@ -1296,6 +1297,7 @@ static intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t | |||||
// unset | // unset | ||||
d_lastBufferSize = 0; | d_lastBufferSize = 0; | ||||
d_lastSampleRate = 0.0; | d_lastSampleRate = 0.0; | ||||
d_lastCanRequestParameterValueChanges = false; | |||||
*(PluginExporter**)ptr = &plugin; | *(PluginExporter**)ptr = &plugin; | ||||
return 0; | return 0; | ||||
@@ -1317,6 +1319,7 @@ static intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t | |||||
d_lastBufferSize = audioMaster(effect, audioMasterGetBlockSize, 0, 0, nullptr, 0.0f); | d_lastBufferSize = audioMaster(effect, audioMasterGetBlockSize, 0, 0, nullptr, 0.0f); | ||||
d_lastSampleRate = audioMaster(effect, audioMasterGetSampleRate, 0, 0, nullptr, 0.0f); | d_lastSampleRate = audioMaster(effect, audioMasterGetSampleRate, 0, 0, nullptr, 0.0f); | ||||
d_lastCanRequestParameterValueChanges = true; | |||||
// some hosts are not ready at this point or return 0 buffersize/samplerate | // some hosts are not ready at this point or return 0 buffersize/samplerate | ||||
if (d_lastBufferSize == 0) | if (d_lastBufferSize == 0) | ||||