Browse Source

Small fixes to libjack

Signed-off-by: falkTX <falktx@gmail.com>
tags/v2.1-alpha2
falkTX 5 years ago
parent
commit
59955b16aa
Signed by: falkTX <falktx@gmail.com> GPG Key ID: 2D3445A829213837
4 changed files with 19 additions and 27 deletions
  1. +0
    -9
      source/backend/plugin/CarlaPluginJack.cpp
  2. +2
    -4
      source/libjack/libjack.hpp
  3. +8
    -6
      source/libjack/libjack_port-searching.cpp
  4. +9
    -8
      source/libjack/libjack_ports.cpp

+ 0
- 9
source/backend/plugin/CarlaPluginJack.cpp View File

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

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

fProcess->terminate();
}

#ifdef HAVE_LIBLO
void nsmSave(const char* const setupLabel)
{
@@ -487,8 +480,6 @@ public:
fShmNonRtClientControl.writeOpcode(kPluginBridgeNonRtClientQuit);
fShmNonRtClientControl.commitWrite();

fBridgeThread.sendTerminate();

if (! fTimedOut)
waitForClient("stopping", 3000);
}


+ 2
- 4
source/libjack/libjack.hpp View File

@@ -96,8 +96,8 @@ struct JackMidiPortBuffer {
};

struct JackPortState {
char* name;
char* fullname;
const char* name;
const char* fullname;
void* buffer;
uint index;
uint flags;
@@ -144,8 +144,6 @@ struct JackPortState {

~JackPortState()
{
std::free(name);
std::free(fullname);
}

CARLA_DECLARE_NON_COPY_STRUCT(JackPortState)


+ 8
- 6
source/libjack/libjack_port-searching.cpp View File

@@ -120,17 +120,19 @@ jack_port_t* jack_port_by_name(jack_client_t* client, const char* name)
/* isSystem */ true,
/* isConnected */ false
);
static CarlaString rname, rfullname;

const JackServerState& jserver(jclient->server);
const int commonFlags = JackPortIsPhysical|JackPortIsTerminal;

std::free(retPort.fullname);
retPort.fullname = strdup(name);
rfullname = name;

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)
{
@@ -161,7 +163,7 @@ jack_port_t* jack_port_by_name(jack_client_t* client, const char* name)
name += 13;

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.flags = commonFlags|JackPortIsOutput;
@@ -173,7 +175,7 @@ jack_port_t* jack_port_by_name(jack_client_t* client, const char* name)
name += 14;

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.flags = commonFlags|JackPortIsInput;


+ 9
- 8
source/libjack/libjack_ports.cpp View File

@@ -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->isSystem, EINVAL);

static CarlaString rname, rfullname;

// 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);
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);
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



Loading…
Cancel
Save