Browse Source

Fix a couple of issues with carla-plugin

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 4 years ago
parent
commit
dbfc6116a9
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
4 changed files with 30 additions and 40 deletions
  1. +2
    -1
      source/backend/CarlaEngine.hpp
  2. +2
    -2
      source/backend/CarlaStandalone.cpp
  3. +24
    -35
      source/backend/engine/CarlaEngineNative.cpp
  4. +2
    -2
      source/frontend/carla_host.py

+ 2
- 1
source/backend/CarlaEngine.hpp View File

@@ -1146,7 +1146,8 @@ public:
* Call the file callback, if set. * Call the file callback, if set.
* May be called by plugins. * May be called by plugins.
*/ */
const char* runFileCallback(FileCallbackOpcode action, bool isDir, const char* title, const char* filter) noexcept;
virtual const char* runFileCallback(FileCallbackOpcode action,
bool isDir, const char* title, const char* filter) noexcept;


/*! /*!
* Set the file callback to @a func. * Set the file callback to @a func.


+ 2
- 2
source/backend/CarlaStandalone.cpp View File

@@ -588,7 +588,6 @@ void carla_set_engine_callback(CarlaHostHandle handle, EngineCallbackFunc func,
{ {
carla_debug("carla_set_engine_callback(%p, %p, %p)", handle, func, ptr); carla_debug("carla_set_engine_callback(%p, %p, %p)", handle, func, ptr);


#ifndef BUILD_BRIDGE
if (handle->isStandalone) if (handle->isStandalone)
{ {
CarlaHostStandalone& shandle((CarlaHostStandalone&)*handle); CarlaHostStandalone& shandle((CarlaHostStandalone&)*handle);
@@ -596,9 +595,10 @@ void carla_set_engine_callback(CarlaHostHandle handle, EngineCallbackFunc func,
shandle.engineCallback = func; shandle.engineCallback = func;
shandle.engineCallbackPtr = ptr; shandle.engineCallbackPtr = ptr;


#ifndef BUILD_BRIDGE
shandle.logThread.setCallback(func, ptr); shandle.logThread.setCallback(func, ptr);
}
#endif #endif
}


if (handle->engine != nullptr) if (handle->engine != nullptr)
handle->engine->setCallback(func, ptr); handle->engine->setCallback(func, ptr);


+ 24
- 35
source/backend/engine/CarlaEngineNative.cpp View File

@@ -240,9 +240,6 @@ public:


pData->options.resourceDir = carla_strdup(pHost->resourceDir); pData->options.resourceDir = carla_strdup(pHost->resourceDir);
pData->options.binaryDir = carla_strdup(carla_get_library_folder()); pData->options.binaryDir = carla_strdup(carla_get_library_folder());

setCallback(_ui_server_callback, this);
setFileCallback(_ui_file_callback, this);
} }


~CarlaEngineNative() override ~CarlaEngineNative() override
@@ -329,6 +326,9 @@ public:
{ {
CarlaEngine::callback(sendHost, sendOsc, action, pluginId, value1, value2, value3, valuef, valueStr); CarlaEngine::callback(sendHost, sendOsc, action, pluginId, value1, value2, value3, valuef, valueStr);


if (sendHost)
uiServerCallback(action, pluginId, value1, value2, value3, valuef, valueStr);

switch (action) switch (action)
{ {
case ENGINE_CALLBACK_IDLE: case ENGINE_CALLBACK_IDLE:
@@ -353,6 +353,24 @@ public:
} }
} }


const char* runFileCallback(FileCallbackOpcode action,
bool isDir, const char* title, const char* filter) noexcept override
{
switch (action)
{
case FILE_CALLBACK_DEBUG:
return nullptr;

case FILE_CALLBACK_OPEN:
return pHost->ui_open_file(pHost->handle, isDir, title, filter);

case FILE_CALLBACK_SAVE:
return pHost->ui_save_file(pHost->handle, isDir, title, filter);
}

return nullptr;
}

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


void touchPluginParameter(const uint id, const uint32_t parameterId, const bool touch) noexcept override void touchPluginParameter(const uint id, const uint32_t parameterId, const bool touch) noexcept override
@@ -810,23 +828,6 @@ protected:
fUiServer.flushMessages(); fUiServer.flushMessages();
} }


const char* uiFileCallback(FileCallbackOpcode action, bool isDir, const char* title, const char* filter)
{
switch (action)
{
case FILE_CALLBACK_DEBUG:
return nullptr;

case FILE_CALLBACK_OPEN:
return pHost->ui_open_file(pHost->handle, isDir, title, filter);

case FILE_CALLBACK_SAVE:
return pHost->ui_save_file(pHost->handle, isDir, title, filter);
}

return nullptr;
}

void uiServerInfo() void uiServerInfo()
{ {
CARLA_SAFE_ASSERT_RETURN(fIsRunning,); CARLA_SAFE_ASSERT_RETURN(fIsRunning,);
@@ -1395,6 +1396,9 @@ protected:


fUiServer.idlePipe(); fUiServer.idlePipe();


if (! fUiServer.isPipeRunning())
return;

char tmpBuf[STR_MAX+1]; char tmpBuf[STR_MAX+1];
carla_zeroChars(tmpBuf, STR_MAX+1); carla_zeroChars(tmpBuf, STR_MAX+1);


@@ -1655,21 +1659,6 @@ public:


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


static void _ui_server_callback(void* handle, EngineCallbackOpcode action, uint pluginId,
int value1, int value2, int value3,
float valuef, const char* valueStr)
{
handlePtr->uiServerCallback(action, pluginId, value1, value2, value3, valuef, valueStr);
}

static const char* _ui_file_callback(void* handle, FileCallbackOpcode action, bool isDir,
const char* title, const char* filter)
{
return handlePtr->uiFileCallback(action, isDir, title, filter);
}

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

#undef handlePtr #undef handlePtr


private: private:


+ 2
- 2
source/frontend/carla_host.py View File

@@ -955,7 +955,7 @@ class HostWindow(QMainWindow):
self.ui.act_canvas_show_internal.blockSignals(True) self.ui.act_canvas_show_internal.blockSignals(True)
self.ui.act_canvas_show_external.blockSignals(True) self.ui.act_canvas_show_external.blockSignals(True)


if processMode == ENGINE_PROCESS_MODE_PATCHBAY: # and not self.host.isPlugin:
if processMode == ENGINE_PROCESS_MODE_PATCHBAY and not self.host.isPlugin:
self.ui.act_canvas_show_internal.setChecked(True) self.ui.act_canvas_show_internal.setChecked(True)
self.ui.act_canvas_show_internal.setVisible(True) self.ui.act_canvas_show_internal.setVisible(True)
self.ui.act_canvas_show_external.setChecked(False) self.ui.act_canvas_show_external.setChecked(False)
@@ -966,7 +966,7 @@ class HostWindow(QMainWindow):
self.ui.act_canvas_show_internal.setVisible(False) self.ui.act_canvas_show_internal.setVisible(False)
self.ui.act_canvas_show_external.setChecked(True) self.ui.act_canvas_show_external.setChecked(True)
self.ui.act_canvas_show_external.setVisible(False) self.ui.act_canvas_show_external.setVisible(False)
self.fExternalPatchbay = True
self.fExternalPatchbay = not self.host.isPlugin


self.ui.act_canvas_show_internal.blockSignals(False) self.ui.act_canvas_show_internal.blockSignals(False)
self.ui.act_canvas_show_external.blockSignals(False) self.ui.act_canvas_show_external.blockSignals(False)


Loading…
Cancel
Save