Browse Source

Tweaks for wasm builds; Fix crash when UI is not available

Signed-off-by: falkTX <falktx@falktx.com>
tags/v1.1
falkTX 2 years ago
parent
commit
afeb4123a1
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
8 changed files with 35 additions and 11 deletions
  1. +7
    -1
      Makefile
  2. +1
    -1
      carla
  3. +1
    -1
      dpf
  4. +1
    -1
      dpf-widgets
  5. +1
    -0
      plugins/Common/IldaeilBasePlugin.hpp
  6. +1
    -0
      plugins/Common/IldaeilPlugin.cpp
  7. +22
    -6
      plugins/Common/IldaeilUI.cpp
  8. +1
    -1
      plugins/Common/PluginHostWindow.cpp

+ 7
- 1
Makefile View File

@@ -33,6 +33,12 @@ ifneq ($(DEBUG),true)
CARLA_EXTRA_ARGS += EXTERNAL_PLUGINS=true CARLA_EXTRA_ARGS += EXTERNAL_PLUGINS=true
endif endif


CARLA_TARGETS = static-plugin

ifneq ($(WASM),true)
CARLA_TARGETS += bridges-plugin bridges-ui
endif

# -------------------------------------------------------------- # --------------------------------------------------------------
# Check for X11+OpenGL dependencies # Check for X11+OpenGL dependencies


@@ -59,7 +65,7 @@ endif
# -------------------------------------------------------------- # --------------------------------------------------------------


carla: dgl carla: dgl
$(MAKE) bridges-plugin bridges-ui static-plugin -C carla $(CARLA_EXTRA_ARGS)
$(MAKE) -C carla $(CARLA_EXTRA_ARGS) $(CARLA_TARGETS)


dgl: dgl:
$(MAKE) -C dpf/dgl opengl $(MAKE) -C dpf/dgl opengl


+ 1
- 1
carla

@@ -1 +1 @@
Subproject commit 33bd1f94b33c53e208bb13d09a567a02976b9f1f
Subproject commit 6ee03336ab0a15dba4da78dbf7413624228c5db5

+ 1
- 1
dpf

@@ -1 +1 @@
Subproject commit 34bf2a4dfca724fc544f8ab0a15727ddf558d7d8
Subproject commit b9e654c3d331933dbeae0413246be8dc2bd64a58

+ 1
- 1
dpf-widgets

@@ -1 +1 @@
Subproject commit 191da3265214af66fe9b12d0222a8296f8c61230
Subproject commit b0a1286f7933dc5f6d33237e2dff7b64267c62ae

+ 1
- 0
plugins/Common/IldaeilBasePlugin.hpp View File

@@ -57,6 +57,7 @@ public:


void ildaeilProjectLoadedFromDSP(void* ui); void ildaeilProjectLoadedFromDSP(void* ui);
void ildaeilParameterChangeForUI(void* ui, uint32_t index, float value); void ildaeilParameterChangeForUI(void* ui, uint32_t index, float value);
void ildaeilCloseUI(void* ui);
const char* ildaeilOpenFileForUI(void* ui, bool isDir, const char* title, const char* filter); const char* ildaeilOpenFileForUI(void* ui, bool isDir, const char* title, const char* filter);


// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------


+ 1
- 0
plugins/Common/IldaeilPlugin.cpp View File

@@ -533,6 +533,7 @@ static void host_ui_custom_data_changed(NativeHostHandle handle, const char* key
static void host_ui_closed(NativeHostHandle handle) static void host_ui_closed(NativeHostHandle handle)
{ {
d_stdout("%s %p", __FUNCTION__, handle); d_stdout("%s %p", __FUNCTION__, handle);
ildaeilCloseUI(static_cast<IldaeilPlugin*>(handle));
} }
static const char* host_ui_open_file(const NativeHostHandle handle, const bool isDir, const char* const title, const char* const filter) static const char* host_ui_open_file(const NativeHostHandle handle, const bool isDir, const char* const title, const char* const filter)


+ 22
- 6
plugins/Common/IldaeilUI.cpp View File

@@ -302,10 +302,10 @@ public:


if (carla_get_current_plugin_count(handle) != 0) if (carla_get_current_plugin_count(handle) != 0)
{ {
#ifndef DISTRHO_OS_WASM
// FIXME // FIXME
const uint hints = carla_get_plugin_info(handle, fPluginId)->hints; const uint hints = carla_get_plugin_info(handle, fPluginId)->hints;
fPluginHasCustomUI = hints & PLUGIN_HAS_CUSTOM_UI; fPluginHasCustomUI = hints & PLUGIN_HAS_CUSTOM_UI;
#ifndef DISTRHO_OS_WASM
fPluginHasEmbedUI = hints & PLUGIN_HAS_CUSTOM_EMBED_UI; fPluginHasEmbedUI = hints & PLUGIN_HAS_CUSTOM_EMBED_UI;
#endif #endif
fPluginRunning = true; fPluginRunning = true;
@@ -342,6 +342,12 @@ public:
repaint(); repaint();
} }


void closeUI()
{
if (fIdleState == kIdleGiveIdleToUI)
fIdleState = kIdleNothing;
}

const char* openFileFromDSP(const bool /*isDir*/, const char* const title, const char* const /*filter*/) const char* openFileFromDSP(const bool /*isDir*/, const char* const title, const char* const /*filter*/)
{ {
DISTRHO_SAFE_ASSERT_RETURN(fPluginType == PLUGIN_INTERNAL || fPluginType == PLUGIN_LV2, nullptr); DISTRHO_SAFE_ASSERT_RETURN(fPluginType == PLUGIN_INTERNAL || fPluginType == PLUGIN_LV2, nullptr);
@@ -354,10 +360,10 @@ public:


void showPluginUI(const CarlaHostHandle handle, const bool showIfNotEmbed) void showPluginUI(const CarlaHostHandle handle, const bool showIfNotEmbed)
{ {
// FIXME
#ifndef DISTRHO_OS_WASM #ifndef DISTRHO_OS_WASM
const CarlaPluginInfo* const info = carla_get_plugin_info(handle, fPluginId); const CarlaPluginInfo* const info = carla_get_plugin_info(handle, fPluginId);


// FIXME
if (info->hints & PLUGIN_HAS_CUSTOM_EMBED_UI) if (info->hints & PLUGIN_HAS_CUSTOM_EMBED_UI)
{ {
fDrawingState = kDrawingPluginEmbedUI; fDrawingState = kDrawingPluginEmbedUI;
@@ -396,9 +402,9 @@ public:
info = carla_get_plugin_info(handle, fPluginId); info = carla_get_plugin_info(handle, fPluginId);


fDrawingState = kDrawingPluginGenericUI; fDrawingState = kDrawingPluginGenericUI;
#ifndef DISTRHO_OS_WASM
// FIXME // FIXME
fPluginHasCustomUI = info->hints & PLUGIN_HAS_CUSTOM_UI; fPluginHasCustomUI = info->hints & PLUGIN_HAS_CUSTOM_UI;
#ifndef DISTRHO_OS_WASM
fPluginHasEmbedUI = info->hints & PLUGIN_HAS_CUSTOM_EMBED_UI; fPluginHasEmbedUI = info->hints & PLUGIN_HAS_CUSTOM_EMBED_UI;
#endif #endif


@@ -613,7 +619,8 @@ protected:
break; break;


case kIdleGiveIdleToUI: case kIdleGiveIdleToUI:
fPlugin->fCarlaPluginDescriptor->ui_idle(fPlugin->fCarlaPluginHandle);
if (fPlugin->fCarlaPluginDescriptor->ui_idle != nullptr)
fPlugin->fCarlaPluginDescriptor->ui_idle(fPlugin->fCarlaPluginHandle);
fPluginHostWindow.idle(); fPluginHostWindow.idle();
break; break;


@@ -745,7 +752,7 @@ protected:
if (info->cvIns != 0 || info->cvOuts != 0) if (info->cvIns != 0 || info->cvOuts != 0)
break; break;


#ifdef WASM_TESTING
#ifdef DISTRHO_OS_WASM
if (info->midiIns != 0 && info->midiIns != 1) if (info->midiIns != 0 && info->midiIns != 1)
break; break;
if (info->midiOuts != 0 && info->midiOuts != 1) if (info->midiOuts != 0 && info->midiOuts != 1)
@@ -782,7 +789,7 @@ protected:


if (fPluginType == PLUGIN_INTERNAL) if (fPluginType == PLUGIN_INTERNAL)
{ {
#ifndef WASM_TESTING
#ifndef DISTRHO_OS_WASM
if (std::strcmp(info->label, "audiogain_s") == 0) if (std::strcmp(info->label, "audiogain_s") == 0)
break; break;
#endif #endif
@@ -1263,10 +1270,19 @@ void ildaeilParameterChangeForUI(void* const ui, const uint32_t index, const flo
static_cast<IldaeilUI*>(ui)->changeParameterFromDSP(index, value); static_cast<IldaeilUI*>(ui)->changeParameterFromDSP(index, value);
} }


void ildaeilCloseUI(void* ui)
{
DISTRHO_SAFE_ASSERT_RETURN(ui != nullptr,);

d_stdout("%s %d", __PRETTY_FUNCTION__, __LINE__);
static_cast<IldaeilUI*>(ui)->closeUI();
}

const char* ildaeilOpenFileForUI(void* const ui, const bool isDir, const char* const title, const char* const filter) const char* ildaeilOpenFileForUI(void* const ui, const bool isDir, const char* const title, const char* const filter)
{ {
DISTRHO_SAFE_ASSERT_RETURN(ui != nullptr, nullptr); DISTRHO_SAFE_ASSERT_RETURN(ui != nullptr, nullptr);


d_stdout("%s %d", __PRETTY_FUNCTION__, __LINE__);
return static_cast<IldaeilUI*>(ui)->openFileFromDSP(isDir, title, filter); return static_cast<IldaeilUI*>(ui)->openFileFromDSP(isDir, title, filter);
} }




+ 1
- 1
plugins/Common/PluginHostWindow.cpp View File

@@ -174,10 +174,10 @@ struct PluginHostWindow::PrivateData
break; break;
} }
} }
#elif defined(DISTRHO_OS_WASM)
#elif defined(DISTRHO_OS_WINDOWS) #elif defined(DISTRHO_OS_WINDOWS)
if (pluginWindow == nullptr) if (pluginWindow == nullptr)
pluginWindow = FindWindowExA((::HWND)parentWindowId, nullptr, nullptr, nullptr); pluginWindow = FindWindowExA((::HWND)parentWindowId, nullptr, nullptr, nullptr);
#elif defined(DISTRHO_OS_WASM)
#else #else
if (display == nullptr) if (display == nullptr)
return; return;


Loading…
Cancel
Save