Browse Source

More NSM jack apps work, save, load and gui; water changes...

Signed-off-by: falkTX <falktx@gmail.com>
pull/829/head
falkTX 7 years ago
parent
commit
5ca950998d
Signed by: falkTX <falktx@gmail.com> GPG Key ID: 2D3445A829213837
4 changed files with 69 additions and 2 deletions
  1. +52
    -1
      source/backend/plugin/CarlaPluginJack.cpp
  2. +1
    -1
      source/libjack/libjack.cpp
  3. +15
    -0
      source/modules/water/threads/ChildProcess.cpp
  4. +1
    -0
      source/modules/water/threads/ChildProcess.h

+ 52
- 1
source/backend/plugin/CarlaPluginJack.cpp View File

@@ -90,6 +90,33 @@ public:
return (uintptr_t)fProcess->getPID();
}

void sendTerminate() const noexcept
{
CARLA_SAFE_ASSERT_RETURN(fProcess != nullptr,);

fProcess->terminate();
}

#ifdef HAVE_LIBLO
void nsmSave()
{
if (fOscClientAddress == nullptr)
return;

lo_send_from(fOscClientAddress, fOscServer, LO_TT_IMMEDIATE, "/nsm/client/save", "");
}

void nsmShowGui(const bool yesNo)
{
if (fOscClientAddress == nullptr)
return;

lo_send_from(fOscClientAddress, fOscServer, LO_TT_IMMEDIATE,
yesNo ? "/nsm/client/show_optional_gui"
: "/nsm/client/hide_optional_gui", "");
}
#endif

protected:
#ifdef HAVE_LIBLO
static void _osc_error_handler(int num, const char* msg, const char* path)
@@ -132,7 +159,7 @@ protected:
method, message, smName, features);
}

if (std::strcmp(path, "/reply") == 0)
else if (std::strcmp(path, "/reply") == 0)
{
CARLA_SAFE_ASSERT_RETURN(std::strcmp(types, "ss") == 0, 0);

@@ -142,6 +169,20 @@ protected:
carla_stdout("Got reply of '%s' as '%s'", method, message);
}

else if (std::strcmp(path, "/nsm/client/gui_is_shown") == 0)
{
CARLA_SAFE_ASSERT_RETURN(std::strcmp(types, "") == 0, 0);

kEngine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, kPlugin->getId(), 1, 0, 0.0f, nullptr);
}

else if (std::strcmp(path, "/nsm/client/gui_is_hidden") == 0)
{
CARLA_SAFE_ASSERT_RETURN(std::strcmp(types, "") == 0, 0);

kEngine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, kPlugin->getId(), 0, 0, 0.0f, nullptr);
}

return 0;
}
#endif
@@ -362,6 +403,8 @@ public:
fShmNonRtClientControl.writeOpcode(kPluginBridgeNonRtClientQuit);
fShmNonRtClientControl.commitWrite();

fBridgeThread.sendTerminate();

if (! fTimedOut)
waitForClient("stopping", 3000);
}
@@ -441,6 +484,10 @@ public:

void prepareForSave() noexcept override
{
#ifdef HAVE_LIBLO
fBridgeThread.nsmSave();
#endif

{
const CarlaMutexLocker _cml(fShmNonRtClientControl.mutex);

@@ -517,6 +564,10 @@ public:
CARLA_SAFE_ASSERT_RETURN(restartBridgeThread(),);
}

#ifdef HAVE_LIBLO
fBridgeThread.nsmShowGui(yesNo);
#endif

const CarlaMutexLocker _cml(fShmNonRtClientControl.mutex);

fShmNonRtClientControl.writeOpcode(yesNo ? kPluginBridgeNonRtClientShowUI : kPluginBridgeNonRtClientHideUI);


+ 1
- 1
source/libjack/libjack.cpp View File

@@ -943,7 +943,7 @@ bool CarlaJackAppClient::handleNonRtData()

case kPluginBridgeNonRtClientPrepareForSave:
{
if (fSessionManager == 1) // auto
if (fSessionManager == 1 && std::getenv("NSM_URL") == nullptr) // auto
{
struct sigaction sig;
carla_zeroStruct(sig);


+ 15
- 0
source/modules/water/threads/ChildProcess.cpp View File

@@ -125,6 +125,11 @@ public:
return TerminateProcess (processInfo.hProcess, 0) != FALSE;
}
bool terminateProcess() const noexcept
{
return TerminateProcess (processInfo.hProcess, 0) != FALSE;
}
uint32 getExitCode() const noexcept
{
DWORD exitCode = 0;
@@ -238,6 +243,11 @@ public:
return ::kill (childPID, SIGKILL) == 0;
}
bool terminateProcess() const noexcept
{
return ::kill (childPID, SIGTERM) == 0;
}
uint32 getExitCode() const noexcept
{
if (childPID != 0)
@@ -287,6 +297,11 @@ bool ChildProcess::kill()
return activeProcess == nullptr || activeProcess->killProcess();
}
bool ChildProcess::terminate()
{
return activeProcess == nullptr || activeProcess->terminateProcess();
}
uint32 ChildProcess::getExitCode() const
{
return activeProcess != nullptr ? activeProcess->getExitCode() : 0;


+ 1
- 0
source/modules/water/threads/ChildProcess.h View File

@@ -107,6 +107,7 @@ public:
result in undefined behaviour.
*/
bool kill();
bool terminate();
uint32 getPID() const noexcept;


Loading…
Cancel
Save