Skip to content

Commit

Permalink
ship plugin for linux, fix for repeated value changes
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Mar 16, 2024
1 parent 689f023 commit fa9854b
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/DPF
Submodule DPF updated 1 files
+5 −1 utils/generate-ttl.sh
29 changes: 20 additions & 9 deletions src/plugin/DesktopUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DesktopUI : public UI,
String label;
String error;
String errorDetail;
uint port = 0;
int port = 0;
void* webview = nullptr;

public:
Expand Down Expand Up @@ -93,14 +93,22 @@ class DesktopUI : public UI,

if (value < 0.f)
{
const int nport = d_roundToIntNegative(value);
DISTRHO_SAFE_ASSERT_RETURN(nport != 0,);

if (nport == port)
return;

port = nport;

if (webview != nullptr)
{
destroyWebView(webview);
webview = nullptr;
buttonOpenWebGui.hide();
}

switch (-d_roundToIntNegative(value))
switch (-nport)
{
case kErrorAppDirNotFound:
error = "Error: MOD Desktop application directory not found";
Expand Down Expand Up @@ -128,6 +136,12 @@ class DesktopUI : public UI,
return;
}

const int nport = d_roundToUnsignedInt(value);
DISTRHO_SAFE_ASSERT_RETURN(nport != 0,);

if (nport == port)
return;

if (error.isNotEmpty())
{
error.clear();
Expand All @@ -144,12 +158,9 @@ class DesktopUI : public UI,
repaint();
}

port = d_roundToUnsignedInt(value);
DISTRHO_SAFE_ASSERT_RETURN(port != 0,);

port += kPortNumOffset;
d_stderr("webview port is %d", port);
webview = addWebView(getWindow().getNativeWindowHandle(), getScaleFactor(), port);
port = nport;
d_stderr("webview port is %d", port + kPortNumOffset);
webview = addWebView(getWindow().getNativeWindowHandle(), getScaleFactor(), port + kPortNumOffset);

buttonOpenWebGui.show();
repaint();
Expand Down Expand Up @@ -205,7 +216,7 @@ class DesktopUI : public UI,
openUserFilesDir();
break;
case 3:
openWebGui(port);
openWebGui(port + kPortNumOffset);
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include ../DPF/Makefile.base.mk
# ---------------------------------------------------------------------------------------------------------------------
# Project name, used for binaries

NAME = MOD-Desktop
NAME = mod-desktop

# ---------------------------------------------------------------------------------------------------------------------
# Files to build
Expand Down
5 changes: 4 additions & 1 deletion src/plugin/WebViewX11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ void* addWebView(const uintptr_t parentWinId, const double scaleFactor, const ui
std::strncpy(ldlinux, info.dli_fname, PATH_MAX - 1);
}
}
const char* const filename = getBinaryFilename();

d_stdout("ld-linux is '%s'", ldlinux);
d_stdout("filename is '%s'", filename);

::Display* const display = XOpenDisplay(nullptr);
DISTRHO_SAFE_ASSERT_RETURN(display != nullptr, nullptr);
Expand Down Expand Up @@ -85,7 +88,7 @@ void* addWebView(const uintptr_t parentWinId, const double scaleFactor, const ui
ipc->childWindow = 0;
ipc->ourWindow = parentWinId;

const char* const args[] = { ldlinux, getBinaryFilename(), nullptr };
const char* const args[] = { ldlinux, filename, nullptr };
ipc->p.start(args, envp);

for (uint i = 0; envp[i] != nullptr; ++i)
Expand Down
3 changes: 2 additions & 1 deletion utils/linux/linux-tar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ rm -rf mod-ui/modtools/__pycache__

ARCH=$(uname -m)
VERSION="$(cat VERSION)"
mkdir mod-desktop-${VERSION}-linux-${ARCH}${SUFFIX}
mkdir -p mod-desktop-${VERSION}-linux-${ARCH}${SUFFIX}/plugin-variants
mv build mod-desktop-${VERSION}-linux-${ARCH}${SUFFIX}/mod-desktop
cp utils/linux/mod-desktop.* mod-desktop-${VERSION}-linux-${ARCH}${SUFFIX}/
cp -r build-plugin/*.* mod-desktop-${VERSION}-linux-${ARCH}${SUFFIX}/plugin-variants/
tar chJf mod-desktop-${VERSION}-linux-${ARCH}${SUFFIX}.tar.xz mod-desktop-${VERSION}-linux-${ARCH}${SUFFIX}
8 changes: 4 additions & 4 deletions utils/win64/win64-installer.iss
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ Source: "..\..\build\mod-desktop-asio.dll"; DestDir: "{win}\System32"; Flags: ig
Source: "..\..\build\mod-hardware-descriptor.json"; DestDir: "{app}"; Flags: ignoreversion;
Source: "..\..\build\VERSION"; DestDir: "{app}"; Flags: ignoreversion;
; plugin variants
Source: "..\..\build-plugin\MOD-Desktop.clap"; DestDir: "{commoncf64}\CLAP"; Components: clap; Flags: ignoreversion;
Source: "..\..\build-plugin\MOD-Desktop.lv2\*.*"; DestDir: "{commoncf64}\LV2\MOD-Desktop.lv2"; Components: lv2; Flags: ignoreversion;
Source: "..\..\build-plugin\MOD-Desktop-vst.dll"; DestDir: "{code:GetVST2Dir}\"; Components: vst2; Flags: ignoreversion;
Source: "..\..\build-plugin\MOD-Desktop.vst3\Contents\x86_64-win\*.*"; DestDir: "{commoncf64}\VST3\MOD-Desktop.vst3\Contents\x86_64-win"; Components: vst3; Flags: ignoreversion;
Source: "..\..\build-plugin\mod-desktop.clap"; DestDir: "{commoncf64}\CLAP"; Components: clap; Flags: ignoreversion;
Source: "..\..\build-plugin\mod-desktop.lv2\*.*"; DestDir: "{commoncf64}\LV2\mod-desktop.lv2"; Components: lv2; Flags: ignoreversion;
Source: "..\..\build-plugin\mod-desktop-vst.dll"; DestDir: "{code:GetVST2Dir}\"; Components: vst2; Flags: ignoreversion;
Source: "..\..\build-plugin\mod-desktop.vst3\Contents\x86_64-win\*.*"; DestDir: "{commoncf64}\VST3\mod-desktop.vst3\Contents\x86_64-win"; Components: vst3; Flags: ignoreversion;
; pedalboards
#include "win64-pedalboards.iss"
; plugins
Expand Down

0 comments on commit fa9854b

Please sign in to comment.