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