Skip to content

Commit

Permalink
Update carla and dpf, get macOS behaviour the same level as others
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Feb 26, 2024
1 parent 8d65bc0 commit 4b7cdeb
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 71 deletions.
2 changes: 1 addition & 1 deletion dpf
Submodule dpf updated 112 files
12 changes: 6 additions & 6 deletions plugins/Common/IldaeilPlugin.cpp
@@ -1,6 +1,6 @@
/*
* DISTRHO Ildaeil Plugin
* Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2021-2024 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
Expand Down Expand Up @@ -585,15 +585,15 @@ class IldaeilPlugin : public IldaeilBasePlugin

int64_t getUniqueId() const override
{
#if ILDAEIL_STANDALONE
#if ILDAEIL_STANDALONE
return d_cconst('d', 'I', 'l', 'd');
#elif DISTRHO_PLUGIN_IS_SYNTH
#elif DISTRHO_PLUGIN_IS_SYNTH
return d_cconst('d', 'I', 'l', 'S');
#elif DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
#elif DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
return d_cconst('d', 'I', 'l', 'M');
#else
#else
return d_cconst('d', 'I', 'l', 'F');
#endif
#endif
}

/* --------------------------------------------------------------------------------------------------------
Expand Down
13 changes: 3 additions & 10 deletions plugins/Common/IldaeilUI.cpp
Expand Up @@ -258,15 +258,12 @@ class IldaeilUI : public UI,
{
setGeometryConstraints(kMinWidth * scaleFactor, kMinHeight * scaleFactor);
setSize(kInitialWidth * scaleFactor, kInitialHeight * scaleFactor);
fPluginHostWindow.setPositionAndSize(0, kButtonHeight * scaleFactor + paddingY,
kInitialWidth * scaleFactor,
(kInitialHeight - kButtonHeight) * scaleFactor - paddingY);
fPluginHostWindow.setOffset(0, kButtonHeight * scaleFactor + paddingY);
}
else
{
setGeometryConstraints(kMinWidth, kMinHeight);
fPluginHostWindow.setPositionAndSize(0, kButtonHeight + paddingY,
kInitialWidth, kInitialHeight - kButtonHeight - paddingY);
fPluginHostWindow.setOffset(0, kButtonHeight + paddingY);
}

const CarlaHostHandle handle = fPlugin->fCarlaHostHandle;
Expand Down Expand Up @@ -672,8 +669,6 @@ class IldaeilUI : public UI,
const CarlaHostHandle handle = fPlugin->fCarlaHostHandle;
DISTRHO_SAFE_ASSERT_RETURN(handle != nullptr,);

// carla_juce_idle();

if (fDrawingState == kDrawingPluginGenericUI && fPluginGenericUI != nullptr && fPluginHasOutputParameters)
{
updatePluginGenericUI(handle);
Expand Down Expand Up @@ -1028,9 +1023,7 @@ class IldaeilUI : public UI,
#elif DISTRHO_PLUGIN_IS_SYNTH
if (info->io.midiIns != 1)
return;
if (info->io.audioIns == 0)
return;
if ((info->metadata.hints & PLUGIN_IS_SYNTH) == 0x0)
if (info->io.audioOuts == 0)
return;
#elif DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
if ((info->io.midiIns != 1 && info->io.audioIns != 0 && info->io.audioOuts != 0) || info->io.midiOuts != 1)
Expand Down
7 changes: 5 additions & 2 deletions plugins/Common/Makefile.mk
Expand Up @@ -126,9 +126,9 @@ else
TARGETS_BASE = lv2 vst2 clap
TARGETS_EXTRA = carlabins

# VST3 does not do MIDI filter plugins, by design
# Skip MIDI filter for AUv2 and VST3, which deal with pure MIDI plugins in a weird way
ifneq ($(NAME),Ildaeil-MIDI)
TARGETS_BASE += vst3
TARGETS_BASE += vst3 au
endif

endif
Expand Down Expand Up @@ -175,6 +175,9 @@ else
install -m 755 $(CARLA_BINARIES) $(shell dirname $(vst2))
install -m 755 $(CARLA_BINARIES) $(shell dirname $(clap))
ifneq ($(NAME),Ildaeil-MIDI)
ifeq ($(MACOS),true)
install -m 755 $(CARLA_BINARIES) $(shell dirname $(au))
endif
install -m 755 $(CARLA_BINARIES) $(shell dirname $(vst3))
endif
endif
Expand Down
72 changes: 24 additions & 48 deletions plugins/Common/PluginHostWindow.cpp
Expand Up @@ -57,8 +57,7 @@ struct PluginHostWindow::PrivateData

#if defined(DISTRHO_OS_HAIKU)
#elif defined(DISTRHO_OS_MAC)
NSView* view;
NSView* subview;
NSView* pluginView;
#elif defined(DISTRHO_OS_WASM)
#elif defined(DISTRHO_OS_WINDOWS)
::HWND pluginWindow;
Expand All @@ -76,8 +75,7 @@ struct PluginHostWindow::PrivateData
pluginWindowCallbacks(cbs),
#if defined(DISTRHO_OS_HAIKU)
#elif defined(DISTRHO_OS_MAC)
view(nullptr),
subview(nullptr),
pluginView(nullptr),
#elif defined(DISTRHO_OS_WASM)
#elif defined(DISTRHO_OS_WINDOWS)
pluginWindow(nullptr),
Expand All @@ -91,12 +89,6 @@ struct PluginHostWindow::PrivateData
{
#if defined(DISTRHO_OS_HAIKU)
#elif defined(DISTRHO_OS_MAC)
view = [[NSView new]retain];
DISTRHO_SAFE_ASSERT_RETURN(view != nullptr,)
[view setAutoresizingMask:NSViewNotSizable];
[view setAutoresizesSubviews:NO];
[view setHidden:YES];
[(NSView*)parentWindowId addSubview:view];
#elif defined(DISTRHO_OS_WASM)
#elif defined(DISTRHO_OS_WINDOWS)
#else
Expand All @@ -109,8 +101,6 @@ struct PluginHostWindow::PrivateData
{
#if defined(DISTRHO_OS_HAIKU)
#elif defined(DISTRHO_OS_MAC)
if (view != nullptr)
[view release];
#elif defined(DISTRHO_OS_WASM)
#elif defined(DISTRHO_OS_WINDOWS)
#else
Expand All @@ -125,8 +115,8 @@ struct PluginHostWindow::PrivateData
#if defined(DISTRHO_OS_HAIKU)
return nullptr;
#elif defined(DISTRHO_OS_MAC)
subview = nullptr;
return view;
pluginView = nullptr;
return (void*)parentWindowId;
#elif defined(DISTRHO_OS_WASM)
return nullptr;
#elif defined(DISTRHO_OS_WINDOWS)
Expand All @@ -142,9 +132,10 @@ struct PluginHostWindow::PrivateData
{
#if defined(DISTRHO_OS_HAIKU)
#elif defined(DISTRHO_OS_MAC)
if (view != nullptr)
if (pluginView != nullptr)
{
[view setHidden:YES];
[pluginView setHidden:YES];
pluginView = nullptr;
[NSOpenGLContext clearCurrentContext];
return true;
}
Expand Down Expand Up @@ -174,14 +165,17 @@ struct PluginHostWindow::PrivateData
{
#if defined(DISTRHO_OS_HAIKU)
#elif defined(DISTRHO_OS_MAC)
if (view == nullptr)
return;

if (subview == nullptr)
if (pluginView == nullptr)
{
for (NSView* subview2 in [view subviews])
bool first = true;
for (NSView* view in [(NSView*)parentWindowId subviews])
{
subview = subview2;
if (first)
{
first = false;
continue;
}
pluginView = view;
break;
}
}
Expand Down Expand Up @@ -214,10 +208,10 @@ struct PluginHostWindow::PrivateData

#if defined(DISTRHO_OS_HAIKU)
#elif defined(DISTRHO_OS_MAC)
if (subview != nullptr)
if (pluginView != nullptr)
{
const double scaleFactor = [[[view window] screen] backingScaleFactor];
const NSSize size = [subview frame].size;
const double scaleFactor = [[[pluginView window] screen] backingScaleFactor];
const NSSize size = [pluginView frame].size;
const double width = size.width;
const double height = size.height;

Expand All @@ -227,9 +221,8 @@ struct PluginHostWindow::PrivateData
if (width > 1.0 && height > 1.0)
{
lookingForChildren = false;
[view setFrameSize:size];
[view setHidden:NO];
[view setNeedsDisplay:YES];
[pluginView setFrameOrigin:NSMakePoint(xOffset / scaleFactor, yOffset / scaleFactor)];
[pluginView setNeedsDisplay:YES];
pluginWindowCallbacks->pluginWindowResized(width * scaleFactor, height * scaleFactor);
}
}
Expand Down Expand Up @@ -317,25 +310,8 @@ struct PluginHostWindow::PrivateData
#endif
}

void setPositionAndSize(const uint x, const uint y, const uint width, const uint height)
void setOffset(const uint x, const uint y)
{
#if defined(DISTRHO_OS_HAIKU)
#elif defined(DISTRHO_OS_MAC)
if (view != nullptr)
{
const double scaleFactor = [[[view window] screen] backingScaleFactor];
[view setFrame:NSMakeRect(x / scaleFactor, y / scaleFactor, width / scaleFactor, height / scaleFactor)];
}
#elif defined(DISTRHO_OS_WASM)
#elif defined(DISTRHO_OS_WINDOWS)
// unused
(void)width;
(void)height;
#else
// unused
(void)width;
(void)height;
#endif
xOffset = x;
yOffset = y;
}
Expand Down Expand Up @@ -364,9 +340,9 @@ void PluginHostWindow::idle()
pData->idle();
}

void PluginHostWindow::setPositionAndSize(const uint x, const uint y, const uint width, const uint height)
void PluginHostWindow::setOffset(const uint x, const uint y)
{
pData->setPositionAndSize(x, y, width, height);
pData->setOffset(x, y);
}

END_NAMESPACE_DGL
2 changes: 1 addition & 1 deletion plugins/Common/PluginHostWindow.hpp
Expand Up @@ -38,7 +38,7 @@ class PluginHostWindow
void* attachAndGetWindowHandle();
bool hide();
void idle();
void setPositionAndSize(uint x, uint y, uint width, uint height);
void setOffset(uint x, uint y);
};

END_NAMESPACE_DGL
6 changes: 5 additions & 1 deletion plugins/FX/DistrhoPluginInfo.h
@@ -1,6 +1,6 @@
/*
* DISTRHO Ildaeil Plugin
* Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2021-2024 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
Expand All @@ -23,6 +23,8 @@
#define DISTRHO_PLUGIN_URI "https://distrho.kx.studio/plugins/ildaeil#fx"
#define DISTRHO_PLUGIN_CLAP_ID "studio.kx.distrho.ildaeil#fx"

#define DISTRHO_PLUGIN_BRAND_ID Dstr
#define DISTRHO_PLUGIN_UNIQUE_ID ilda
#define DISTRHO_PLUGIN_CLAP_FEATURES "audio-effect", "stereo"
#define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:UtilityPlugin"
#define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|Stereo"
Expand All @@ -45,6 +47,8 @@
#define DISTRHO_UI_DEFAULT_WIDTH kInitialWidth
#define DISTRHO_UI_DEFAULT_HEIGHT kInitialHeight

#define DPF_VST3_DONT_USE_BRAND_ID

#define ILDAEIL_STANDALONE 0

static constexpr const uint kInitialWidth = 520;
Expand Down
6 changes: 5 additions & 1 deletion plugins/Synth/DistrhoPluginInfo.h
@@ -1,6 +1,6 @@
/*
* DISTRHO Ildaeil Plugin
* Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2021-2024 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
Expand All @@ -23,6 +23,8 @@
#define DISTRHO_PLUGIN_URI "https://distrho.kx.studio/plugins/ildaeil#synth"
#define DISTRHO_PLUGIN_CLAP_ID "studio.kx.distrho.ildaeil#synth"

#define DISTRHO_PLUGIN_BRAND_ID Dstr
#define DISTRHO_PLUGIN_UNIQUE_ID ilda
#define DISTRHO_PLUGIN_CLAP_FEATURES "instrument", "stereo"
#define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:InstrumentPlugin"
#define DISTRHO_PLUGIN_VST3_CATEGORIES "Instrument|Stereo"
Expand All @@ -45,6 +47,8 @@
#define DISTRHO_UI_DEFAULT_WIDTH kInitialWidth
#define DISTRHO_UI_DEFAULT_HEIGHT kInitialHeight

#define DPF_VST3_DONT_USE_BRAND_ID

#define ILDAEIL_STANDALONE 0

static constexpr const uint kInitialWidth = 520;
Expand Down

0 comments on commit 4b7cdeb

Please sign in to comment.