@@ -114,13 +114,6 @@ public: | |||||
return (uintptr_t)fProcess->getPID(); | return (uintptr_t)fProcess->getPID(); | ||||
} | } | ||||
void sendTerminate() const noexcept | |||||
{ | |||||
CARLA_SAFE_ASSERT_RETURN(fProcess != nullptr,); | |||||
fProcess->terminate(); | |||||
} | |||||
#ifdef HAVE_LIBLO | #ifdef HAVE_LIBLO | ||||
void nsmSave(const char* const setupLabel) | void nsmSave(const char* const setupLabel) | ||||
{ | { | ||||
@@ -487,8 +480,6 @@ public: | |||||
fShmNonRtClientControl.writeOpcode(kPluginBridgeNonRtClientQuit); | fShmNonRtClientControl.writeOpcode(kPluginBridgeNonRtClientQuit); | ||||
fShmNonRtClientControl.commitWrite(); | fShmNonRtClientControl.commitWrite(); | ||||
fBridgeThread.sendTerminate(); | |||||
if (! fTimedOut) | if (! fTimedOut) | ||||
waitForClient("stopping", 3000); | waitForClient("stopping", 3000); | ||||
} | } | ||||
@@ -96,8 +96,8 @@ struct JackMidiPortBuffer { | |||||
}; | }; | ||||
struct JackPortState { | struct JackPortState { | ||||
char* name; | |||||
char* fullname; | |||||
const char* name; | |||||
const char* fullname; | |||||
void* buffer; | void* buffer; | ||||
uint index; | uint index; | ||||
uint flags; | uint flags; | ||||
@@ -144,8 +144,6 @@ struct JackPortState { | |||||
~JackPortState() | ~JackPortState() | ||||
{ | { | ||||
std::free(name); | |||||
std::free(fullname); | |||||
} | } | ||||
CARLA_DECLARE_NON_COPY_STRUCT(JackPortState) | CARLA_DECLARE_NON_COPY_STRUCT(JackPortState) | ||||
@@ -120,17 +120,19 @@ jack_port_t* jack_port_by_name(jack_client_t* client, const char* name) | |||||
/* isSystem */ true, | /* isSystem */ true, | ||||
/* isConnected */ false | /* isConnected */ false | ||||
); | ); | ||||
static CarlaString rname, rfullname; | |||||
const JackServerState& jserver(jclient->server); | const JackServerState& jserver(jclient->server); | ||||
const int commonFlags = JackPortIsPhysical|JackPortIsTerminal; | const int commonFlags = JackPortIsPhysical|JackPortIsTerminal; | ||||
std::free(retPort.fullname); | |||||
retPort.fullname = strdup(name); | |||||
rfullname = name; | |||||
name += 7; | name += 7; | ||||
std::free(retPort.name); | |||||
retPort.name = strdup(name); | |||||
rname = name; | |||||
retPort.name = rname.buffer(); | |||||
retPort.fullname = rfullname.buffer(); | |||||
/**/ if (std::strncmp(name, "capture_", 8) == 0) | /**/ if (std::strncmp(name, "capture_", 8) == 0) | ||||
{ | { | ||||
@@ -161,7 +163,7 @@ jack_port_t* jack_port_by_name(jack_client_t* client, const char* name) | |||||
name += 13; | name += 13; | ||||
const int index = std::atoi(name)-1; | const int index = std::atoi(name)-1; | ||||
CARLA_SAFE_ASSERT_RETURN(index >= 0 && index < jserver.numAudioIns, nullptr); | |||||
CARLA_SAFE_ASSERT_RETURN(index >= 0 && index < jserver.numMidiIns, nullptr); | |||||
retPort.index = index; | retPort.index = index; | ||||
retPort.flags = commonFlags|JackPortIsOutput; | retPort.flags = commonFlags|JackPortIsOutput; | ||||
@@ -173,7 +175,7 @@ jack_port_t* jack_port_by_name(jack_client_t* client, const char* name) | |||||
name += 14; | name += 14; | ||||
const int index = std::atoi(name)-1; | const int index = std::atoi(name)-1; | ||||
CARLA_SAFE_ASSERT_RETURN(index >= 0 && index < jserver.numAudioOuts, nullptr); | |||||
CARLA_SAFE_ASSERT_RETURN(index >= 0 && index < jserver.numMidiOuts, nullptr); | |||||
retPort.index = (jserver.numAudioIns) + index; | retPort.index = (jserver.numAudioIns) + index; | ||||
retPort.flags = commonFlags|JackPortIsInput; | retPort.flags = commonFlags|JackPortIsInput; | ||||
@@ -344,22 +344,23 @@ int jack_port_rename(jack_client_t* client, jack_port_t *port, const char *port_ | |||||
CARLA_SAFE_ASSERT_RETURN(jport != nullptr, EINVAL); | CARLA_SAFE_ASSERT_RETURN(jport != nullptr, EINVAL); | ||||
CARLA_SAFE_ASSERT_RETURN(! jport->isSystem, EINVAL); | CARLA_SAFE_ASSERT_RETURN(! jport->isSystem, EINVAL); | ||||
static CarlaString rname, rfullname; | |||||
// TODO: verify uniqueness | // TODO: verify uniqueness | ||||
char* const name = strdup(port_name); | |||||
CARLA_SAFE_ASSERT_RETURN(name != nullptr, ENOMEM); | |||||
rname = port_name; | |||||
CARLA_SAFE_ASSERT_RETURN(rname.isNotEmpty(), ENOMEM); | |||||
char* const fullname = (char*)std::malloc(STR_MAX); | char* const fullname = (char*)std::malloc(STR_MAX); | ||||
CARLA_SAFE_ASSERT_RETURN(name != nullptr, ENOMEM); | |||||
std::free(jport->name); | |||||
jport->name = strdup(port_name); | |||||
CARLA_SAFE_ASSERT_RETURN(fullname != nullptr, ENOMEM); | |||||
std::snprintf(fullname, STR_MAX, "%s:%s", jclient->name, port_name); | std::snprintf(fullname, STR_MAX, "%s:%s", jclient->name, port_name); | ||||
fullname[STR_MAX-1] = '\0'; | fullname[STR_MAX-1] = '\0'; | ||||
std::free(jport->fullname); | |||||
jport->fullname = fullname; | |||||
jport->name = rname.buffer(); | |||||
jport->fullname = rfullname.buffer(); | |||||
std::free(fullname); | |||||
// TODO: port rename callback | // TODO: port rename callback | ||||