@@ -720,8 +720,11 @@ public: | |||||
carla_zeroStruct<jack_position_t>(fTransportPos); | carla_zeroStruct<jack_position_t>(fTransportPos); | ||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
fIsRunning = true; | |||||
if (! pData->init(clientName)) | if (! pData->init(clientName)) | ||||
{ | { | ||||
close(); | |||||
setLastError("Failed to init internal data"); | setLastError("Failed to init internal data"); | ||||
return false; | return false; | ||||
} | } | ||||
@@ -738,13 +741,12 @@ public: | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
carla_stderr2("Failed to init temporary jack client"); | |||||
close(); | |||||
setLastError("Failed to init temporary jack client"); | |||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
fIsRunning = true; | |||||
return true; | return true; | ||||
#else | #else | ||||
fClient = jackbridge_client_open(clientName, JackNullOption, nullptr); | fClient = jackbridge_client_open(clientName, JackNullOption, nullptr); | ||||
@@ -831,11 +833,13 @@ public: | |||||
carla_debug("CarlaEngineJack::close()"); | carla_debug("CarlaEngineJack::close()"); | ||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
CarlaEngine::close(); | |||||
fClient = nullptr; | fClient = nullptr; | ||||
fIsRunning = false; | fIsRunning = false; | ||||
CarlaEngine::close(); | |||||
return true; | return true; | ||||
#else | #else | ||||
CARLA_SAFE_ASSERT_RETURN_ERR(fClient != nullptr, "JACK Client is null"); | |||||
// deactivate first | // deactivate first | ||||
const bool deactivated(jackbridge_deactivate(fClient)); | const bool deactivated(jackbridge_deactivate(fClient)); | ||||
@@ -240,7 +240,7 @@ public: | |||||
bool isRunning() const noexcept override | bool isRunning() const noexcept override | ||||
{ | { | ||||
return fDevice != nullptr && fDevice->isPlaying(); | |||||
return fDevice != nullptr && fDevice->isOpen(); | |||||
} | } | ||||
bool isOffline() const noexcept override | bool isOffline() const noexcept override | ||||
@@ -646,6 +646,8 @@ protected: | |||||
{ | { | ||||
carla_debug("CarlaEngineNative::init(\"%s\")", clientName); | carla_debug("CarlaEngineNative::init(\"%s\")", clientName); | ||||
fIsRunning = true; | |||||
if (! pData->init(clientName)) | if (! pData->init(clientName)) | ||||
{ | { | ||||
close(); | close(); | ||||
@@ -656,7 +658,13 @@ protected: | |||||
pData->bufferSize = pHost->get_buffer_size(pHost->handle); | pData->bufferSize = pHost->get_buffer_size(pHost->handle); | ||||
pData->sampleRate = pHost->get_sample_rate(pHost->handle); | pData->sampleRate = pHost->get_sample_rate(pHost->handle); | ||||
fIsRunning = true; | |||||
return true; | |||||
} | |||||
bool close() override | |||||
{ | |||||
fIsRunning = false; | |||||
CarlaEngine::close(); | |||||
return true; | return true; | ||||
} | } | ||||
@@ -365,7 +365,7 @@ public: | |||||
bool isRunning() const noexcept override | bool isRunning() const noexcept override | ||||
{ | { | ||||
return fAudio.isStreamRunning(); | |||||
return fAudio.isStreamOpen(); | |||||
} | } | ||||
bool isOffline() const noexcept override | bool isOffline() const noexcept override | ||||