Browse Source

Set custom UI scale for VST2 and Juce plugins

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.1
falkTX 4 years ago
parent
commit
01b345f072
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
4 changed files with 30 additions and 10 deletions
  1. +3
    -1
      source/backend/plugin/CarlaPluginJuce.cpp
  2. +7
    -3
      source/backend/plugin/CarlaPluginVST2.cpp
  3. +11
    -4
      source/includes/vestige/vestige.h
  4. +9
    -2
      source/utils/JucePluginWindow.hpp

+ 3
- 1
source/backend/plugin/CarlaPluginJuce.cpp View File

@@ -389,10 +389,12 @@ public:
{
if (fWindow == nullptr)
{
const EngineOptions& opts(pData->engine->getOptions());

juce::String uiName(pData->name);
uiName += " (GUI)";

fWindow = new JucePluginWindow(pData->engine->getOptions().frontendWinId);
fWindow = new JucePluginWindow(opts.frontendWinId, opts.uiScale);
fWindow->setName(uiName);
}



+ 7
- 3
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -40,9 +40,6 @@
#undef VST_FORCE_DEPRECATED
#define VST_FORCE_DEPRECATED 0

#undef kEffectMagic
#define kEffectMagic (CCONST( 'V', 's', 't', 'P' ))

using water::ByteOrder;

CARLA_BACKEND_START_NAMESPACE
@@ -530,6 +527,13 @@ public:
{
fUI.isOpen = true;

// pass ui scale to plugin
dispatcher(effVendorSpecific,
CCONST('P', 'r', 'e', 'S'),
CCONST('A', 'e', 'C', 's'),
nullptr,
pData->engine->getOptions().uiScale);

ERect* vstRect = nullptr;
dispatcher(effEditGetRect, 0, 0, &vstRect);



+ 11
- 4
source/includes/vestige/vestige.h View File

@@ -38,10 +38,17 @@
# define __cdecl
#endif

#define CCONST(a, b, c, d)( ( ( (int) a ) << 24 ) | \
( ( (int) b ) << 16 ) | \
( ( (int) c ) << 8 ) | \
( ( (int) d ) << 0 ) )
#ifdef WORDS_BIGENDIAN
#define CCONST(a, b, c, d) ( ( ( (int) a ) << 0 ) | \
( ( (int) b ) << 8 ) | \
( ( (int) c ) << 16 ) | \
( ( (int) d ) << 24 ) )
#else
#define CCONST(a, b, c, d) ( ( ( (int) a ) << 24 ) | \
( ( (int) b ) << 16 ) | \
( ( (int) c ) << 8 ) | \
( ( (int) d ) << 0 ) )
#endif

#define audioMasterAutomate 0
#define audioMasterVersion 1


+ 9
- 2
source/utils/JucePluginWindow.hpp View File

@@ -36,10 +36,11 @@ namespace juce {
class JucePluginWindow : public DialogWindow
{
public:
JucePluginWindow(const uintptr_t parentId)
JucePluginWindow(const uintptr_t parentId, const float scale)
: DialogWindow("JucePluginWindow", Colour(50, 50, 200), true, false),
fClosed(false),
fTransientId(parentId)
fTransientId(parentId),
fScale(scale)
{
setVisible(false);
//setAlwaysOnTop(true);
@@ -89,9 +90,15 @@ protected:
return true;
}

float getDesktopScaleFactor() const override
{
return fScale;
}

private:
volatile bool fClosed;
const uintptr_t fTransientId;
float fScale;

void setTransient()
{


Loading…
Cancel
Save