@@ -141,17 +141,19 @@ debug: | |||
# --------------------------------------------------------------------------------------------------------------------- | |||
$(BINDIR)/carla-native-plugin$(APP_EXT): $(OBJDIR)/carla-native-plugin.cpp.o $(LIBS) | |||
$(BINDIR)/carla-native-plugin$(APP_EXT): $(OBJDIR)/carla-native-plugin.cpp.o | |||
-@mkdir -p $(BINDIR) | |||
@echo "Linking carla-native-plugin$(APP_EXT)" | |||
@$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(LINK_FLAGS) -o $@ | |||
$(BINDIR)/libcarla_native-plugin$(LIB_EXT): $(OBJDIR)/carla-native-plugin.cpp.o $(LIBS) | |||
$(BINDIR)/libcarla_native-plugin$(LIB_EXT): $(OBJDIR)/carla-native-plugin.cpp.o | |||
-@mkdir -p $(BINDIR) | |||
@echo "Linking libcarla-native-plugin$(LIB_EXT)" | |||
@$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(SYMBOLS_NATIVE) $(LINK_FLAGS) -o $@ | |||
$(BINDIR)/carla.lv2/carla$(LIB_EXT): $(OBJDIR)/carla-lv2.cpp.o $(LIBS) | |||
# --------------------------------------------------------------------------------------------------------------------- | |||
$(BINDIR)/carla.lv2/carla$(LIB_EXT): $(OBJDIR)/carla-lv2.cpp.o | |||
-@mkdir -p $(BINDIR)/carla.lv2 | |||
@echo "Linking carla.lv2/carla$(LIB_EXT)" | |||
@$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(SYMBOLS_LV2) $(LINK_FLAGS) -o $@ | |||
@@ -161,40 +163,42 @@ $(BINDIR)/carla.lv2/carla-ui$(LIB_EXT): $(OBJDIR)/carla-lv2-ui.cpp.o $(LIBS_ui) | |||
@echo "Linking carla.lv2/carla-ui$(LIB_EXT)" | |||
@$(CXX) $< $(LIBS_START) $(LIBS_ui) $(LIBS_END) $(SHARED) $(SYMBOLS_LV2_UI) $(LINK_FLAGS) -o $@ | |||
$(BINDIR)/CarlaRack$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.rack-syn.o $(LIBS) | |||
# --------------------------------------------------------------------------------------------------------------------- | |||
$(BINDIR)/CarlaRack$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.rack-syn.o $(OBJDIR)/carla-vst-export.cpp.o | |||
-@mkdir -p $(BINDIR) | |||
@echo "Linking CarlaRack$(LIB_EXT)" | |||
@$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(LINK_FLAGS) -o $@ | |||
@$(CXX) $^ $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(LINK_FLAGS) -o $@ | |||
$(BINDIR)/CarlaRackFX$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.rack-fx.o $(LIBS) | |||
$(BINDIR)/CarlaRackFX$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.rack-fx.o $(OBJDIR)/carla-vst-export.cpp.o | |||
-@mkdir -p $(BINDIR) | |||
@echo "Linking CarlaRackFX$(LIB_EXT)" | |||
@$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(LINK_FLAGS) -o $@ | |||
@$(CXX) $^ $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(LINK_FLAGS) -o $@ | |||
$(BINDIR)/CarlaPatchbay$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.patchbay-syn.o $(LIBS) | |||
$(BINDIR)/CarlaPatchbay$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.patchbay-syn.o $(OBJDIR)/carla-vst-export.cpp.o | |||
-@mkdir -p $(BINDIR) | |||
@echo "Linking CarlaPatchbay$(LIB_EXT)" | |||
@$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(LINK_FLAGS) -o $@ | |||
@$(CXX) $^ $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(LINK_FLAGS) -o $@ | |||
$(BINDIR)/CarlaPatchbay16$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.patchbay-syn16.o $(LIBS) | |||
$(BINDIR)/CarlaPatchbay16$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.patchbay-syn16.o $(OBJDIR)/carla-vst-export.cpp.o | |||
-@mkdir -p $(BINDIR) | |||
@echo "Linking CarlaPatchbay16$(LIB_EXT)" | |||
@$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(LINK_FLAGS) -o $@ | |||
@$(CXX) $^ $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(LINK_FLAGS) -o $@ | |||
$(BINDIR)/CarlaPatchbay32$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.patchbay-syn32.o $(LIBS) | |||
$(BINDIR)/CarlaPatchbay32$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.patchbay-syn32.o $(OBJDIR)/carla-vst-export.cpp.o | |||
-@mkdir -p $(BINDIR) | |||
@echo "Linking CarlaPatchbay32$(LIB_EXT)" | |||
@$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(LINK_FLAGS) -o $@ | |||
@$(CXX) $^ $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(LINK_FLAGS) -o $@ | |||
$(BINDIR)/CarlaPatchbayFX$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.patchbay-fx.o $(LIBS) | |||
$(BINDIR)/CarlaPatchbayFX$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.patchbay-fx.o $(OBJDIR)/carla-vst-export.cpp.o | |||
-@mkdir -p $(BINDIR) | |||
@echo "Linking CarlaPatchbayFX$(LIB_EXT)" | |||
@$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(LINK_FLAGS) -o $@ | |||
@$(CXX) $^ $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(LINK_FLAGS) -o $@ | |||
$(BINDIR)/CarlaVstShell$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.shell.o $(LIBS) | |||
$(BINDIR)/CarlaVstShell$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.shell.o $(OBJDIR)/carla-vst-export.cpp.o | |||
-@mkdir -p $(BINDIR) | |||
@echo "Linking CarlaRackVstShell$(LIB_EXT)" | |||
@$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(LINK_FLAGS) -o $@ | |||
@$(CXX) $^ $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(LINK_FLAGS) -o $@ | |||
# --------------------------------------------------------------------------------------------------------------------- | |||
@@ -203,6 +207,8 @@ $(OBJDIR)/carla-native-plugin.cpp.o: carla-native-plugin.cpp | |||
@echo "Compiling $<" | |||
@$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | |||
# --------------------------------------------------------------------------------------------------------------------- | |||
$(OBJDIR)/carla-lv2.cpp.o: carla-lv2.cpp | |||
-@mkdir -p $(OBJDIR) | |||
@echo "Compiling $<" | |||
@@ -213,6 +219,8 @@ $(OBJDIR)/carla-lv2-ui.cpp.o: carla-lv2-ui.cpp | |||
@echo "Compiling $<" | |||
@$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | |||
# --------------------------------------------------------------------------------------------------------------------- | |||
$(OBJDIR)/carla-vst.cpp.rack-fx.o: carla-vst.cpp | |||
-@mkdir -p $(OBJDIR) | |||
@echo "Compiling $< (RackFX)" | |||
@@ -248,9 +256,14 @@ $(OBJDIR)/carla-vst.cpp.shell.o: carla-vst.cpp | |||
@echo "Compiling $< (VstShell)" | |||
@$(CXX) $< $(BUILD_CXX_FLAGS) -DCARLA_VST_SHELL=1 -c -o $@ | |||
$(OBJDIR)/carla-vst-export.cpp.o: carla-vst-export.cpp | |||
-@mkdir -p $(OBJDIR) | |||
@echo "Compiling $<" | |||
@$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | |||
# --------------------------------------------------------------------------------------------------------------------- | |||
$(BINDIR)/carla.lv2/manifest.ttl: $(OBJDIR)/carla-lv2-export.cpp.o $(LIBS) | |||
$(BINDIR)/carla.lv2/manifest.ttl: $(OBJDIR)/carla-lv2-export.cpp.o | |||
-@mkdir -p $(BINDIR)/carla.lv2 | |||
@echo "Linking carla-lv2-export$(APP_EXT)" | |||
@$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(LINK_FLAGS) -o $(BINDIR)/carla-lv2-export$(APP_EXT) | |||
@@ -263,7 +276,7 @@ else | |||
endif | |||
@cd $(BINDIR)/carla.lv2 && ln -sf ../*bridge-* ../carla-discovery-* . | |||
$(BINDIR)/carla-lv2-export$(APP_EXT): $(OBJDIR)/carla-lv2-export.cpp.o $(LIBS) | |||
$(BINDIR)/carla-lv2-export$(APP_EXT): $(OBJDIR)/carla-lv2-export.cpp.o | |||
-@mkdir -p $(BINDIR) | |||
@echo "Linking carla-lv2-export$(APP_EXT)" | |||
@$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(LINK_FLAGS) -o $@ | |||
@@ -283,5 +296,6 @@ $(OBJDIR)/carla-lv2-export.cpp.o: carla-lv2-export.cpp | |||
-include $(OBJDIR)/carla-vst.cpp.rack-fx.d | |||
-include $(OBJDIR)/carla-vst.cpp.rack-syn.d | |||
-include $(OBJDIR)/carla-vst.cpp.shell.d | |||
-include $(OBJDIR)/carla-vst-export.cpp.d | |||
# --------------------------------------------------------------------------------------------------------------------- |
@@ -0,0 +1,100 @@ | |||
/* | |||
* Carla Native Plugins | |||
* Copyright (C) 2013-2018 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
*/ | |||
#include "carla-vst.hpp" | |||
#include "ui_launcher.cpp" | |||
#include "ui_launcher_res.cpp" | |||
#include "CarlaDefines.h" | |||
#ifdef __WINE__ | |||
__cdecl static intptr_t cvst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t index, intptr_t value, void* ptr, float opt) | |||
{ | |||
return vst_dispatcherCallback(effect, opcode, index, value, ptr, opt); | |||
} | |||
__cdecl static float cvst_getParameterCallback(AEffect* effect, int32_t index) | |||
{ | |||
return vst_getParameterCallback(effect, index); | |||
} | |||
__cdecl static void cvst_setParameterCallback(AEffect* effect, int32_t index, float value) | |||
{ | |||
return vst_setParameterCallback(effect, index, value); | |||
} | |||
__cdecl static void cvst_processCallback(AEffect* effect, float** inputs, float** outputs, int32_t sampleFrames) | |||
{ | |||
return vst_processCallback(effect, inputs, outputs, sampleFrames); | |||
} | |||
__cdecl static void cvst_processReplacingCallback(AEffect* effect, float** inputs, float** outputs, int32_t sampleFrames) | |||
{ | |||
return vst_processReplacingCallback(effect, inputs, outputs, sampleFrames); | |||
} | |||
#endif | |||
CARLA_EXPORT __cdecl | |||
#if defined(CARLA_OS_WIN) || defined(CARLA_OS_MAC) | |||
const AEffect* VSTPluginMain(audioMasterCallback audioMaster); | |||
#else | |||
const AEffect* VSTPluginMain(audioMasterCallback audioMaster) asm ("main"); | |||
#endif | |||
CARLA_EXPORT __cdecl | |||
const AEffect* VSTPluginMain(audioMasterCallback audioMaster) | |||
{ | |||
// old version | |||
if (audioMaster(nullptr, audioMasterVersion, 0, 0, nullptr, 0.0f) == 0) | |||
return nullptr; | |||
AEffect* const effect(new AEffect); | |||
std::memset(effect, 0, sizeof(AEffect)); | |||
// vst fields | |||
effect->magic = kEffectMagic; | |||
effect->version = CARLA_VERSION_HEX; | |||
// pointers | |||
VstObject* const obj(new VstObject()); | |||
obj->audioMaster = (void*)audioMaster; | |||
obj->plugin = nullptr; | |||
effect->object = obj; | |||
// static calls | |||
#ifdef __WINE__ | |||
effect->dispatcher = cvst_dispatcherCallback; | |||
effect->getParameter = cvst_getParameterCallback; | |||
effect->setParameter = cvst_setParameterCallback; | |||
effect->process = cvst_processCallback; | |||
effect->processReplacing = cvst_processReplacingCallback; | |||
#else | |||
effect->dispatcher = vst_dispatcherCallback; | |||
effect->process = vst_processCallback; | |||
effect->getParameter = vst_getParameterCallback; | |||
effect->setParameter = vst_setParameterCallback; | |||
effect->processReplacing = vst_processReplacingCallback; | |||
#endif | |||
return VSTPluginMainInit(effect); | |||
} | |||
intptr_t VSTAudioMaster(AEffect* effect, int32_t opcode, int32_t index, intptr_t value, void* ptr, float opt) | |||
{ | |||
const audioMasterCallback audioMaster = (audioMasterCallback)((VstObject*)effect->object)->audioMaster; | |||
return audioMaster(effect, opcode, index, value, ptr, opt); | |||
} |
@@ -31,6 +31,7 @@ | |||
#define CARLA_NATIVE_PLUGIN_VST | |||
#include "carla-base.cpp" | |||
#include "carla-vst.hpp" | |||
#include "water/files/File.h" | |||
@@ -52,9 +53,8 @@ class NativePlugin | |||
public: | |||
static const uint32_t kMaxMidiEvents = 512; | |||
NativePlugin(const audioMasterCallback audioMaster, AEffect* const effect, const NativePluginDescriptor* desc) | |||
: fAudioMaster(audioMaster), | |||
fEffect(effect), | |||
NativePlugin(AEffect* const effect, const NativePluginDescriptor* desc) | |||
: fEffect(effect), | |||
fHandle(nullptr), | |||
fHost(), | |||
fDescriptor(desc), | |||
@@ -64,6 +64,7 @@ public: | |||
fMidiEventCount(0), | |||
fTimeInfo(), | |||
fVstRect(), | |||
fUiLauncher(nullptr), | |||
fHostType(kHostTypeNull), | |||
fMidiOutEvents(), | |||
fStateChunk(nullptr) | |||
@@ -103,8 +104,8 @@ public: | |||
fVstRect.top = 0; | |||
fVstRect.left = 0; | |||
fVstRect.bottom = 512; | |||
fVstRect.right = 740; | |||
fVstRect.bottom = ui_launcher_res::carla_uiHeight; | |||
fVstRect.right = ui_launcher_res::carla_uiWidth; | |||
init(); | |||
} | |||
@@ -258,6 +259,7 @@ public: | |||
case effEditOpen: | |||
if (fDescriptor->ui_show != nullptr) | |||
{ | |||
#if 0 | |||
char strBuf[0xff+1]; | |||
strBuf[0xff] = '\0'; | |||
std::snprintf(strBuf, 0xff, P_INTPTR, (intptr_t)ptr); | |||
@@ -297,7 +299,10 @@ public: | |||
carla_msleep(25); | |||
} | |||
} | |||
#else | |||
destoryUILauncher(fUiLauncher); | |||
fUiLauncher = createUILauncher((intptr_t)ptr, fDescriptor, fHandle); | |||
#endif | |||
ret = 1; | |||
} | |||
break; | |||
@@ -305,14 +310,24 @@ public: | |||
case effEditClose: | |||
if (fDescriptor->ui_show != nullptr) | |||
{ | |||
#if 0 | |||
fDescriptor->ui_show(fHandle, false); | |||
#else | |||
destoryUILauncher(fUiLauncher); | |||
fUiLauncher = nullptr; | |||
#endif | |||
ret = 1; | |||
} | |||
break; | |||
case effEditIdle: | |||
if (fDescriptor->ui_idle != nullptr) | |||
fDescriptor->ui_idle(fHandle); | |||
if (fUiLauncher != nullptr) | |||
{ | |||
idleUILauncher(fUiLauncher); | |||
if (fDescriptor->ui_idle != nullptr) | |||
fDescriptor->ui_idle(fHandle); | |||
} | |||
break; | |||
case effGetChunk: | |||
@@ -578,7 +593,6 @@ protected: | |||
private: | |||
// VST stuff | |||
const audioMasterCallback fAudioMaster; | |||
AEffect* const fEffect; | |||
// Native data | |||
@@ -597,6 +611,9 @@ private: | |||
NativeTimeInfo fTimeInfo; | |||
ERect fVstRect; | |||
// UI button | |||
CarlaUILauncher* fUiLauncher; | |||
// Host data | |||
enum HostType { | |||
kHostTypeNull = 0, | |||
@@ -611,7 +628,7 @@ private: | |||
void* const ptr = nullptr, | |||
const float opt = 0.0f) | |||
{ | |||
return fAudioMaster(fEffect, opcode, index, value, ptr, opt); | |||
return VSTAudioMaster(fEffect, opcode, index, value, ptr, opt); | |||
} | |||
struct FixedVstEvents { | |||
@@ -701,17 +718,12 @@ private: | |||
// ----------------------------------------------------------------------- | |||
struct VstObject { | |||
audioMasterCallback audioMaster; | |||
NativePlugin* plugin; | |||
}; | |||
#define validObject effect != nullptr && effect->object != nullptr | |||
#define validPlugin effect != nullptr && effect->object != nullptr && ((VstObject*)effect->object)->plugin != nullptr | |||
#define vstObjectPtr (VstObject*)effect->object | |||
#define pluginPtr (vstObjectPtr)->plugin | |||
static intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t index, intptr_t value, void* ptr, float opt) | |||
intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t index, intptr_t value, void* ptr, float opt) | |||
{ | |||
// handle base opcodes | |||
switch (opcode) | |||
@@ -725,10 +737,8 @@ static intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t | |||
// some hosts call effOpen twice | |||
CARLA_SAFE_ASSERT_RETURN(obj->plugin == nullptr, 1); | |||
const audioMasterCallback audioMaster = (audioMasterCallback)obj->audioMaster; | |||
d_lastBufferSize = static_cast<uint32_t>(audioMaster(effect, audioMasterGetBlockSize, 0, 0, nullptr, 0.0f)); | |||
d_lastSampleRate = static_cast<double>(audioMaster(effect, audioMasterGetSampleRate, 0, 0, nullptr, 0.0f)); | |||
d_lastBufferSize = static_cast<uint32_t>(VSTAudioMaster(effect, audioMasterGetBlockSize, 0, 0, nullptr, 0.0f)); | |||
d_lastSampleRate = static_cast<double>(VSTAudioMaster(effect, audioMasterGetSampleRate, 0, 0, nullptr, 0.0f)); | |||
// some hosts are not ready at this point or return 0 buffersize/samplerate | |||
if (d_lastBufferSize == 0) | |||
@@ -804,7 +814,7 @@ static intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t | |||
effect->flags &= ~effFlagsIsSynth; | |||
#endif // CARLA_VST_SHELL | |||
obj->plugin = new NativePlugin(audioMaster, effect, pluginDesc); | |||
obj->plugin = new NativePlugin(effect, pluginDesc); | |||
return 1; | |||
} | |||
return 0; | |||
@@ -983,26 +993,26 @@ static intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t | |||
return 0; | |||
} | |||
static float vst_getParameterCallback(AEffect* effect, int32_t index) | |||
float vst_getParameterCallback(AEffect* effect, int32_t index) | |||
{ | |||
if (validPlugin) | |||
return pluginPtr->vst_getParameter(index); | |||
return 0.0f; | |||
} | |||
static void vst_setParameterCallback(AEffect* effect, int32_t index, float value) | |||
void vst_setParameterCallback(AEffect* effect, int32_t index, float value) | |||
{ | |||
if (validPlugin) | |||
pluginPtr->vst_setParameter(index, value); | |||
} | |||
static void vst_processCallback(AEffect* effect, float** inputs, float** outputs, int32_t sampleFrames) | |||
void vst_processCallback(AEffect* effect, float** inputs, float** outputs, int32_t sampleFrames) | |||
{ | |||
if (validPlugin) | |||
pluginPtr->vst_processReplacing(const_cast<const float**>(inputs), outputs, sampleFrames); | |||
} | |||
static void vst_processReplacingCallback(AEffect* effect, float** inputs, float** outputs, int32_t sampleFrames) | |||
void vst_processReplacingCallback(AEffect* effect, float** inputs, float** outputs, int32_t sampleFrames) | |||
{ | |||
if (validPlugin) | |||
pluginPtr->vst_processReplacing(const_cast<const float**>(inputs), outputs, sampleFrames); | |||
@@ -1015,29 +1025,10 @@ static void vst_processReplacingCallback(AEffect* effect, float** inputs, float* | |||
// ----------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
#if defined(CARLA_OS_WIN) || defined(CARLA_OS_MAC) | |||
const AEffect* VSTPluginMain(audioMasterCallback audioMaster); | |||
#else | |||
const AEffect* VSTPluginMain(audioMasterCallback audioMaster) asm ("main"); | |||
#endif | |||
CARLA_EXPORT | |||
const AEffect* VSTPluginMain(audioMasterCallback audioMaster) | |||
const AEffect* VSTPluginMainInit(AEffect* const effect) | |||
{ | |||
// old version | |||
if (audioMaster(nullptr, audioMasterVersion, 0, 0, nullptr, 0.0f) == 0) | |||
return nullptr; | |||
AEffect* const effect(new AEffect); | |||
std::memset(effect, 0, sizeof(AEffect)); | |||
// vst fields | |||
effect->magic = kEffectMagic; | |||
effect->version = CARLA_VERSION_HEX; | |||
#if CARLA_VST_SHELL | |||
if (const intptr_t uniqueID = audioMaster(nullptr, audioMasterCurrentId, 0, 0, nullptr, 0.0f)) | |||
if (const intptr_t uniqueID = VSTAudioMaster(effect, audioMasterCurrentId, 0, 0, nullptr, 0.0f)) | |||
effect->uniqueID = uniqueID; | |||
else | |||
effect->uniqueID = kShellUniqueID; | |||
@@ -1086,21 +1077,6 @@ const AEffect* VSTPluginMain(audioMasterCallback audioMaster) | |||
# endif | |||
#endif | |||
// static calls | |||
effect->dispatcher = vst_dispatcherCallback; | |||
effect->process = vst_processCallback; | |||
effect->getParameter = vst_getParameterCallback; | |||
effect->setParameter = vst_setParameterCallback; | |||
effect->processReplacing = vst_processReplacingCallback; | |||
// pointers | |||
VstObject* const obj(new VstObject()); | |||
obj->audioMaster = audioMaster; | |||
obj->plugin = nullptr; | |||
// done | |||
effect->object = obj; | |||
return effect; | |||
} | |||
@@ -0,0 +1,43 @@ | |||
/* | |||
* Carla Native Plugins | |||
* Copyright (C) 2013-2018 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
*/ | |||
#include "CarlaNative.h" | |||
#include "vestige/vestige.h" | |||
#include "ui_launcher_res.hpp" | |||
struct CarlaUILauncher; | |||
class NativePlugin; | |||
struct VstObject { | |||
void* audioMaster; | |||
NativePlugin* plugin; | |||
}; | |||
CarlaUILauncher* createUILauncher(const intptr_t winId, | |||
const NativePluginDescriptor* const d, | |||
const NativePluginHandle h); | |||
void idleUILauncher(CarlaUILauncher* const ui); | |||
void destoryUILauncher(CarlaUILauncher* const ui); | |||
const AEffect* VSTPluginMainInit(AEffect* const effect); | |||
intptr_t VSTAudioMaster(AEffect*, int32_t, int32_t, intptr_t, void*, float); | |||
intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t index, intptr_t value, void* ptr, float opt); | |||
float vst_getParameterCallback(AEffect* effect, int32_t index); | |||
void vst_setParameterCallback(AEffect* effect, int32_t index, float value); | |||
void vst_processCallback(AEffect* effect, float** inputs, float** outputs, int32_t sampleFrames); | |||
void vst_processReplacingCallback(AEffect* effect, float** inputs, float** outputs, int32_t sampleFrames); |
@@ -0,0 +1,100 @@ | |||
/* | |||
* Carla Native Plugin UI launcher | |||
* Copyright (C) 2018 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
*/ | |||
#include "dgl/Application.hpp" | |||
#include "dgl/ImageWidgets.hpp" | |||
#include "CarlaNative.h" | |||
#include "ui_launcher_res.hpp" | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
START_NAMESPACE_DGL | |||
class CarlaButtonWidget : public Widget, | |||
private ImageButton::Callback | |||
{ | |||
public: | |||
CarlaButtonWidget(Window& parent, const NativePluginDescriptor* const d, const NativePluginHandle h) | |||
: Widget(parent), | |||
startButtonImage(ui_launcher_res::carla_uiData, | |||
ui_launcher_res::carla_uiWidth, | |||
ui_launcher_res::carla_uiHeight, | |||
GL_BGR), | |||
startButton(this, startButtonImage), | |||
descriptor(d), | |||
handle(h) | |||
{ | |||
startButton.setCallback(this); | |||
setSize(startButtonImage.getSize()); | |||
parent.setSize(startButtonImage.getSize()); | |||
} | |||
protected: | |||
void onDisplay() override | |||
{ | |||
} | |||
void imageButtonClicked(ImageButton* imageButton, int) override | |||
{ | |||
if (imageButton != &startButton) | |||
return; | |||
if (descriptor->ui_show != nullptr) | |||
descriptor->ui_show(handle, true); | |||
} | |||
private: | |||
Image startButtonImage; | |||
ImageButton startButton; | |||
const NativePluginDescriptor* const descriptor; | |||
const NativePluginHandle handle; | |||
}; | |||
END_NAMESPACE_DGL | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
struct CarlaUILauncher { | |||
DGL_NAMESPACE::Application app; | |||
DGL_NAMESPACE::Window window; | |||
CarlaButtonWidget widget; | |||
CarlaUILauncher(const intptr_t winId, const NativePluginDescriptor* const d, const NativePluginHandle h) | |||
: app(), | |||
window(app, winId), | |||
widget(window, d, h) {} | |||
}; | |||
CarlaUILauncher* createUILauncher(const intptr_t winId, | |||
const NativePluginDescriptor* const d, | |||
const NativePluginHandle h) | |||
{ | |||
return new CarlaUILauncher(winId, d, h); | |||
} | |||
void idleUILauncher(CarlaUILauncher* const ui) | |||
{ | |||
ui->app.idle(); | |||
} | |||
void destoryUILauncher(CarlaUILauncher* const ui) | |||
{ | |||
delete ui; | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- |
@@ -0,0 +1,15 @@ | |||
/* (Auto-generated binary data file). */ | |||
#ifndef BINARY_UI_LAUNCHER_RES_HPP | |||
#define BINARY_UI_LAUNCHER_RES_HPP | |||
namespace ui_launcher_res | |||
{ | |||
extern const char* carla_uiData; | |||
const unsigned int carla_uiDataSize = 183180; | |||
const unsigned int carla_uiWidth = 430; | |||
const unsigned int carla_uiHeight = 142; | |||
} | |||
#endif // BINARY_UI_LAUNCHER_RES_HPP | |||