diff --git a/source/plugin/carla-vst.cpp b/source/plugin/carla-vst.cpp index 34ddb8331..4dcf974e5 100644 --- a/source/plugin/carla-vst.cpp +++ b/source/plugin/carla-vst.cpp @@ -211,17 +211,17 @@ public: carla_zeroStruct(fTimeInfo); // tell host we want MIDI events - masterCallback(audioMasterWantMidi); + hostCallback(audioMasterWantMidi); // deactivate for possible changes if (fDescriptor->deactivate != nullptr && fIsActive) fDescriptor->deactivate(fHandle); // check if something changed - const uint32_t bufferSize = static_cast(masterCallback(audioMasterGetBlockSize)); - const double sampleRate = static_cast(masterCallback(audioMasterGetSampleRate)); + const uint32_t bufferSize = static_cast(hostCallback(audioMasterGetBlockSize)); + const double sampleRate = static_cast(hostCallback(audioMasterGetSampleRate)); - if (fBufferSize != bufferSize) + if (bufferSize != 0 && fBufferSize != bufferSize) { fBufferSize = bufferSize; @@ -229,7 +229,7 @@ public: fDescriptor->dispatcher(fHandle, NATIVE_PLUGIN_OPCODE_BUFFER_SIZE_CHANGED, 0, (int32_t)value, nullptr, 0.0f); } - if (! carla_compareFloats(fSampleRate, sampleRate)) + if (sampleRate != 0.0 && ! carla_compareFloats(fSampleRate, sampleRate)) { fSampleRate = sampleRate; @@ -270,7 +270,7 @@ public: // check if vst host is tracktion carla_zeroChar(strBuf, 0xff+1); - masterCallback(audioMasterGetProductString, 0, 0, strBuf, 0.0f); + hostCallback(audioMasterGetProductString, 0, 0, strBuf, 0.0f); const bool isTracktion(std::strcmp(strBuf, "Tracktion") == 0); @@ -293,7 +293,7 @@ public: for (int x=10; --x>=0;) { - masterCallback(audioMasterIdle); + hostCallback(audioMasterIdle); carla_msleep(25); } } @@ -349,7 +349,6 @@ public: { // host has not activated the plugin yet, nasty! vst_dispatcher(effMainsChanged, 0, 1, nullptr, 0.0f); - fIsActive = true; } if (const VstEvents* const events = (const VstEvents*)ptr) @@ -418,12 +417,11 @@ public: { // host has not activated the plugin yet, nasty! vst_dispatcher(effMainsChanged, 0, 1, nullptr, 0.0f); - fIsActive = true; } static const int kWantVstTimeFlags(kVstTransportPlaying|kVstPpqPosValid|kVstTempoValid|kVstTimeSigValid); - if (const VstTimeInfo* const vstTimeInfo = (const VstTimeInfo*)masterCallback(audioMasterGetTime, 0, kWantVstTimeFlags)) + if (const VstTimeInfo* const vstTimeInfo = (const VstTimeInfo*)hostCallback(audioMasterGetTime, 0, kWantVstTimeFlags)) { fTimeInfo.frame = static_cast(vstTimeInfo->samplePos); fTimeInfo.playing = (vstTimeInfo->flags & kVstTransportPlaying); @@ -469,7 +467,7 @@ public: fMidiEventCount = 0; if (fMidiOutEvents.numEvents > 0) - masterCallback(audioMasterProcessEvents, 0, 0, &fMidiOutEvents, 0.0f); + hostCallback(audioMasterProcessEvents, 0, 0, &fMidiOutEvents, 0.0f); } protected: @@ -558,7 +556,7 @@ protected: break; case NATIVE_HOST_OPCODE_HOST_IDLE: - masterCallback(audioMasterIdle); + hostCallback(audioMasterIdle); break; } @@ -590,11 +588,11 @@ private: ERect fVstRect; // host callback - intptr_t masterCallback(const int32_t opcode, - const int32_t index = 0, - const intptr_t value = 0, - void* const ptr = nullptr, - const float opt = 0.0f) + intptr_t hostCallback(const int32_t opcode, + const int32_t index = 0, + const intptr_t value = 0, + void* const ptr = nullptr, + const float opt = 0.0f) { return fAudioMaster(fEffect, opcode, index, value, ptr, opt); }