@@ -931,7 +931,9 @@ void CarlaPlugin::setOption(const uint option, const bool yesNo) | |||
else | |||
pData->options &= ~option; | |||
#ifndef BUILD_BRIDGE | |||
pData->saveSetting(option, yesNo); | |||
#endif | |||
} | |||
void CarlaPlugin::setEnabled(const bool yesNo) noexcept | |||
@@ -473,11 +473,13 @@ CarlaPlugin::ProtectedData::ProtectedData(CarlaEngine* const eng, const uint idx | |||
extraHints(0x0), | |||
transientTryCounter(0), | |||
latency(0), | |||
#ifndef BUILD_BRIDGE | |||
latencyBuffers(nullptr), | |||
#endif | |||
name(nullptr), | |||
filename(nullptr), | |||
#ifndef BUILD_BRIDGE | |||
iconName(nullptr), | |||
#ifndef BUILD_BRIDGE | |||
identifier(nullptr), | |||
#endif | |||
osc(eng, plug) {} | |||
@@ -522,13 +524,13 @@ CarlaPlugin::ProtectedData::~ProtectedData() noexcept | |||
filename = nullptr; | |||
} | |||
#ifndef BUILD_BRIDGE | |||
if (iconName != nullptr) | |||
{ | |||
delete[] iconName; | |||
iconName = nullptr; | |||
} | |||
#ifndef BUILD_BRIDGE | |||
if (identifier != nullptr) | |||
{ | |||
delete[] identifier; | |||
@@ -584,6 +586,7 @@ CarlaPlugin::ProtectedData::~ProtectedData() noexcept | |||
void CarlaPlugin::ProtectedData::clearBuffers() noexcept | |||
{ | |||
#ifndef BUILD_BRIDGE | |||
if (latencyBuffers != nullptr) | |||
{ | |||
CARLA_SAFE_ASSERT(audioIn.count > 0); | |||
@@ -604,12 +607,13 @@ void CarlaPlugin::ProtectedData::clearBuffers() noexcept | |||
{ | |||
if (latency != 0) | |||
{ | |||
#ifndef BUILD_BRIDGE | |||
carla_safe_assert_int("latency != 0", __FILE__, __LINE__, static_cast<int>(latency)); | |||
#endif | |||
latency = 0; | |||
} | |||
} | |||
#else | |||
latency = 0; | |||
#endif | |||
audioIn.clear(); | |||
audioOut.clear(); | |||
@@ -714,6 +718,7 @@ void* CarlaPlugin::ProtectedData::uiLibSymbol(const char* const symbol) const no | |||
return lib_symbol(uiLib, symbol); | |||
} | |||
#ifndef BUILD_BRIDGE | |||
// ----------------------------------------------------------------------- | |||
// Settings functions | |||
@@ -805,6 +810,7 @@ void CarlaPlugin::ProtectedData::tryTransient() noexcept | |||
if (engine->getOptions().frontendWinId != 0) | |||
transientTryCounter = 1; | |||
} | |||
#endif | |||
// ----------------------------------------------------------------------- | |||
@@ -243,8 +243,8 @@ struct CarlaPlugin::ProtectedData { | |||
// data 1 | |||
const char* name; | |||
const char* filename; | |||
#ifndef BUILD_BRIDGE | |||
const char* iconName; | |||
#ifndef BUILD_BRIDGE | |||
const char* identifier; // used for save/restore settings per plugin | |||
#endif | |||
@@ -348,6 +348,7 @@ struct CarlaPlugin::ProtectedData { | |||
bool uiLibClose() noexcept; | |||
void* uiLibSymbol(const char* const symbol) const noexcept; | |||
#ifndef BUILD_BRIDGE | |||
// ------------------------------------------------------------------- | |||
// Settings functions | |||
@@ -358,6 +359,7 @@ struct CarlaPlugin::ProtectedData { | |||
// Misc | |||
void tryTransient() noexcept; | |||
#endif | |||
// ------------------------------------------------------------------- | |||
@@ -38,7 +38,7 @@ CARLA_BACKEND_START_NAMESPACE | |||
class DssiPlugin : public CarlaPlugin | |||
{ | |||
public: | |||
DssiPlugin(CarlaEngine* const engine, const uint id) | |||
DssiPlugin(CarlaEngine* const engine, const uint id) noexcept | |||
: CarlaPlugin(engine, id), | |||
fHandle(nullptr), | |||
fHandle2(nullptr), | |||
@@ -55,7 +55,7 @@ public: | |||
pData->osc.thread.setMode(CarlaPluginThread::PLUGIN_THREAD_DSSI_GUI); | |||
} | |||
~DssiPlugin() override | |||
~DssiPlugin() noexcept override | |||
{ | |||
carla_debug("DssiPlugin::~DssiPlugin()"); | |||
@@ -87,9 +87,18 @@ public: | |||
if (fDescriptor->cleanup != nullptr) | |||
{ | |||
if (fHandle != nullptr) | |||
fDescriptor->cleanup(fHandle); | |||
{ | |||
try { | |||
fDescriptor->cleanup(fHandle); | |||
} catch(...) {} | |||
} | |||
if (fHandle2 != nullptr) | |||
fDescriptor->cleanup(fHandle2); | |||
{ | |||
try { | |||
fDescriptor->cleanup(fHandle2); | |||
} catch(...) {} | |||
} | |||
} | |||
fHandle = nullptr; | |||
@@ -166,18 +175,16 @@ public: | |||
uint getOptionsAvailable() const noexcept override | |||
{ | |||
#ifdef __USE_GNU | |||
const bool isAmSynth(strcasestr(pData->filename, "amsynth")); | |||
const bool isDssiVst(strcasestr(pData->filename, "dssi-vst")); | |||
const bool isDssiVst(strcasestr(pData->filename, "dssi-vst") != nullptr); | |||
#else | |||
const bool isAmSynth(std::strstr(pData->filename, "amsynth")); | |||
const bool isDssiVst(std::strstr(pData->filename, "dssi-vst")); | |||
const bool isDssiVst(std::strstr(pData->filename, "dssi-vst") != nullptr); | |||
#endif | |||
uint options = 0x0; | |||
options |= PLUGIN_OPTION_MAP_PROGRAM_CHANGES; | |||
if (! (isAmSynth || isDssiVst)) | |||
if (! isDssiVst) | |||
{ | |||
options |= PLUGIN_OPTION_FIXED_BUFFERS; | |||
@@ -218,9 +225,12 @@ public: | |||
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | |||
if (fDescriptor->Label != nullptr) | |||
{ | |||
std::strncpy(strBuf, fDescriptor->Label, STR_MAX); | |||
else | |||
CarlaPlugin::getLabel(strBuf); | |||
return; | |||
} | |||
CarlaPlugin::getLabel(strBuf); | |||
} | |||
void getMaker(char* const strBuf) const noexcept override | |||
@@ -228,9 +238,12 @@ public: | |||
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | |||
if (fDescriptor->Maker != nullptr) | |||
{ | |||
std::strncpy(strBuf, fDescriptor->Maker, STR_MAX); | |||
else | |||
CarlaPlugin::getMaker(strBuf); | |||
return; | |||
} | |||
CarlaPlugin::getMaker(strBuf); | |||
} | |||
void getCopyright(char* const strBuf) const noexcept override | |||
@@ -238,9 +251,12 @@ public: | |||
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | |||
if (fDescriptor->Copyright != nullptr) | |||
{ | |||
std::strncpy(strBuf, fDescriptor->Copyright, STR_MAX); | |||
else | |||
CarlaPlugin::getCopyright(strBuf); | |||
return; | |||
} | |||
CarlaPlugin::getCopyright(strBuf); | |||
} | |||
void getRealName(char* const strBuf) const noexcept override | |||
@@ -248,9 +264,12 @@ public: | |||
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | |||
if (fDescriptor->Name != nullptr) | |||
{ | |||
std::strncpy(strBuf, fDescriptor->Name, STR_MAX); | |||
else | |||
CarlaPlugin::getRealName(strBuf); | |||
return; | |||
} | |||
CarlaPlugin::getRealName(strBuf); | |||
} | |||
void getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override | |||
@@ -260,10 +279,13 @@ public: | |||
const int32_t rindex(pData->param.data[parameterId].rindex); | |||
if (rindex < static_cast<int32_t>(fDescriptor->PortCount)) | |||
if (rindex < static_cast<int32_t>(fDescriptor->PortCount) && fDescriptor->PortNames[rindex] != nullptr) | |||
{ | |||
std::strncpy(strBuf, fDescriptor->PortNames[rindex], STR_MAX); | |||
else | |||
CarlaPlugin::getParameterName(parameterId, strBuf); | |||
return; | |||
} | |||
CarlaPlugin::getParameterName(parameterId, strBuf); | |||
} | |||
// ------------------------------------------------------------------- | |||
@@ -541,7 +563,7 @@ public: | |||
if (LADSPA_IS_PORT_INPUT(portType)) | |||
{ | |||
uint32_t j = iAudioIn++; | |||
const uint32_t j = iAudioIn++; | |||
pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true); | |||
pData->audioIn.ports[j].rindex = i; | |||
@@ -554,7 +576,7 @@ public: | |||
} | |||
else if (LADSPA_IS_PORT_OUTPUT(portType)) | |||
{ | |||
uint32_t j = iAudioOut++; | |||
const uint32_t j = iAudioOut++; | |||
pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
pData->audioOut.ports[j].rindex = i; | |||
@@ -570,13 +592,9 @@ public: | |||
} | |||
else if (LADSPA_IS_PORT_CONTROL(portType)) | |||
{ | |||
uint32_t j = iCtrl++; | |||
pData->param.data[j].hints = 0x0; | |||
const uint32_t j = iCtrl++; | |||
pData->param.data[j].index = static_cast<int32_t>(j); | |||
pData->param.data[j].rindex = static_cast<int32_t>(i); | |||
pData->param.data[j].midiCC = -1; | |||
pData->param.data[j].midiChannel = 0; | |||
pData->param.special[j] = PARAMETER_SPECIAL_NULL; | |||
float min, max, def, step, stepSmall, stepLarge; | |||
@@ -823,7 +841,9 @@ public: | |||
{ | |||
pData->latency = latency; | |||
pData->client->setLatency(latency); | |||
#ifndef BUILD_BRIDGE | |||
pData->recreateLatencyBuffers(); | |||
#endif | |||
} | |||
break; | |||
@@ -1023,11 +1043,13 @@ public: | |||
} | |||
} | |||
#ifndef BUILD_BRIDGE | |||
if (pData->latency > 0) | |||
{ | |||
for (uint32_t i=0; i < pData->audioIn.count; ++i) | |||
FLOAT_CLEAR(pData->latencyBuffers[i], pData->latency); | |||
} | |||
#endif | |||
pData->needsReset = false; | |||
} | |||
@@ -1924,11 +1946,9 @@ public: | |||
{ | |||
#ifdef __USE_GNU | |||
const bool isAmSynth(strcasestr(pData->filename, "amsynth")); | |||
const bool isDssiVst(strcasestr(pData->filename, "dssi-vst")); | |||
const bool isDssiVst(strcasestr(pData->filename, "dssi-vst") != nullptr); | |||
#else | |||
const bool isAmSynth(std::strstr(pData->filename, "amsynth")); | |||
const bool isDssiVst(std::strstr(pData->filename, "dssi-vst")); | |||
const bool isDssiVst(std::strstr(pData->filename, "dssi-vst") != nullptr); | |||
#endif | |||
// set default options | |||
@@ -1936,7 +1956,7 @@ public: | |||
pData->options |= PLUGIN_OPTION_MAP_PROGRAM_CHANGES; | |||
if (isAmSynth || isDssiVst) | |||
if (isDssiVst) | |||
pData->options |= PLUGIN_OPTION_FIXED_BUFFERS; | |||
if (pData->engine->getOptions().forceStereo) | |||
@@ -1956,6 +1976,7 @@ public: | |||
carla_stderr("WARNING: Plugin can ONLY use run_multiple_synths!"); | |||
} | |||
#ifndef BUILD_BRIDGE | |||
// set identifier string | |||
CarlaString identifier("DSSI/"); | |||
@@ -1972,8 +1993,9 @@ public: | |||
pData->options = pData->loadSettings(pData->options, getOptionsAvailable()); | |||
// ignore settings, we need this anyway | |||
if (isAmSynth || isDssiVst) | |||
if (isDssiVst) | |||
pData->options |= PLUGIN_OPTION_FIXED_BUFFERS; | |||
#endif | |||
} | |||
return true; | |||
@@ -41,7 +41,7 @@ CARLA_BACKEND_START_NAMESPACE | |||
class FluidSynthPlugin : public CarlaPlugin | |||
{ | |||
public: | |||
FluidSynthPlugin(CarlaEngine* const engine, const unsigned int id, const bool use16Outs) | |||
FluidSynthPlugin(CarlaEngine* const engine, const uint id, const bool use16Outs) | |||
: CarlaPlugin(engine, id), | |||
fUses16Outs(use16Outs), | |||
fSettings(nullptr), | |||
@@ -165,9 +165,9 @@ public: | |||
// ------------------------------------------------------------------- | |||
// Information (per-plugin data) | |||
unsigned int getOptionsAvailable() const noexcept override | |||
uint getOptionsAvailable() const noexcept override | |||
{ | |||
unsigned int options = 0x0; | |||
uint options = 0x0; | |||
options |= PLUGIN_OPTION_MAP_PROGRAM_CHANGES; | |||
options |= PLUGIN_OPTION_SEND_CONTROL_CHANGES; | |||
@@ -224,9 +224,12 @@ public: | |||
void getLabel(char* const strBuf) const noexcept override | |||
{ | |||
if (fLabel != nullptr) | |||
{ | |||
std::strncpy(strBuf, fLabel, STR_MAX); | |||
else | |||
CarlaPlugin::getLabel(strBuf); | |||
return; | |||
} | |||
CarlaPlugin::getLabel(strBuf); | |||
} | |||
void getMaker(char* const strBuf) const noexcept override | |||
@@ -252,50 +255,49 @@ public: | |||
{ | |||
case FluidSynthReverbOnOff: | |||
std::strncpy(strBuf, "Reverb On/Off", STR_MAX); | |||
break; | |||
return; | |||
case FluidSynthReverbRoomSize: | |||
std::strncpy(strBuf, "Reverb Room Size", STR_MAX); | |||
break; | |||
return; | |||
case FluidSynthReverbDamp: | |||
std::strncpy(strBuf, "Reverb Damp", STR_MAX); | |||
break; | |||
return; | |||
case FluidSynthReverbLevel: | |||
std::strncpy(strBuf, "Reverb Level", STR_MAX); | |||
break; | |||
return; | |||
case FluidSynthReverbWidth: | |||
std::strncpy(strBuf, "Reverb Width", STR_MAX); | |||
break; | |||
return; | |||
case FluidSynthChorusOnOff: | |||
std::strncpy(strBuf, "Chorus On/Off", STR_MAX); | |||
break; | |||
return; | |||
case FluidSynthChorusNr: | |||
std::strncpy(strBuf, "Chorus Voice Count", STR_MAX); | |||
break; | |||
return; | |||
case FluidSynthChorusLevel: | |||
std::strncpy(strBuf, "Chorus Level", STR_MAX); | |||
break; | |||
return; | |||
case FluidSynthChorusSpeedHz: | |||
std::strncpy(strBuf, "Chorus Speed", STR_MAX); | |||
break; | |||
return; | |||
case FluidSynthChorusDepthMs: | |||
std::strncpy(strBuf, "Chorus Depth", STR_MAX); | |||
break; | |||
return; | |||
case FluidSynthChorusType: | |||
std::strncpy(strBuf, "Chorus Type", STR_MAX); | |||
break; | |||
return; | |||
case FluidSynthPolyphony: | |||
std::strncpy(strBuf, "Polyphony", STR_MAX); | |||
break; | |||
return; | |||
case FluidSynthInterpolation: | |||
std::strncpy(strBuf, "Interpolation", STR_MAX); | |||
break; | |||
return; | |||
case FluidSynthVoiceCount: | |||
std::strncpy(strBuf, "Voice Count", STR_MAX); | |||
break; | |||
default: | |||
CarlaPlugin::getParameterName(parameterId, strBuf); | |||
break; | |||
return; | |||
} | |||
CarlaPlugin::getParameterName(parameterId, strBuf); | |||
} | |||
void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override | |||
@@ -306,14 +308,13 @@ public: | |||
{ | |||
case FluidSynthChorusSpeedHz: | |||
std::strncpy(strBuf, "Hz", STR_MAX); | |||
break; | |||
return; | |||
case FluidSynthChorusDepthMs: | |||
std::strncpy(strBuf, "ms", STR_MAX); | |||
break; | |||
default: | |||
CarlaPlugin::getParameterUnit(parameterId, strBuf); | |||
break; | |||
return; | |||
} | |||
CarlaPlugin::getParameterUnit(parameterId, strBuf); | |||
} | |||
void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const noexcept override | |||
@@ -373,7 +374,7 @@ public: | |||
void setCtrlChannel(const int8_t channel, const bool sendOsc, const bool sendCallback) noexcept override | |||
{ | |||
if (channel < MAX_MIDI_CHANNELS) | |||
if (channel >= 0 && channel < MAX_MIDI_CHANNELS) | |||
pData->midiprog.current = fCurMidiProgs[channel]; | |||
CarlaPlugin::setCtrlChannel(channel, sendOsc, sendCallback); | |||
@@ -687,7 +688,6 @@ public: | |||
pData->param.ranges[j].step = 1.0f; | |||
pData->param.ranges[j].stepSmall = 1.0f; | |||
pData->param.ranges[j].stepLarge = 1.0f; | |||
fParamBuffers[j] = pData->param.ranges[j].def; | |||
// ---------------------- | |||
j = FluidSynthReverbRoomSize; | |||
@@ -703,7 +703,6 @@ public: | |||
pData->param.ranges[j].step = 0.01f; | |||
pData->param.ranges[j].stepSmall = 0.0001f; | |||
pData->param.ranges[j].stepLarge = 0.1f; | |||
fParamBuffers[j] = pData->param.ranges[j].def; | |||
// ---------------------- | |||
j = FluidSynthReverbDamp; | |||
@@ -719,7 +718,6 @@ public: | |||
pData->param.ranges[j].step = 0.01f; | |||
pData->param.ranges[j].stepSmall = 0.0001f; | |||
pData->param.ranges[j].stepLarge = 0.1f; | |||
fParamBuffers[j] = pData->param.ranges[j].def; | |||
// ---------------------- | |||
j = FluidSynthReverbLevel; | |||
@@ -735,7 +733,6 @@ public: | |||
pData->param.ranges[j].step = 0.01f; | |||
pData->param.ranges[j].stepSmall = 0.0001f; | |||
pData->param.ranges[j].stepLarge = 0.1f; | |||
fParamBuffers[j] = pData->param.ranges[j].def; | |||
// ---------------------- | |||
j = FluidSynthReverbWidth; | |||
@@ -751,7 +748,6 @@ public: | |||
pData->param.ranges[j].step = 0.01f; | |||
pData->param.ranges[j].stepSmall = 0.0001f; | |||
pData->param.ranges[j].stepLarge = 0.1f; | |||
fParamBuffers[j] = pData->param.ranges[j].def; | |||
// ---------------------- | |||
j = FluidSynthChorusOnOff; | |||
@@ -767,7 +763,6 @@ public: | |||
pData->param.ranges[j].step = 1.0f; | |||
pData->param.ranges[j].stepSmall = 1.0f; | |||
pData->param.ranges[j].stepLarge = 1.0f; | |||
fParamBuffers[j] = pData->param.ranges[j].def; | |||
// ---------------------- | |||
j = FluidSynthChorusNr; | |||
@@ -783,7 +778,6 @@ public: | |||
pData->param.ranges[j].step = 1.0f; | |||
pData->param.ranges[j].stepSmall = 1.0f; | |||
pData->param.ranges[j].stepLarge = 10.0f; | |||
fParamBuffers[j] = pData->param.ranges[j].def; | |||
// ---------------------- | |||
j = FluidSynthChorusLevel; | |||
@@ -799,7 +793,6 @@ public: | |||
pData->param.ranges[j].step = 0.01f; | |||
pData->param.ranges[j].stepSmall = 0.0001f; | |||
pData->param.ranges[j].stepLarge = 0.1f; | |||
fParamBuffers[j] = pData->param.ranges[j].def; | |||
// ---------------------- | |||
j = FluidSynthChorusSpeedHz; | |||
@@ -815,7 +808,6 @@ public: | |||
pData->param.ranges[j].step = 0.01f; | |||
pData->param.ranges[j].stepSmall = 0.0001f; | |||
pData->param.ranges[j].stepLarge = 0.1f; | |||
fParamBuffers[j] = pData->param.ranges[j].def; | |||
// ---------------------- | |||
j = FluidSynthChorusDepthMs; | |||
@@ -831,7 +823,6 @@ public: | |||
pData->param.ranges[j].step = 0.01f; | |||
pData->param.ranges[j].stepSmall = 0.0001f; | |||
pData->param.ranges[j].stepLarge = 0.1f; | |||
fParamBuffers[j] = pData->param.ranges[j].def; | |||
// ---------------------- | |||
j = FluidSynthChorusType; | |||
@@ -847,7 +838,6 @@ public: | |||
pData->param.ranges[j].step = 1.0f; | |||
pData->param.ranges[j].stepSmall = 1.0f; | |||
pData->param.ranges[j].stepLarge = 1.0f; | |||
fParamBuffers[j] = pData->param.ranges[j].def; | |||
// ---------------------- | |||
j = FluidSynthPolyphony; | |||
@@ -863,7 +853,6 @@ public: | |||
pData->param.ranges[j].step = 1.0f; | |||
pData->param.ranges[j].stepSmall = 1.0f; | |||
pData->param.ranges[j].stepLarge = 10.0f; | |||
fParamBuffers[j] = pData->param.ranges[j].def; | |||
// ---------------------- | |||
j = FluidSynthInterpolation; | |||
@@ -879,7 +868,6 @@ public: | |||
pData->param.ranges[j].step = 1.0f; | |||
pData->param.ranges[j].stepSmall = 1.0f; | |||
pData->param.ranges[j].stepLarge = 1.0f; | |||
fParamBuffers[j] = pData->param.ranges[j].def; | |||
// ---------------------- | |||
j = FluidSynthVoiceCount; | |||
@@ -895,7 +883,9 @@ public: | |||
pData->param.ranges[j].step = 1.0f; | |||
pData->param.ranges[j].stepSmall = 1.0f; | |||
pData->param.ranges[j].stepLarge = 1.0f; | |||
fParamBuffers[j] = pData->param.ranges[j].def; | |||
for (j=0; j<FluidSynthParametersMax; ++j) | |||
fParamBuffers[j] = pData->param.ranges[j].def; | |||
} | |||
// --------------------------------------- | |||
@@ -1647,6 +1637,7 @@ public: | |||
pData->options |= PLUGIN_OPTION_SEND_PITCHBEND; | |||
pData->options |= PLUGIN_OPTION_SEND_ALL_SOUND_OFF; | |||
#ifndef BUILD_BRIDGE | |||
// set identifier string | |||
CarlaString identifier("SF2/"); | |||
@@ -1659,6 +1650,7 @@ public: | |||
// load settings | |||
pData->options = pData->loadSettings(pData->options, getOptionsAvailable()); | |||
#endif | |||
} | |||
return true; | |||
@@ -411,11 +411,8 @@ public: | |||
for (uint32_t j=0; j < params; ++j) | |||
{ | |||
pData->param.data[j].type = PARAMETER_INPUT; | |||
pData->param.data[j].hints = 0x0; | |||
pData->param.data[j].index = static_cast<int32_t>(j); | |||
pData->param.data[j].rindex = static_cast<int32_t>(j); | |||
pData->param.data[j].midiCC = -1; | |||
pData->param.data[j].midiChannel = 0; | |||
float min, max, def, step, stepSmall, stepLarge; | |||
@@ -1122,6 +1119,7 @@ public: | |||
pData->options |= PLUGIN_OPTION_SEND_ALL_SOUND_OFF; | |||
} | |||
#ifndef BUILD_BRIDGE | |||
// set identifier string | |||
String juceId(fDesc.createIdentifierString()); | |||
@@ -1134,6 +1132,7 @@ public: | |||
// ignore settings, we need this anyway | |||
pData->options |= PLUGIN_OPTION_FIXED_BUFFERS; | |||
#endif | |||
} | |||
return true; | |||
@@ -298,7 +298,7 @@ public: | |||
const int32_t rindex(pData->param.data[parameterId].rindex); | |||
if (rindex < static_cast<int32_t>(fDescriptor->PortCount)) | |||
if (rindex < static_cast<int32_t>(fDescriptor->PortCount) && fDescriptor->PortNames[rindex] != nullptr) | |||
{ | |||
std::strncpy(strBuf, fDescriptor->PortNames[rindex], STR_MAX); | |||
return; | |||
@@ -904,11 +904,13 @@ public: | |||
if (pData->needsReset) | |||
{ | |||
#ifndef BUILD_BRIDGE | |||
if (pData->latency > 0) | |||
{ | |||
for (uint32_t i=0; i < pData->audioIn.count; ++i) | |||
FLOAT_CLEAR(pData->latencyBuffers[i], pData->latency); | |||
} | |||
#endif | |||
pData->needsReset = false; | |||
} | |||
@@ -1485,6 +1487,7 @@ public: | |||
if (pData->engine->getOptions().forceStereo) | |||
pData->options |= PLUGIN_OPTION_FORCE_STEREO; | |||
#ifndef BUILD_BRIDGE | |||
// set identifier string | |||
CarlaString identifier("LADSPA/"); | |||
identifier += CarlaString(getUniqueId()); | |||
@@ -1498,6 +1501,7 @@ public: | |||
// ignore settings, we need this anyway | |||
if (isDssiVst) | |||
pData->options |= PLUGIN_OPTION_FIXED_BUFFERS; | |||
#endif | |||
} | |||
return true; | |||
@@ -332,17 +332,23 @@ public: | |||
void getLabel(char* const strBuf) const noexcept override | |||
{ | |||
if (fLabel != nullptr) | |||
{ | |||
std::strncpy(strBuf, fLabel, STR_MAX); | |||
else | |||
CarlaPlugin::getLabel(strBuf); | |||
return; | |||
} | |||
CarlaPlugin::getLabel(strBuf); | |||
} | |||
void getMaker(char* const strBuf) const noexcept override | |||
{ | |||
if (fMaker != nullptr) | |||
{ | |||
std::strncpy(strBuf, fMaker, STR_MAX); | |||
else | |||
CarlaPlugin::getMaker(strBuf); | |||
return; | |||
} | |||
CarlaPlugin::getMaker(strBuf); | |||
} | |||
void getCopyright(char* const strBuf) const noexcept override | |||
@@ -353,9 +359,12 @@ public: | |||
void getRealName(char* const strBuf) const noexcept override | |||
{ | |||
if (fRealName != nullptr) | |||
{ | |||
std::strncpy(strBuf, fRealName, STR_MAX); | |||
else | |||
CarlaPlugin::getRealName(strBuf); | |||
return; | |||
} | |||
CarlaPlugin::getRealName(strBuf); | |||
} | |||
// ------------------------------------------------------------------- | |||
@@ -377,7 +386,7 @@ public: | |||
void setCtrlChannel(const int8_t channel, const bool sendOsc, const bool sendCallback) noexcept override | |||
{ | |||
if (channel < MAX_MIDI_CHANNELS) | |||
if (channel >= 0 && channel < MAX_MIDI_CHANNELS) | |||
pData->midiprog.current = fCurMidiProgs[channel]; | |||
CarlaPlugin::setCtrlChannel(channel, sendOsc, sendCallback); | |||
@@ -1305,6 +1314,7 @@ public: | |||
pData->options |= PLUGIN_OPTION_SEND_PITCHBEND; | |||
pData->options |= PLUGIN_OPTION_SEND_ALL_SOUND_OFF; | |||
#ifndef BUILD_BRIDGE | |||
// set identifier string | |||
CarlaString identifier(fFormat); | |||
identifier += "/"; | |||
@@ -1318,6 +1328,7 @@ public: | |||
// load settings | |||
pData->options = pData->loadSettings(pData->options, getOptionsAvailable()); | |||
#endif | |||
} | |||
return true; | |||
@@ -731,19 +731,16 @@ public: | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, 0.0f); | |||
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f); | |||
CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId), 0.0f); | |||
const int32_t rindex(pData->param.data[parameterId].rindex); | |||
if (rindex < static_cast<int32_t>(fRdfDescriptor->PortCount)) | |||
{ | |||
const LV2_RDF_Port* const port(&fRdfDescriptor->Ports[rindex]); | |||
CARLA_SAFE_ASSERT_RETURN(scalePointId < port->ScalePointCount, 0.0f); | |||
if (scalePointId < port->ScalePointCount) | |||
{ | |||
const LV2_RDF_PortScalePoint* const portScalePoint(&port->ScalePoints[scalePointId]); | |||
return portScalePoint->Value; | |||
} | |||
const LV2_RDF_PortScalePoint* const portScalePoint(&port->ScalePoints[scalePointId]); | |||
return portScalePoint->Value; | |||
} | |||
return 0.0f; | |||
@@ -917,23 +914,20 @@ public: | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); | |||
CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId),); | |||
const int32_t rindex(pData->param.data[parameterId].rindex); | |||
if (rindex < static_cast<int32_t>(fRdfDescriptor->PortCount)) | |||
{ | |||
const LV2_RDF_Port* const port(&fRdfDescriptor->Ports[rindex]); | |||
CARLA_SAFE_ASSERT_RETURN(scalePointId < port->ScalePointCount,); | |||
if (scalePointId < port->ScalePointCount) | |||
{ | |||
const LV2_RDF_PortScalePoint* const portScalePoint(&port->ScalePoints[scalePointId]); | |||
const LV2_RDF_PortScalePoint* const portScalePoint(&port->ScalePoints[scalePointId]); | |||
if (portScalePoint->Label != nullptr) | |||
{ | |||
std::strncpy(strBuf, portScalePoint->Label, STR_MAX); | |||
return; | |||
} | |||
if (portScalePoint->Label != nullptr) | |||
{ | |||
std::strncpy(strBuf, portScalePoint->Label, STR_MAX); | |||
return; | |||
} | |||
} | |||
@@ -1249,14 +1243,18 @@ public: | |||
else if (fExt.uishow != nullptr) | |||
{ | |||
fExt.uishow->show(fUi.handle); | |||
# ifndef BUILD_BRIDGE | |||
pData->tryTransient(); | |||
# endif | |||
} | |||
} | |||
else | |||
#endif | |||
{ | |||
LV2_EXTERNAL_UI_SHOW((LV2_External_UI_Widget*)fUi.widget); | |||
#ifndef BUILD_BRIDGE | |||
pData->tryTransient(); | |||
#endif | |||
} | |||
} | |||
else | |||
@@ -1574,7 +1572,7 @@ public: | |||
{ | |||
if (LV2_IS_PORT_INPUT(portTypes)) | |||
{ | |||
uint32_t j = iAudioIn++; | |||
const uint32_t j = iAudioIn++; | |||
pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true); | |||
pData->audioIn.ports[j].rindex = i; | |||
@@ -1587,7 +1585,7 @@ public: | |||
} | |||
else if (LV2_IS_PORT_OUTPUT(portTypes)) | |||
{ | |||
uint32_t j = iAudioOut++; | |||
const uint32_t j = iAudioOut++; | |||
pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
pData->audioOut.ports[j].rindex = i; | |||
@@ -1605,13 +1603,13 @@ public: | |||
{ | |||
if (LV2_IS_PORT_INPUT(portTypes)) | |||
{ | |||
uint32_t j = iCvIn++; | |||
const uint32_t j = iCvIn++; | |||
fCvIn.ports[j].port = (CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, portName, true); | |||
fCvIn.ports[j].rindex = i; | |||
} | |||
else if (LV2_IS_PORT_OUTPUT(portTypes)) | |||
{ | |||
uint32_t j = iCvOut++; | |||
const uint32_t j = iCvOut++; | |||
fCvOut.ports[j].port = (CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, portName, false); | |||
fCvOut.ports[j].rindex = i; | |||
} | |||
@@ -1622,7 +1620,7 @@ public: | |||
{ | |||
if (LV2_IS_PORT_INPUT(portTypes)) | |||
{ | |||
uint32_t j = iEvIn++; | |||
const uint32_t j = iEvIn++; | |||
fDescriptor->connect_port(fHandle, i, &fEventsIn.data[j].atom->atoms); | |||
@@ -1660,7 +1658,7 @@ public: | |||
} | |||
else if (LV2_IS_PORT_OUTPUT(portTypes)) | |||
{ | |||
uint32_t j = iEvOut++; | |||
const uint32_t j = iEvOut++; | |||
fDescriptor->connect_port(fHandle, i, &fEventsOut.data[j].atom->atoms); | |||
@@ -1703,7 +1701,7 @@ public: | |||
{ | |||
if (LV2_IS_PORT_INPUT(portTypes)) | |||
{ | |||
uint32_t j = iEvIn++; | |||
const uint32_t j = iEvIn++; | |||
fDescriptor->connect_port(fHandle, i, fEventsIn.data[j].event); | |||
@@ -1741,7 +1739,7 @@ public: | |||
} | |||
else if (LV2_IS_PORT_OUTPUT(portTypes)) | |||
{ | |||
uint32_t j = iEvOut++; | |||
const uint32_t j = iEvOut++; | |||
fDescriptor->connect_port(fHandle, i, fEventsOut.data[j].event); | |||
@@ -1784,7 +1782,7 @@ public: | |||
{ | |||
if (LV2_IS_PORT_INPUT(portTypes)) | |||
{ | |||
uint32_t j = iEvIn++; | |||
const uint32_t j = iEvIn++; | |||
fDescriptor->connect_port(fHandle, i, &fEventsIn.data[j].midi); | |||
@@ -1813,7 +1811,7 @@ public: | |||
} | |||
else if (LV2_IS_PORT_OUTPUT(portTypes)) | |||
{ | |||
uint32_t j = iEvOut++; | |||
const uint32_t j = iEvOut++; | |||
fDescriptor->connect_port(fHandle, i, &fEventsOut.data[j].midi); | |||
@@ -1849,13 +1847,9 @@ public: | |||
const LV2_Property portDesignation(fRdfDescriptor->Ports[i].Designation); | |||
const LV2_RDF_PortPoints portPoints(fRdfDescriptor->Ports[i].Points); | |||
uint32_t j = iCtrl++; | |||
pData->param.data[j].hints = 0x0; | |||
const uint32_t j = iCtrl++; | |||
pData->param.data[j].index = static_cast<int32_t>(j); | |||
pData->param.data[j].rindex = static_cast<int32_t>(i); | |||
pData->param.data[j].midiCC = -1; | |||
pData->param.data[j].midiChannel = 0; | |||
pData->param.special[j] = PARAMETER_SPECIAL_NULL; | |||
float min, max, def, step, stepSmall, stepLarge; | |||
@@ -2455,11 +2449,13 @@ public: | |||
} | |||
} | |||
#ifndef BUILD_BRIDGE | |||
if (pData->latency > 0) | |||
{ | |||
for (uint32_t i=0; i < pData->audioIn.count; ++i) | |||
FLOAT_CLEAR(pData->latencyBuffers[i], pData->latency); | |||
} | |||
#endif | |||
pData->needsReset = false; | |||
} | |||
@@ -4637,6 +4633,7 @@ public: | |||
pData->options |= PLUGIN_OPTION_SEND_ALL_SOUND_OFF; | |||
} | |||
#ifndef BUILD_BRIDGE | |||
// set identifier string | |||
CarlaString identifier("LV2/"); | |||
identifier += uri; | |||
@@ -4648,6 +4645,7 @@ public: | |||
// ignore settings, we need this anyway | |||
if (getMidiInCount() > 0 || needsFixedBuffer()) | |||
pData->options |= PLUGIN_OPTION_FIXED_BUFFERS; | |||
#endif | |||
} | |||
// --------------------------------------------------------------- | |||
@@ -333,11 +333,12 @@ public: | |||
CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr, 0.0f); | |||
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, 0.0f); | |||
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f); | |||
CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId), 0.0f); | |||
// FIXME - try | |||
if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(scalePointId < param->scalePointCount, 0.0f); | |||
const NativeParameterScalePoint* scalePoint(¶m->scalePoints[scalePointId]); | |||
return scalePoint->value; | |||
} | |||
@@ -351,9 +352,12 @@ public: | |||
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | |||
if (fDescriptor->label != nullptr) | |||
{ | |||
std::strncpy(strBuf, fDescriptor->label, STR_MAX); | |||
else | |||
CarlaPlugin::getLabel(strBuf); | |||
return; | |||
} | |||
CarlaPlugin::getLabel(strBuf); | |||
} | |||
void getMaker(char* const strBuf) const noexcept override | |||
@@ -361,9 +365,12 @@ public: | |||
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | |||
if (fDescriptor->maker != nullptr) | |||
{ | |||
std::strncpy(strBuf, fDescriptor->maker, STR_MAX); | |||
else | |||
CarlaPlugin::getMaker(strBuf); | |||
return; | |||
} | |||
CarlaPlugin::getMaker(strBuf); | |||
} | |||
void getCopyright(char* const strBuf) const noexcept override | |||
@@ -371,9 +378,12 @@ public: | |||
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | |||
if (fDescriptor->copyright != nullptr) | |||
{ | |||
std::strncpy(strBuf, fDescriptor->copyright, STR_MAX); | |||
else | |||
CarlaPlugin::getCopyright(strBuf); | |||
return; | |||
} | |||
CarlaPlugin::getCopyright(strBuf); | |||
} | |||
void getRealName(char* const strBuf) const noexcept override | |||
@@ -381,9 +391,12 @@ public: | |||
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | |||
if (fDescriptor->name != nullptr) | |||
{ | |||
std::strncpy(strBuf, fDescriptor->name, STR_MAX); | |||
else | |||
CarlaPlugin::getRealName(strBuf); | |||
return; | |||
} | |||
CarlaPlugin::getRealName(strBuf); | |||
} | |||
void getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override | |||
@@ -401,6 +414,7 @@ public: | |||
std::strncpy(strBuf, param->name, STR_MAX); | |||
return; | |||
} | |||
carla_safe_assert("param->name != nullptr", __FILE__, __LINE__); | |||
return CarlaPlugin::getParameterName(parameterId, strBuf); | |||
} | |||
@@ -443,6 +457,7 @@ public: | |||
std::strncpy(strBuf, param->unit, STR_MAX); | |||
return; | |||
} | |||
return CarlaPlugin::getParameterUnit(parameterId, strBuf); | |||
} | |||
@@ -456,11 +471,12 @@ public: | |||
CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); | |||
CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId),); | |||
// FIXME - try | |||
if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(scalePointId < param->scalePointCount,); | |||
const NativeParameterScalePoint* scalePoint(¶m->scalePoints[scalePointId]); | |||
if (scalePoint->label != nullptr) | |||
@@ -468,6 +484,7 @@ public: | |||
std::strncpy(strBuf, scalePoint->label, STR_MAX); | |||
return; | |||
} | |||
carla_safe_assert("scalePoint->label != nullptr", __FILE__, __LINE__); | |||
return CarlaPlugin::getParameterScalePointLabel(parameterId, scalePointId, strBuf); | |||
} | |||
@@ -532,7 +549,7 @@ public: | |||
void setCtrlChannel(const int8_t channel, const bool sendOsc, const bool sendCallback) noexcept override | |||
{ | |||
if (channel < MAX_MIDI_CHANNELS && pData->midiprog.count > 0) | |||
if (channel >= 0 && channel < MAX_MIDI_CHANNELS && pData->midiprog.count > 0) | |||
pData->midiprog.current = fCurMidiProgs[channel]; | |||
CarlaPlugin::setCtrlChannel(channel, sendOsc, sendCallback); | |||
@@ -694,8 +711,10 @@ public: | |||
return; | |||
} | |||
#ifndef BUILD_BRIDGE | |||
if ((fDescriptor->hints & ::PLUGIN_USES_PARENT_ID) == 0) | |||
pData->tryTransient(); | |||
#endif | |||
if (fDescriptor->ui_set_custom_data != nullptr) | |||
{ | |||
@@ -949,12 +968,8 @@ public: | |||
CARLA_SAFE_ASSERT_CONTINUE(paramInfo != nullptr); | |||
pData->param.data[j].type = PARAMETER_UNKNOWN; | |||
pData->param.data[j].hints = 0x0; | |||
pData->param.data[j].index = static_cast<int32_t>(j); | |||
pData->param.data[j].rindex = static_cast<int32_t>(j); | |||
pData->param.data[j].midiCC = -1; | |||
pData->param.data[j].midiChannel = 0; | |||
pData->param.special[j] = PARAMETER_SPECIAL_NULL; | |||
float min, max, def, step, stepSmall, stepLarge; | |||
@@ -2341,6 +2356,7 @@ public: | |||
if (fDescriptor->supports & ::PLUGIN_SUPPORTS_ALL_SOUND_OFF) | |||
pData->options |= PLUGIN_OPTION_SEND_ALL_SOUND_OFF; | |||
#ifndef BUILD_BRIDGE | |||
// set identifier string | |||
CarlaString identifier("Native/"); | |||
identifier += label; | |||
@@ -2352,6 +2368,7 @@ public: | |||
// ignore settings, we need this anyway | |||
if (getMidiInCount() > 0 || (fDescriptor->hints & ::PLUGIN_NEEDS_FIXED_BUFFERS) != 0) | |||
pData->options |= PLUGIN_OPTION_FIXED_BUFFERS; | |||
#endif | |||
} | |||
return true; | |||
@@ -700,11 +700,13 @@ public: | |||
if (pData->needsReset) | |||
{ | |||
#ifndef BUILD_BRIDGE | |||
if (pData->latency > 0) | |||
{ | |||
for (uint32_t i=0; i < pData->audioIn.count; ++i) | |||
FLOAT_CLEAR(pData->latencyBuffers[i], pData->latency); | |||
} | |||
#endif | |||
pData->needsReset = false; | |||
} | |||
@@ -1033,6 +1035,7 @@ public: | |||
pData->options |= PLUGIN_OPTION_SEND_ALL_SOUND_OFF; | |||
} | |||
#ifndef BUILD_BRIDGE | |||
// set identifier string | |||
CarlaString identifier("ReWire/"); | |||
identifier += fLabel; | |||
@@ -1044,6 +1047,7 @@ public: | |||
// ignore settings, we need this anyway | |||
pData->options |= PLUGIN_OPTION_FIXED_BUFFERS; | |||
pData->options |= PLUGIN_OPTION_USE_CHUNKS; | |||
#endif | |||
} | |||
return true; | |||
@@ -620,11 +620,8 @@ public: | |||
for (uint32_t j=0; j < params; ++j) | |||
{ | |||
pData->param.data[j].type = PARAMETER_INPUT; | |||
pData->param.data[j].hints = 0x0; | |||
pData->param.data[j].index = static_cast<int32_t>(j); | |||
pData->param.data[j].rindex = static_cast<int32_t>(j); | |||
pData->param.data[j].midiCC = -1; | |||
pData->param.data[j].midiChannel = 0; | |||
float min, max, def, step, stepSmall, stepLarge; | |||
@@ -853,7 +850,9 @@ public: | |||
#endif | |||
pData->client->setLatency(pData->latency); | |||
#ifndef BUILD_BRIDGE | |||
pData->recreateLatencyBuffers(); | |||
#endif | |||
} | |||
// special plugin fixes | |||
@@ -1056,11 +1055,13 @@ public: | |||
} | |||
} | |||
#ifndef BUILD_BRIDGE | |||
if (pData->latency > 0) | |||
{ | |||
for (uint32_t i=0; i < pData->audioIn.count; ++i) | |||
FLOAT_CLEAR(pData->latencyBuffers[i], pData->latency); | |||
} | |||
#endif | |||
pData->needsReset = false; | |||
} | |||
@@ -2256,6 +2257,7 @@ public: | |||
pData->options |= PLUGIN_OPTION_SEND_ALL_SOUND_OFF; | |||
} | |||
#ifndef BUILD_BRIDGE | |||
// set identifier string | |||
CarlaString identifier("VST/"); | |||
@@ -2274,6 +2276,7 @@ public: | |||
// ignore settings, we need this anyway | |||
if (getMidiInCount() > 0) | |||
pData->options |= PLUGIN_OPTION_FIXED_BUFFERS; | |||
#endif | |||
} | |||
return true; | |||