Browse Source

Carla: Small cleanup

tags/v0.9.0
falkTX 12 years ago
parent
commit
8b1c3c779d
9 changed files with 209 additions and 159 deletions
  1. +1
    -1
      c++/carla-engine/jack.cpp
  2. +29
    -21
      c++/carla-plugin/dssi.cpp
  3. +64
    -53
      c++/carla-plugin/fluidsynth.cpp
  4. +1
    -2
      c++/carla-plugin/ladspa.cpp
  5. +52
    -36
      c++/carla-plugin/linuxsampler.cpp
  6. +23
    -17
      c++/carla-plugin/lv2.cpp
  7. +0
    -8
      c++/carla-plugin/native.cpp
  8. +39
    -20
      c++/carla-plugin/vst.cpp
  9. +0
    -1
      doc/Carla-TODO

+ 1
- 1
c++/carla-engine/jack.cpp View File

@@ -495,7 +495,7 @@ public:
#ifndef BUILD_BRIDGE
if (options.processMode == PROCESS_MODE_SINGLE_CLIENT || options.processMode == PROCESS_MODE_MULTIPLE_CLIENTS)
#endif
return jackbridge_client_name_size();
return jackbridge_client_name_size() - 3; // reserve space for "_2" forced-stereo ports

return CarlaEngine::maxClientNameSize();
}


+ 29
- 21
c++/carla-plugin/dssi.cpp View File

@@ -414,11 +414,12 @@ public:
paramBuffers = new float[params];
}

const int portNameSize = x_engine->maxPortNameSize() - 2;
char portName[portNameSize];
bool needsCtrlIn = false;
bool needsCtrlOut = false;

const int portNameSize = x_engine->maxPortNameSize();
CarlaString portName;

for (unsigned long i=0; i < portCount; i++)
{
const LADSPA_PortDescriptor portType = ldescriptor->PortDescriptors[i];
@@ -426,16 +427,17 @@ public:

if (LADSPA_IS_PORT_AUDIO(portType))
{
portName.clear();

#ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":");
strncat(portName, ldescriptor->PortNames[i], portNameSize/2);
portName = m_name;
portName += ":";
}
else
#endif
strncpy(portName, ldescriptor->PortNames[i], portNameSize);
portName += ldescriptor->PortNames[i];
portName.truncate(portNameSize);

if (LADSPA_IS_PORT_INPUT(portType))
{
@@ -445,7 +447,7 @@ public:

if (forcedStereoIn)
{
strcat(portName, "_");
portName += "_2";
aIn.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, true);
aIn.rindexes[1] = i;
}
@@ -459,7 +461,7 @@ public:

if (forcedStereoOut)
{
strcat(portName, "_");
portName += "_2";
aOut.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false);
aOut.rindexes[1] = i;
}
@@ -624,45 +626,51 @@ public:

if (needsCtrlIn)
{
portName.clear();

#ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":control-in");
portName = m_name;
portName += ":";
}
else
#endif
strcpy(portName, "control-in");
portName += "control-in";
portName.truncate(portNameSize);

param.portCin = (CarlaEngineControlPort*)x_client->addPort(CarlaEnginePortTypeControl, portName, true);
}

if (needsCtrlOut)
{
portName.clear();

#ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":control-out");
portName = m_name;
portName += ":";
}
else
#endif
strcpy(portName, "control-out");
portName += "control-out";
portName.truncate(portNameSize);

param.portCout = (CarlaEngineControlPort*)x_client->addPort(CarlaEnginePortTypeControl, portName, false);
}

if (mIns == 1)
{
portName.clear();

#ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":midi-in");
portName = m_name;
portName += ":";
}
else
#endif
strcpy(portName, "midi-in");
portName += "midi-in";
portName.truncate(portNameSize);

midi.portMin = (CarlaEngineMidiPort*)x_client->addPort(CarlaEnginePortTypeMIDI, portName, true);
}


+ 64
- 53
c++/carla-plugin/fluidsynth.cpp View File

@@ -414,79 +414,94 @@ public:
param.data = new ParameterData[params];
param.ranges = new ParameterRanges[params];

const int portNameSize = x_engine->maxPortNameSize() - 1;
char portName[portNameSize];
const int portNameSize = x_engine->maxPortNameSize();
CarlaString portName;

// ---------------------------------------
// Audio Outputs

#ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":out-left");
}
else
#endif
strcpy(portName, "out-left");
portName.clear();

aOut.ports[0] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false);
aOut.rindexes[0] = 0;
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
portName = m_name;
portName += ":";
}

#ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":out-right");
portName += "out-left";
portName.truncate(portNameSize);
aOut.ports[0] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false);
aOut.rindexes[0] = 0;
}
else
#endif
strcpy(portName, "out-right");

aOut.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false);
aOut.rindexes[1] = 1;
{
portName.clear();

if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
portName = m_name;
portName += ":";
}

portName += "out-right";
portName.truncate(portNameSize);

aOut.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false);
aOut.rindexes[1] = 1;
}

// ---------------------------------------
// MIDI Input

#ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":midi-in");
}
else
#endif
strcpy(portName, "midi-in");
portName.clear();

if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
portName = m_name;
portName += ":";
}

portName += "midi-in";
portName.truncate(portNameSize);

midi.portMin = (CarlaEngineMidiPort*)x_client->addPort(CarlaEnginePortTypeMIDI, portName, true);
midi.portMin = (CarlaEngineMidiPort*)x_client->addPort(CarlaEnginePortTypeMIDI, portName, true);
}

// ---------------------------------------
// Parameters

#ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":control-in");
}
else
#endif
strcpy(portName, "control-in");
portName.clear();

param.portCin = (CarlaEngineControlPort*)x_client->addPort(CarlaEnginePortTypeControl, portName, true);
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
portName = m_name;
portName += ":";
}

#ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":control-out");
portName += "control-in";
portName.truncate(portNameSize);

param.portCin = (CarlaEngineControlPort*)x_client->addPort(CarlaEnginePortTypeControl, portName, true);
}
else
#endif
strcpy(portName, "control-out");

param.portCout = (CarlaEngineControlPort*)x_client->addPort(CarlaEnginePortTypeControl, portName, false);
{
portName.clear();

if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
portName = m_name;
portName += ":";
}

portName += "control-out";
portName.truncate(portNameSize);

param.portCout = (CarlaEngineControlPort*)x_client->addPort(CarlaEnginePortTypeControl, portName, false);
}

// ----------------------
j = FluidSynthReverbOnOff;
@@ -784,7 +799,6 @@ public:

//f_sfont->free(f_sfont);

#ifndef BUILD_BRIDGE
// Update OSC Names
if (x_engine->isOscControlRegisted())
{
@@ -793,7 +807,6 @@ public:
for (i=0; i < midiprog.count; i++)
x_engine->osc_send_control_set_midi_program_data(m_id, i, midiprog.data[i].bank, midiprog.data[i].program, midiprog.data[i].name);
}
#endif

if (init)
{
@@ -1184,9 +1197,7 @@ public:
fluid_synth_set_gain(f_synth, x_volume);

// Output VU
#ifndef BUILD_BRIDGE
if (x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK)
#endif
{
for (k=0; i < 2 && k < frames; k++)
{


+ 1
- 2
c++/carla-plugin/ladspa.cpp View File

@@ -415,7 +415,7 @@ public:
bool needsCtrlIn = false;
bool needsCtrlOut = false;

const int portNameSize = x_engine->maxPortNameSize() - 3;
const int portNameSize = x_engine->maxPortNameSize();
CarlaString portName;

for (unsigned long i=0; i < portCount; i++)
@@ -435,7 +435,6 @@ public:
portName += ":";
}
#endif

portName += descriptor->PortNames[i];
portName.truncate(portNameSize);



+ 52
- 36
c++/carla-plugin/linuxsampler.cpp View File

@@ -282,59 +282,79 @@ public:
aOut.ports = new CarlaEngineAudioPort*[aOuts];
aOut.rindexes = new uint32_t[aOuts];

const int portNameSize = x_engine->maxPortNameSize() - 1;
char portName[portNameSize];
const int portNameSize = x_engine->maxPortNameSize();
CarlaString portName;

// ---------------------------------------
// Audio Outputs

if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":out-left");
}
else
strcpy(portName, "out-left");
portName.clear();

if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
portName = m_name;
portName += ":";
}

aOut.ports[0] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false);
aOut.rindexes[0] = 0;
portName += "out-left";
portName.truncate(portNameSize);

if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":out-right");
aOut.ports[0] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false);
aOut.rindexes[0] = 0;
}
else
strcpy(portName, "out-right");

aOut.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false);
aOut.rindexes[1] = 1;
{
portName.clear();

if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
portName = m_name;
portName += ":";
}

portName += "out-right";
portName.truncate(portNameSize);

aOut.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false);
aOut.rindexes[1] = 1;
}

// ---------------------------------------
// Control Input

if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":control-in");
}
else
strcpy(portName, "control-in");
portName.clear();

if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
portName = m_name;
portName += ":";
}

param.portCin = (CarlaEngineControlPort*)x_client->addPort(CarlaEnginePortTypeControl, portName, true);
portName += "control-in";
portName.truncate(portNameSize);

param.portCin = (CarlaEngineControlPort*)x_client->addPort(CarlaEnginePortTypeControl, portName, true);
}

// ---------------------------------------
// MIDI Input

if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":midi-in");
}
else
strcpy(portName, "midi-in");
portName.clear();

midi.portMin = (CarlaEngineMidiPort*)x_client->addPort(CarlaEnginePortTypeMIDI, portName, true);
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
portName = m_name;
portName += ":";
}

portName += "midi-in";
portName.truncate(portNameSize);

midi.portMin = (CarlaEngineMidiPort*)x_client->addPort(CarlaEnginePortTypeMIDI, portName, true);
}

// ---------------------------------------

@@ -392,7 +412,6 @@ public:
midiprog.data[i].name = strdup(info.InstrumentName.c_str());
}

#ifndef BUILD_BRIDGE
// Update OSC Names
if (x_engine->isOscControlRegisted())
{
@@ -401,7 +420,6 @@ public:
for (i=0; i < midiprog.count; i++)
x_engine->osc_send_control_set_midi_program_data(m_id, i, midiprog.data[i].bank, midiprog.data[i].program, midiprog.data[i].name);
}
#endif

if (init)
{
@@ -778,9 +796,7 @@ public:
}

// Output VU
#ifndef BUILD_BRIDGE
if (x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK)
#endif
{
for (k=0; i < 2 && k < frames; k++)
{


+ 23
- 17
c++/carla-plugin/lv2.cpp View File

@@ -1327,27 +1327,29 @@ public:
paramBuffers = new float[params];
}

const int portNameSize = x_engine->maxPortNameSize() - 2;
char portName[portNameSize];
bool needsCtrlIn = false;
bool needsCtrlOut = false;

const int portNameSize = x_engine->maxPortNameSize();
CarlaString portName;

for (uint32_t i=0; i < portCount; i++)
{
const LV2_Property portType = rdf_descriptor->Ports[i].Type;

if (LV2_IS_PORT_AUDIO(portType) || LV2_IS_PORT_ATOM_SEQUENCE(portType) || LV2_IS_PORT_CV(portType) || LV2_IS_PORT_EVENT(portType) || LV2_IS_PORT_MIDI_LL(portType))
{
portName.clear();

#ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":");
strncat(portName, rdf_descriptor->Ports[i].Name, portNameSize/2);
portName = m_name;
portName += ":";
}
else
#endif
strncpy(portName, rdf_descriptor->Ports[i].Name, portNameSize);
portName += rdf_descriptor->Ports[i].Name;
portName.truncate(portNameSize);
}

if (LV2_IS_PORT_AUDIO(portType))
@@ -1360,7 +1362,7 @@ public:

if (forcedStereoIn)
{
strcat(portName, "_");
portName += "_2";
aIn.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, true);
aIn.rindexes[1] = i;
}
@@ -1374,7 +1376,7 @@ public:

if (forcedStereoOut)
{
strcat(portName, "_");
portName += "_2";
aOut.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false);
aOut.rindexes[1] = i;
}
@@ -1720,30 +1722,34 @@ public:

if (needsCtrlIn)
{
portName.clear();

#ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":control-in");
portName = m_name;
portName += ":";
}
else
#endif
strcpy(portName, "control-in");
portName += "control-in";
portName.truncate(portNameSize);

param.portCin = (CarlaEngineControlPort*)x_client->addPort(CarlaEnginePortTypeControl, portName, true);
}

if (needsCtrlOut)
{
portName.clear();

#ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":control-out");
portName = m_name;
portName += ":";
}
else
#endif
strcpy(portName, "control-out");
portName += "control-out";
portName.truncate(portNameSize);

param.portCout = (CarlaEngineControlPort*)x_client->addPort(CarlaEnginePortTypeControl, portName, false);
}


+ 0
- 8
c++/carla-plugin/native.cpp View File

@@ -755,7 +755,6 @@ public:
midiprog.data[i].name = strdup(mpDesc->name);
}

#ifndef BUILD_BRIDGE
// Update OSC Names
if (x_engine->isOscControlRegisted())
{
@@ -764,7 +763,6 @@ public:
for (i=0; i < midiprog.count; i++)
x_engine->osc_send_control_set_midi_program_data(m_id, i, midiprog.data[i].bank, midiprog.data[i].program, midiprog.data[i].name);
}
#endif

if (init)
{
@@ -827,11 +825,7 @@ public:
// --------------------------------------------------------------------------------------------------------
// Input VU

#ifndef BUILD_BRIDGE
if (aIn.count > 0 && x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK)
#else
if (aIn.count > 0)
#endif
{
if (aIn.count == 1)
{
@@ -1276,9 +1270,7 @@ public:
}

// Output VU
#ifndef BUILD_BRIDGE
if (x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK)
#endif
{
for (k=0; i < 2 && k < frames; k++)
{


+ 39
- 20
c++/carla-plugin/vst.cpp View File

@@ -516,19 +516,26 @@ public:
param.ranges = new ParameterRanges[params];
}

const int portNameSize = x_engine->maxPortNameSize() - 1;
char portName[portNameSize];
bool needsCtrlIn = (aOuts > 0 || params > 0);

const int portNameSize = x_engine->maxPortNameSize();
CarlaString portName;

// Audio Ins
for (j=0; j < aIns; j++)
{
portName.clear();

#ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
sprintf(portName, "%s:input_%02i", m_name, j+1);
else
{
portName = m_name;
portName += ":";
}
#endif
sprintf(portName, "input_%02i", j+1);
char tmp[12] = { 0 };
sprintf(tmp, "input_%02i", j+1);
portName += tmp;

aIn.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, true);
aIn.rindexes[j] = j;
@@ -537,12 +544,18 @@ public:
// Audio Outs
for (j=0; j < aOuts; j++)
{
portName.clear();

#ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
sprintf(portName, "%s:output_%02i", m_name, j+1);
else
{
portName = m_name;
portName += ":";
}
#endif
sprintf(portName, "output_%02i", j+1);
char tmp[12] = { 0 };
sprintf(tmp, "output_%02i", j+1);
portName += tmp;

aOut.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false);
aOut.rindexes[j] = j;
@@ -665,45 +678,51 @@ public:

if (needsCtrlIn)
{
portName.clear();

#ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":control-in");
portName = m_name;
portName += ":";
}
else
#endif
strcpy(portName, "control-in");
portName += "control-in";
portName.truncate(portNameSize);

param.portCin = (CarlaEngineControlPort*)x_client->addPort(CarlaEnginePortTypeControl, portName, true);
}

if (mIns == 1)
{
portName.clear();

#ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":midi-in");
portName = m_name;
portName += ":";
}
else
#endif
strcpy(portName, "midi-in");
portName += "midi-in";
portName.truncate(portNameSize);

midi.portMin = (CarlaEngineMidiPort*)x_client->addPort(CarlaEnginePortTypeMIDI, portName, true);
}

if (mOuts == 1)
{
portName.clear();

#ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
{
strcpy(portName, m_name);
strcat(portName, ":midi-out");
portName = m_name;
portName += ":";
}
else
#endif
strcpy(portName, "midi-out");
portName += "midi-out";
portName.truncate(portNameSize);

midi.portMout = (CarlaEngineMidiPort*)x_client->addPort(CarlaEnginePortTypeMIDI, portName, false);
}


+ 0
- 1
doc/Carla-TODO View File

@@ -1,7 +1,6 @@
# Carla TODO

CODE CLEANUP:
- Use CarlaString in portNameSize stuff
- Create PluginGUI class in C++ code, remove python one (need to handle parent somehow)

GENERAL:


Loading…
Cancel
Save