Skip to content

Commit

Permalink
Update to VST 3.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcima committed Apr 8, 2021
1 parent 39f56f2 commit e53b93b
Show file tree
Hide file tree
Showing 16 changed files with 125 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
shallow = true
[submodule "vst/external/VST_SDK/VST3_SDK/vstgui4"]
path = plugins/editor/external/vstgui4
url = https://github.com/sfztools/vstgui.git
url = https://github.com/steinbergmedia/vstgui.git
shallow = true
[submodule "external/st_audiofile/thirdparty/dr_libs"]
path = external/st_audiofile/thirdparty/dr_libs
Expand Down
58 changes: 28 additions & 30 deletions plugins/editor/cmake/Vstgui.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,6 @@ add_library(sfizz_vstgui STATIC EXCLUDE_FROM_ALL
"${VSTGUI_BASEDIR}/vstgui/lib/animation/animations.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/animation/animator.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/animation/timingfunctions.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cbitmap.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cbitmapfilter.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/ccolor.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cdatabrowser.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cdrawcontext.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cdrawmethods.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cdropsource.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cfileselector.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cfont.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cframe.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cgradientview.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cgraphicspath.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/clayeredviewcontainer.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/clinestyle.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/coffscreencontext.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cautoanimation.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cbuttons.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/controls/ccolorchooser.cpp"
Expand All @@ -40,6 +25,25 @@ add_library(sfizz_vstgui STATIC EXCLUDE_FROM_ALL
"${VSTGUI_BASEDIR}/vstgui/lib/controls/ctextlabel.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cvumeter.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cxypad.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/platformfactory.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/common/fileresourceinputstream.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/common/genericoptionmenu.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/common/generictextedit.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cbitmap.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cbitmapfilter.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/ccolor.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cdatabrowser.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cdrawcontext.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cdrawmethods.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cdropsource.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cfileselector.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cfont.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cframe.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cgradientview.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cgraphicspath.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/clayeredviewcontainer.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/clinestyle.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/coffscreencontext.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/copenglview.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cpoint.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/crect.cpp"
Expand All @@ -54,50 +58,46 @@ add_library(sfizz_vstgui STATIC EXCLUDE_FROM_ALL
"${VSTGUI_BASEDIR}/vstgui/lib/cviewcontainer.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cvstguitimer.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/genericstringlistdatabrowsersource.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/common/genericoptionmenu.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/platformfactory.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/vstguidebug.cpp")
"${VSTGUI_BASEDIR}/vstgui/lib/pixelbuffer.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/vstguidebug.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/vstguiinit.cpp")

add_library(sfizz::vstgui ALIAS sfizz_vstgui)

if(WIN32)
target_sources(sfizz_vstgui PRIVATE
"${VSTGUI_BASEDIR}/vstgui/lib/platform/common/fileresourceinputstream.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2dbitmap.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2ddrawcontext.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2dfont.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2dgraphicspath.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32datapackage.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32dragging.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32factory.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32frame.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32openglview.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32optionmenu.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32support.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32resourcestream.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32support.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32textedit.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32factory.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/winfileselector.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/winstring.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/wintimer.cpp")
elseif(APPLE)
target_sources(sfizz_vstgui PRIVATE
"${VSTGUI_BASEDIR}/vstgui/lib/platform/common/fileresourceinputstream.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/common/genericoptionmenu.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/common/generictextedit.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/carbon/hiviewframe.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/carbon/hiviewoptionmenu.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/carbon/hiviewtextedit.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/caviewlayer.mm"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cfontmac.mm"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cgbitmap.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cgdrawcontext.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cocoa/autoreleasepool.mm"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cocoa/cocoahelpers.mm"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cocoa/cocoaopenglview.mm"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cocoa/cocoatextedit.mm"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cocoa/nsviewdraggingsession.mm"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cocoa/nsviewframe.mm"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cocoa/nsviewoptionmenu.mm"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/caviewlayer.mm"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cfontmac.mm"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cgbitmap.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cgdrawcontext.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/macclipboard.mm"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/macfactory.mm"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/macfileselector.mm"
Expand All @@ -107,8 +107,6 @@ elseif(APPLE)
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/quartzgraphicspath.cpp")
else()
target_sources(sfizz_vstgui PRIVATE
"${VSTGUI_BASEDIR}/vstgui/lib/platform/common/fileresourceinputstream.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/common/generictextedit.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/cairobitmap.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/cairocontext.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/cairofont.cpp"
Expand Down
2 changes: 1 addition & 1 deletion plugins/editor/external/vstgui4
Submodule vstgui4 updated 189 files
8 changes: 6 additions & 2 deletions plugins/lv2/sfizz_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@
#include "editor/utility/vstgui_before.h"
#include "vstgui/lib/cframe.h"
#include "vstgui/lib/platform/iplatformframe.h"
#include "vstgui/lib/platform/platformfactory.h"
#if defined(_WIN32)
#include "vstgui/lib/platform/platform_win32.h"
#include "vstgui/lib/platform/win32/win32factory.h"
#endif
#include "editor/utility/vstgui_after.h"
using namespace VSTGUI;
Expand All @@ -83,6 +85,7 @@ struct sfizz_ui_t : EditorController, VSTGUIEditorInterface {
#if MAC
BundleRefInitializer bundleRefInitializer;
#endif
VSTGUIInitializer vstguiInitializer;
LV2UI_Write_Function write = nullptr;
LV2UI_Controller con = nullptr;
LV2_URID_Map *map = nullptr;
Expand Down Expand Up @@ -229,8 +232,9 @@ instantiate(const LV2UI_Descriptor *descriptor,
if (!fixBundlePath(realBundlePath))
return nullptr;

const Win32Factory* winFactory = VSTGUI::getPlatformFactory().asWin32Factory();
std::string resourcePath = realBundlePath + "\\Contents\\Resources\\";
IWin32PlatformFrame::setResourceBasePath(resourcePath.c_str());
winFactory->setResourceBasePath(resourcePath.c_str());
#endif

// makes labels refresh correctly
Expand All @@ -249,7 +253,7 @@ instantiate(const LV2UI_Descriptor *descriptor,
config = &x11Config;
#endif

if (!uiFrame->open(parentWindowId, kDefaultNative, config))
if (!uiFrame->open(parentWindowId, PlatformType::kDefaultNative, config))
return nullptr;

Editor *editor = new Editor(*self);
Expand Down
30 changes: 30 additions & 0 deletions plugins/lv2/vstgui_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#if MAC
#include "vstgui/plugin-bindings/getpluginbundle.h"
#endif
#include "vstgui/lib/vstguiinit.h"

#if LINUX
void Lv2IdleRunLoop::execIdle()
Expand Down Expand Up @@ -214,3 +215,32 @@ BundleRefInitializer::~BundleRefInitializer()

} // namespace VSTGUI
#endif

namespace VSTGUI {

static volatile size_t gVstguiInitCount = 0;
static std::mutex gVstguiInitMutex;

VSTGUIInitializer::VSTGUIInitializer()
{
std::lock_guard<std::mutex> lock(gVstguiInitMutex);
if (gVstguiInitCount++ == 0) {
#if WINDOWS
VSTGUI::init((HINSTANCE)hInstance);
#elif MAC
VSTGUI::init((CFBundleRef)gBundleRef);
#else
VSTGUI::init(soHandle);
#endif
}
}

VSTGUIInitializer::~VSTGUIInitializer()
{
std::lock_guard<std::mutex> lock(gVstguiInitMutex);
if (--gVstguiInitCount == 0) {
VSTGUI::exit();
}
}

} // namespace VSTGUI
12 changes: 12 additions & 0 deletions plugins/lv2/vstgui_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,15 @@ class BundleRefInitializer {
};
}
#endif

namespace VSTGUI
{
class VSTGUIInitializer {
public:
VSTGUIInitializer();
~VSTGUIInitializer();
private:
VSTGUIInitializer(const VSTGUIInitializer&) = delete;
VSTGUIInitializer& operator=(const VSTGUIInitializer&) = delete;
};
}
9 changes: 7 additions & 2 deletions plugins/vst/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ add_library(sfizz-vst3-core STATIC
FileTrie.cpp
NativeHelpers.h
NativeHelpers.cpp
VstPluginFactory.cpp
IdleUpdateHandler.h
X11RunLoop.h
X11RunLoop.cpp)
Expand Down Expand Up @@ -92,10 +91,12 @@ else()
endif()

# Build the plugin
add_library(${VSTPLUGIN_PRJ_NAME} MODULE)
add_library(${VSTPLUGIN_PRJ_NAME} MODULE "VstPluginFactory.cpp")
if(WIN32)
target_sources(${VSTPLUGIN_PRJ_NAME} PRIVATE vst3.def)
endif()
target_include_directories(${VSTPLUGIN_PRJ_NAME}
PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
target_link_libraries(${VSTPLUGIN_PRJ_NAME}
PRIVATE sfizz-vst3-core)
set_target_properties(${VSTPLUGIN_PRJ_NAME} PROPERTIES
Expand Down Expand Up @@ -176,12 +177,14 @@ elseif(SFIZZ_AU)
set(AUPLUGIN_BUNDLE_NAME "${PROJECT_NAME}.component")

add_library(${AUPLUGIN_PRJ_NAME} MODULE
"VstPluginFactory.cpp"
"${AUWRAPPER_BASEDIR}/aucarbonview.mm"
"${AUWRAPPER_BASEDIR}/aucocoaview.mm"
"${AUWRAPPER_BASEDIR}/ausdk.mm"
"${AUWRAPPER_BASEDIR}/auwrapper.mm"
"${AUWRAPPER_BASEDIR}/NSDataIBStream.mm")
target_include_directories(${AUPLUGIN_PRJ_NAME} PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}"
"${VST3SDK_BASEDIR}")
target_link_libraries(${AUPLUGIN_PRJ_NAME} PRIVATE
"${APPLE_FOUNDATION_LIBRARY}"
Expand Down Expand Up @@ -326,12 +329,14 @@ if(SFIZZ_VST2)
endif()

add_library(${VST2PLUGIN_PRJ_NAME} MODULE
"VstPluginFactory.cpp"
"Vst2PluginFactory.cpp"
"${VST2WRAPPER_BASEDIR}/vst2wrapper.cpp"
"${VST2WRAPPER_BASEDIR}/../basewrapper/basewrapper.cpp"
"${VST2SDK_BASEDIR}/public.sdk/source/vst2.x/audioeffect.cpp"
"${VST2SDK_BASEDIR}/public.sdk/source/vst2.x/audioeffectx.cpp")
target_include_directories(${VST2PLUGIN_PRJ_NAME} PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}"
"${VST2SDK_BASEDIR}")

if(NOT WIN32)
Expand Down
10 changes: 6 additions & 4 deletions plugins/vst/SfizzVstController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,10 @@ FUnknown* SfizzVstController::createInstance(void*)
return static_cast<Vst::IEditController*>(new SfizzVstController);
}

/*
Note(jpc) Generated at random with uuidgen.
Can't find docs on it... maybe it's to register somewhere?
*/
template <>
FUnknown* createInstance<SfizzVstController>(void* context)
{
return SfizzVstController::createInstance(context);
}

FUID SfizzVstController::cid = SfizzVstController_cid;
2 changes: 1 addition & 1 deletion plugins/vst/SfizzVstEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SfizzVstEditor : public Vst::VSTGUIEditor,
absl::Span<FObject*> triggerUpdates);
~SfizzVstEditor();

bool PLUGIN_API open(void* parent, const VSTGUI::PlatformType& platformType = VSTGUI::kDefaultNative) override;
bool PLUGIN_API open(void* parent, const VSTGUI::PlatformType& platformType) override;
void PLUGIN_API close() override;

SfizzVstController* getController() const
Expand Down
7 changes: 7 additions & 0 deletions plugins/vst/SfizzVstIDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
#pragma once
#include <pluginterfaces/base/funknown.h>

/*
Note(jpc) Generated at random with uuidgen.
Can't find docs on it... maybe it's to register somewhere?
*/
#define SfizzVstProcessor_cid \
Steinberg::FUID(0xe8fab718, 0x15ed46e3, 0x8b598310, 0x1e12993f)
#define SfizzVstController_cid \
Steinberg::FUID(0x7129736c, 0xbc784134, 0xbb899d56, 0x2ebafe4f)

template <class T>
Steinberg::FUnknown* createInstance(void*);
20 changes: 11 additions & 9 deletions plugins/vst/SfizzVstProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,11 +609,6 @@ tresult PLUGIN_API SfizzVstProcessor::notify(Vst::IMessage* message)
return result;
}

FUnknown* SfizzVstProcessor::createInstance(void*)
{
return static_cast<Vst::IAudioProcessor*>(new SfizzVstProcessor);
}

void SfizzVstProcessor::receiveMessage(int delay, const char* path, const char* sig, const sfizz_arg_t* args)
{
uint8_t* oscTemp = _oscTemp.get();
Expand Down Expand Up @@ -863,8 +858,15 @@ bool SfizzVstProcessor::writeMessage(Ring_Buffer& fifo, const char* type, const
return true;
}

/*
Note(jpc) Generated at random with uuidgen.
Can't find docs on it... maybe it's to register somewhere?
*/
FUnknown* SfizzVstProcessor::createInstance(void*)
{
return static_cast<Vst::IAudioProcessor*>(new SfizzVstProcessor);
}

template <>
FUnknown* createInstance<SfizzVstProcessor>(void* context)
{
return SfizzVstProcessor::createInstance(context);
}

FUID SfizzVstProcessor::cid = SfizzVstProcessor_cid;
Loading

0 comments on commit e53b93b

Please sign in to comment.