|
|
@@ -23,10 +23,10 @@ namespace CB = CarlaBackend; |
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------------------------- |
|
|
|
|
|
|
|
class CarlaPipeClientPlugin : public CarlaPipeClient |
|
|
|
class ExposedCarlaPipeClient : public CarlaPipeClient |
|
|
|
{ |
|
|
|
public: |
|
|
|
CarlaPipeClientPlugin(const CarlaPipeCallbackFunc callbackFunc, void* const callbackPtr) noexcept |
|
|
|
ExposedCarlaPipeClient(const CarlaPipeCallbackFunc callbackFunc, void* const callbackPtr) noexcept |
|
|
|
: CarlaPipeClient(), |
|
|
|
fCallbackFunc(callbackFunc), |
|
|
|
fCallbackPtr(callbackPtr), |
|
|
@@ -35,7 +35,7 @@ public: |
|
|
|
CARLA_SAFE_ASSERT(fCallbackFunc != nullptr); |
|
|
|
} |
|
|
|
|
|
|
|
~CarlaPipeClientPlugin() override |
|
|
|
~ExposedCarlaPipeClient() override |
|
|
|
{ |
|
|
|
if (fLastReadLine != nullptr) |
|
|
|
{ |
|
|
@@ -68,14 +68,14 @@ private: |
|
|
|
void* const fCallbackPtr; |
|
|
|
const char* fLastReadLine; |
|
|
|
|
|
|
|
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaPipeClientPlugin) |
|
|
|
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ExposedCarlaPipeClient) |
|
|
|
}; |
|
|
|
|
|
|
|
CarlaPipeClientHandle carla_pipe_client_new(const char* argv[], CarlaPipeCallbackFunc callbackFunc, void* callbackPtr) |
|
|
|
{ |
|
|
|
carla_debug("carla_pipe_client_new(%p, %p, %p)", argv, callbackFunc, callbackPtr); |
|
|
|
|
|
|
|
CarlaPipeClientPlugin* const pipe(new CarlaPipeClientPlugin(callbackFunc, callbackPtr)); |
|
|
|
ExposedCarlaPipeClient* const pipe = new ExposedCarlaPipeClient(callbackFunc, callbackPtr); |
|
|
|
|
|
|
|
if (! pipe->initPipeClient(argv)) |
|
|
|
{ |
|
|
@@ -90,64 +90,57 @@ void carla_pipe_client_idle(CarlaPipeClientHandle handle) |
|
|
|
{ |
|
|
|
CARLA_SAFE_ASSERT_RETURN(handle != nullptr,); |
|
|
|
|
|
|
|
((CarlaPipeClientPlugin*)handle)->idlePipe(); |
|
|
|
((ExposedCarlaPipeClient*)handle)->idlePipe(); |
|
|
|
} |
|
|
|
|
|
|
|
bool carla_pipe_client_is_running(CarlaPipeClientHandle handle) |
|
|
|
{ |
|
|
|
CARLA_SAFE_ASSERT_RETURN(handle != nullptr, false); |
|
|
|
|
|
|
|
return ((CarlaPipeClientPlugin*)handle)->isPipeRunning(); |
|
|
|
return ((ExposedCarlaPipeClient*)handle)->isPipeRunning(); |
|
|
|
} |
|
|
|
|
|
|
|
void carla_pipe_client_lock(CarlaPipeClientHandle handle) |
|
|
|
{ |
|
|
|
CARLA_SAFE_ASSERT_RETURN(handle != nullptr,); |
|
|
|
|
|
|
|
return ((CarlaPipeClientPlugin*)handle)->lockPipe(); |
|
|
|
} |
|
|
|
|
|
|
|
void carla_pipe_client_unlock(CarlaPipeClientHandle handle) |
|
|
|
{ |
|
|
|
CARLA_SAFE_ASSERT_RETURN(handle != nullptr,); |
|
|
|
|
|
|
|
return ((CarlaPipeClientPlugin*)handle)->unlockPipe(); |
|
|
|
return ((ExposedCarlaPipeClient*)handle)->lockPipe(); |
|
|
|
} |
|
|
|
|
|
|
|
const char* carla_pipe_client_readlineblock(CarlaPipeClientHandle handle, uint timeout) |
|
|
|
{ |
|
|
|
CARLA_SAFE_ASSERT_RETURN(handle != nullptr, nullptr); |
|
|
|
|
|
|
|
return ((CarlaPipeClientPlugin*)handle)->readlineblock(timeout); |
|
|
|
return ((ExposedCarlaPipeClient*)handle)->readlineblock(timeout); |
|
|
|
} |
|
|
|
|
|
|
|
bool carla_pipe_client_write_msg(CarlaPipeClientHandle handle, const char* msg) |
|
|
|
{ |
|
|
|
CARLA_SAFE_ASSERT_RETURN(handle != nullptr, false); |
|
|
|
|
|
|
|
return ((CarlaPipeClientPlugin*)handle)->writeMessage(msg); |
|
|
|
return ((ExposedCarlaPipeClient*)handle)->writeMessage(msg); |
|
|
|
} |
|
|
|
|
|
|
|
bool carla_pipe_client_write_and_fix_msg(CarlaPipeClientHandle handle, const char* msg) |
|
|
|
{ |
|
|
|
CARLA_SAFE_ASSERT_RETURN(handle != nullptr, false); |
|
|
|
|
|
|
|
return ((CarlaPipeClientPlugin*)handle)->writeAndFixMessage(msg); |
|
|
|
return ((ExposedCarlaPipeClient*)handle)->writeAndFixMessage(msg); |
|
|
|
} |
|
|
|
|
|
|
|
bool carla_pipe_client_flush(CarlaPipeClientHandle handle) |
|
|
|
{ |
|
|
|
CARLA_SAFE_ASSERT_RETURN(handle != nullptr, false); |
|
|
|
|
|
|
|
return ((CarlaPipeClientPlugin*)handle)->flushMessages(); |
|
|
|
return ((ExposedCarlaPipeClient*)handle)->flushMessages(); |
|
|
|
} |
|
|
|
|
|
|
|
bool carla_pipe_client_flush_and_unlock(CarlaPipeClientHandle handle) |
|
|
|
{ |
|
|
|
CARLA_SAFE_ASSERT_RETURN(handle != nullptr, false); |
|
|
|
|
|
|
|
CarlaPipeClientPlugin* const pipe((CarlaPipeClientPlugin*)handle); |
|
|
|
const bool ret(pipe->flushMessages()); |
|
|
|
ExposedCarlaPipeClient* const pipe = (ExposedCarlaPipeClient*)handle; |
|
|
|
const bool ret = pipe->flushMessages(); |
|
|
|
pipe->unlockPipe(); |
|
|
|
return ret; |
|
|
|
} |
|
|
@@ -157,7 +150,7 @@ void carla_pipe_client_destroy(CarlaPipeClientHandle handle) |
|
|
|
CARLA_SAFE_ASSERT_RETURN(handle != nullptr,); |
|
|
|
carla_debug("carla_pipe_client_destroy(%p)", handle); |
|
|
|
|
|
|
|
CarlaPipeClientPlugin* const pipe((CarlaPipeClientPlugin*)handle); |
|
|
|
ExposedCarlaPipeClient* const pipe = (ExposedCarlaPipeClient*)handle; |
|
|
|
pipe->closePipeClient(); |
|
|
|
delete pipe; |
|
|
|
} |
|
|
|