| @@ -81,6 +81,7 @@ public: | |||||
| fMidiEventCount(0), | fMidiEventCount(0), | ||||
| fTimeInfo(), | fTimeInfo(), | ||||
| fVstRect(), | fVstRect(), | ||||
| fHostType(kHostTypeNull), | |||||
| fMidiOutEvents(), | fMidiOutEvents(), | ||||
| fStateChunk(nullptr), | fStateChunk(nullptr), | ||||
| sJuceInitialiser() | sJuceInitialiser() | ||||
| @@ -91,6 +92,7 @@ public: | |||||
| // find resource dir | // find resource dir | ||||
| using juce::File; | using juce::File; | ||||
| using juce::String; | |||||
| File curExe = File::getSpecialLocation(File::currentExecutableFile).getLinkedTarget(); | File curExe = File::getSpecialLocation(File::currentExecutableFile).getLinkedTarget(); | ||||
| File resDir = curExe.getSiblingFile("carla-resources"); | File resDir = curExe.getSiblingFile("carla-resources"); | ||||
| @@ -99,6 +101,12 @@ public: | |||||
| if (! resDir.exists()) | if (! resDir.exists()) | ||||
| resDir = File("/usr/share/carla/resources/"); | resDir = File("/usr/share/carla/resources/"); | ||||
| // find host type | |||||
| const String hostFilename(File::getSpecialLocation(File::hostApplicationPath).getFileName()); | |||||
| if (hostFilename.startsWith("Bitwig")) | |||||
| fHostType = kHostTypeBitwig; | |||||
| fHost.resourceDir = carla_strdup(resDir.getFullPathName().toRawUTF8()); | fHost.resourceDir = carla_strdup(resDir.getFullPathName().toRawUTF8()); | ||||
| fHost.get_buffer_size = host_get_buffer_size; | fHost.get_buffer_size = host_get_buffer_size; | ||||
| @@ -388,6 +396,24 @@ public: | |||||
| if (sampleFrames <= 0) | if (sampleFrames <= 0) | ||||
| return; | return; | ||||
| if (fHostType == kHostTypeBitwig && static_cast<int32_t>(fBufferSize) != sampleFrames) | |||||
| { | |||||
| // deactivate first if needed | |||||
| if (fIsActive && fDescriptor->deactivate != nullptr) | |||||
| fDescriptor->deactivate(fHandle); | |||||
| fBufferSize = static_cast<uint32_t>(sampleFrames); | |||||
| if (fDescriptor->dispatcher != nullptr) | |||||
| fDescriptor->dispatcher(fHandle, NATIVE_PLUGIN_OPCODE_BUFFER_SIZE_CHANGED, 0, sampleFrames, nullptr, 0.0f); | |||||
| // activate again | |||||
| if (fDescriptor->activate != nullptr) | |||||
| fDescriptor->activate(fHandle); | |||||
| fIsActive = true; | |||||
| } | |||||
| if (! fIsActive) | if (! fIsActive) | ||||
| { | { | ||||
| // host has not activated the plugin yet, nasty! | // host has not activated the plugin yet, nasty! | ||||
| @@ -549,6 +575,13 @@ private: | |||||
| NativeTimeInfo fTimeInfo; | NativeTimeInfo fTimeInfo; | ||||
| ERect fVstRect; | ERect fVstRect; | ||||
| // Host data | |||||
| enum HostType { | |||||
| kHostTypeNull = 0, | |||||
| kHostTypeBitwig | |||||
| }; | |||||
| HostType fHostType; | |||||
| // host callback | // host callback | ||||
| intptr_t hostCallback(const int32_t opcode, | intptr_t hostCallback(const int32_t opcode, | ||||
| const int32_t index = 0, | const int32_t index = 0, | ||||