1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Allow use of an external VST3 SDK on BSD

This commit is contained in:
Tom Poole 2021-04-01 08:35:42 +01:00
parent 97ee7b7864
commit 60e13bec0c
10 changed files with 38 additions and 32 deletions

View file

@ -1370,8 +1370,8 @@ void ProjectContentComponent::handleMissingSystemHeaders()
String tabMessage ("Compiler not available due to missing system headers\nPlease install a recent version of Visual Studio and the Windows Desktop SDK");
String alertWindowMessage ("Missing system headers\nPlease install a recent version of Visual Studio and the Windows Desktop SDK");
#elif JUCE_LINUX || JUCE_BSD
String tabMessage ("Compiler not available due to missing system headers\nPlease insall using your package manager");
String alertWindowMessage ("Missing system headers\nPlease insall using your package manager");
String tabMessage ("Compiler not available due to missing system headers\nPlease install using your package manager");
String alertWindowMessage ("Missing system headers\nPlease install using your package manager");
#endif
setBuildEnabled (false, true);

View file

@ -27,7 +27,7 @@
#include <juce_core/system/juce_CompilerWarnings.h>
//==============================================================================
#if JucePlugin_Build_VST3 && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX)
#if JucePlugin_Build_VST3 && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD)
#if JUCE_PLUGINHOST_VST3
#if JUCE_MAC
@ -73,7 +73,7 @@
#endif
#endif
#if JUCE_LINUX
#if JUCE_LINUX || JUCE_BSD
#include <unordered_map>
std::vector<std::pair<int, std::function<void (int)>>> getFdReadCallbacks();
@ -1165,7 +1165,7 @@ private:
//==============================================================================
class JuceVST3Editor : public Vst::EditorView,
public Steinberg::IPlugViewContentScaleSupport,
#if JUCE_LINUX
#if JUCE_LINUX || JUCE_BSD
public Steinberg::Linux::IEventHandler,
#endif
private Timer
@ -1195,7 +1195,7 @@ private:
REFCOUNT_METHODS (Vst::EditorView)
//==============================================================================
#if JUCE_LINUX
#if JUCE_LINUX || JUCE_BSD
void PLUGIN_API onFDIsSet (Steinberg::Linux::FileDescriptor fd) override
{
if (plugFrame != nullptr)
@ -1217,7 +1217,7 @@ private:
if (strcmp (type, kPlatformTypeHWND) == 0)
#elif JUCE_MAC
if (strcmp (type, kPlatformTypeNSView) == 0 || strcmp (type, kPlatformTypeHIView) == 0)
#elif JUCE_LINUX
#elif JUCE_LINUX || JUCE_BSD
if (strcmp (type, kPlatformTypeX11EmbedWindowID) == 0)
#endif
return kResultTrue;
@ -1235,7 +1235,7 @@ private:
createContentWrapperComponentIfNeeded();
#if JUCE_WINDOWS || JUCE_LINUX
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD
component->setOpaque (true);
component->addToDesktop (0, (void*) systemWindow);
component->setVisible (true);
@ -1245,7 +1245,7 @@ private:
component->startTimer (500);
#endif
#if JUCE_LINUX
#if JUCE_LINUX || JUCE_BSD
if (auto* runLoop = getHostRunLoop())
{
for (auto& cb : getFdReadCallbacks())
@ -1277,7 +1277,7 @@ private:
{
#if JUCE_WINDOWS
component->removeFromDesktop();
#elif JUCE_LINUX
#elif JUCE_LINUX || JUCE_BSD
fdCallbackMap.clear();
if (auto* runLoop = getHostRunLoop())
@ -1571,7 +1571,7 @@ private:
{
resizeHostWindow();
#if JUCE_LINUX
#if JUCE_LINUX || JUCE_BSD
if (getHostType().isBitwigStudio())
repaint();
#endif
@ -1723,7 +1723,7 @@ private:
#if JUCE_WINDOWS
WindowsHooks hooks;
#elif JUCE_LINUX
#elif JUCE_LINUX || JUCE_BSD
std::unordered_map<int, std::function<void (int)>> fdCallbackMap;
::Display* display = XWindowSystem::getInstance()->getDisplay();
@ -3082,7 +3082,7 @@ bool shutdownModule()
#if JUCE_WINDOWS
extern "C" __declspec (dllexport) bool InitDll() { return initModule(); }
extern "C" __declspec (dllexport) bool ExitDll() { return shutdownModule(); }
#elif JUCE_LINUX
#elif JUCE_LINUX || JUCE_BSD
void* moduleHandle = nullptr;
int moduleEntryCounter = 0;

View file

@ -42,7 +42,7 @@ void AudioPluginFormatManager::addDefaultFormats()
jassert (dynamic_cast<VSTPluginFormat*> (format) == nullptr);
#endif
#if JUCE_PLUGINHOST_VST3 && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX)
#if JUCE_PLUGINHOST_VST3 && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD)
jassert (dynamic_cast<VST3PluginFormat*> (format) == nullptr);
#endif
@ -64,7 +64,7 @@ void AudioPluginFormatManager::addDefaultFormats()
formats.add (new VSTPluginFormat());
#endif
#if JUCE_PLUGINHOST_VST3 && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX)
#if JUCE_PLUGINHOST_VST3 && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD)
formats.add (new VST3PluginFormat());
#endif

View file

@ -0,0 +1,2 @@
Added a compiler error message to plugininterfaces/base/fplatform.h when
attempting to use the SDK on BSD

View file

@ -16,6 +16,10 @@
#pragma once
#if JUCE_BSD
#error To build JUCE VST3 plug-ins on BSD you must use an external BSD-compatible VST3 SDK with JUCE_CUSTOM_VST3_SDK=1
#endif
#define kLittleEndian 0
#define kBigEndian 1

View file

@ -91,7 +91,7 @@ inline void toString128 (Steinberg::Vst::String128 result, const juce::String& s
static const Steinberg::FIDString defaultVST3WindowType = Steinberg::kPlatformTypeHWND;
#elif JUCE_MAC
static const Steinberg::FIDString defaultVST3WindowType = Steinberg::kPlatformTypeNSView;
#elif JUCE_LINUX
#elif JUCE_LINUX || JUCE_BSD
static const Steinberg::FIDString defaultVST3WindowType = Steinberg::kPlatformTypeX11EmbedWindowID;
#endif

View file

@ -156,7 +156,7 @@ namespace Steinberg
DEF_CLASS_IID (IPlugFrame)
DEF_CLASS_IID (IPlugViewContentScaleSupport)
#if JUCE_LINUX
#if JUCE_LINUX || JUCE_BSD
DEF_CLASS_IID (Linux::IRunLoop)
#endif
}

View file

@ -23,7 +23,7 @@
==============================================================================
*/
#if JUCE_PLUGINHOST_VST3 && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX)
#if JUCE_PLUGINHOST_VST3 && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD)
#include "juce_VST3Headers.h"
#include "juce_VST3Common.h"
@ -841,7 +841,7 @@ struct DLLHandle
if (auto* exitFn = (ExitModuleFn) getFunction (exitFnName))
exitFn();
#if JUCE_WINDOWS || JUCE_LINUX
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD
library.close();
#endif
}
@ -866,7 +866,7 @@ struct DLLHandle
void* getFunction (const char* functionName)
{
#if JUCE_WINDOWS || JUCE_LINUX
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD
return library.getFunction (functionName);
#elif JUCE_MAC
if (bundleRef == nullptr)
@ -890,7 +890,7 @@ private:
static constexpr const char* exitFnName = "ExitDll";
using EntryProc = bool (PLUGIN_API*) ();
#elif JUCE_LINUX
#elif JUCE_LINUX || JUCE_BSD
static constexpr const char* entryFnName = "ModuleEntry";
static constexpr const char* exitFnName = "ModuleExit";
@ -903,7 +903,7 @@ private:
#endif
//==============================================================================
#if JUCE_WINDOWS || JUCE_LINUX
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD
DynamicLibrary library;
bool open()
@ -978,7 +978,7 @@ struct DLLHandleCache : public DeletedAtShutdown
DLLHandle& findOrCreateHandle (const String& modulePath)
{
#if JUCE_LINUX
#if JUCE_LINUX || JUCE_BSD
File file (getDLLFileFromBundle (modulePath));
#else
File file (modulePath);
@ -998,7 +998,7 @@ struct DLLHandleCache : public DeletedAtShutdown
}
private:
#if JUCE_LINUX
#if JUCE_LINUX || JUCE_BSD
File getDLLFileFromBundle (const String& bundlePath) const
{
auto machineName = []() -> String
@ -1151,7 +1151,7 @@ struct VST3PluginWindow : public AudioProcessorEditor,
removeScaleFactorListener();
#if JUCE_LINUX
#if JUCE_LINUX || JUCE_BSD
embeddedComponent.removeClient();
#endif
@ -1167,7 +1167,7 @@ struct VST3PluginWindow : public AudioProcessorEditor,
view = nullptr;
}
#if JUCE_LINUX
#if JUCE_LINUX || JUCE_BSD
struct RunLoop final : public Steinberg::Linux::IRunLoop
{
~RunLoop()
@ -1427,7 +1427,7 @@ private:
addAndMakeVisible (embeddedComponent);
#if JUCE_MAC
pluginHandle = (HandleFormat) embeddedComponent.getView();
#elif JUCE_LINUX
#elif JUCE_LINUX || JUCE_BSD
pluginHandle = (HandleFormat) embeddedComponent.getHostWindowID();
#endif
#endif
@ -1490,7 +1490,7 @@ private:
#elif JUCE_MAC
AutoResizingNSViewComponentWithParent embeddedComponent;
using HandleFormat = NSView*;
#elif JUCE_LINUX
#elif JUCE_LINUX || JUCE_BSD
XEmbedComponent embeddedComponent { true, false };
using HandleFormat = Window;
#else
@ -3338,7 +3338,7 @@ bool VST3PluginFormat::fileMightContainThisPluginType (const String& fileOrIdent
auto f = File::createFileWithoutCheckingPath (fileOrIdentifier);
return f.hasFileExtension (".vst3")
#if JUCE_MAC || JUCE_LINUX
#if JUCE_MAC || JUCE_LINUX || JUCE_BSD
&& f.exists();
#else
&& f.existsAsFile();

View file

@ -26,7 +26,7 @@
namespace juce
{
#if (JUCE_PLUGINHOST_VST3 && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX)) || DOXYGEN
#if (JUCE_PLUGINHOST_VST3 && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD)) || DOXYGEN
/**
Implements a plugin format for VST3s.

View file

@ -55,7 +55,7 @@
#undef KeyPress
#endif
#if ! JUCE_WINDOWS && ! JUCE_MAC && ! JUCE_LINUX
#if ! JUCE_WINDOWS && ! JUCE_MAC && ! JUCE_LINUX && ! JUCE_BSD
#undef JUCE_PLUGINHOST_VST3
#define JUCE_PLUGINHOST_VST3 0
#endif
@ -68,7 +68,7 @@
namespace juce
{
#if JUCE_PLUGINHOST_VST || (JUCE_PLUGINHOST_LADSPA && JUCE_LINUX || JUCE_BSD)
#if JUCE_PLUGINHOST_VST || (JUCE_PLUGINHOST_LADSPA && (JUCE_LINUX || JUCE_BSD))
static bool arrayContainsPlugin (const OwnedArray<PluginDescription>& list,
const PluginDescription& desc)