Browse Source

Add test code to replace sfz files with lv2 sfizz (disabled for now)

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 5 years ago
parent
commit
046ea33f4b
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 84 additions and 2 deletions
  1. +83
    -0
      source/backend/engine/CarlaEngine.cpp
  2. +1
    -2
      source/backend/plugin/CarlaPluginLV2.cpp

+ 83
- 0
source/backend/engine/CarlaEngine.cpp View File

@@ -58,6 +58,8 @@ using water::StringArray;
using water::XmlDocument;
using water::XmlElement;

// #define SFZ_FILES_USING_SFIZZ

CARLA_BACKEND_START_NAMESPACE

// -----------------------------------------------------------------------
@@ -645,7 +647,23 @@ bool CarlaEngine::addPlugin(const BinaryType btype,
break;

case PLUGIN_SFZ:
# ifdef SFZ_FILES_USING_SFIZZ
{
CarlaPlugin::Initializer sfizzInitializer = {
this,
id,
"",
name,
"http://sfztools.github.io/sfizz",
0,
options
};

plugin = CarlaPlugin::newLV2(sfizzInitializer);
}
# else
plugin = CarlaPlugin::newSFZero(initializer);
# endif
break;

case PLUGIN_JACK:
@@ -669,6 +687,17 @@ bool CarlaEngine::addPlugin(const BinaryType btype,

plugin->reload();

#ifdef SFZ_FILES_USING_SFIZZ
if (ptype == PLUGIN_SFZ && plugin->getType() == PLUGIN_LV2)
{
plugin->setCustomData(LV2_ATOM__Path,
"http://sfztools.github.io/sfizz:sfzfile",
filename,
false);
plugin->restoreLV2State();
}
#endif

bool canRun = true;

/**/ if (pData->options.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK)
@@ -2775,6 +2804,60 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);
continue;
}
# ifdef SFZ_FILES_USING_SFIZZ
if (std::strcmp(stateSave.type, "SFZ") == 0)
{
if (addPlugin(PLUGIN_LV2, "", stateSave.name, "http://sfztools.github.io/sfizz", 0, nullptr))
{
const uint pluginId = pData->curPluginCount;

if (const CarlaPluginPtr plugin = pData->plugins[pluginId].plugin)
{
if (pData->aboutToClose)
return true;

if (pData->actionCanceled)
{
setLastError("Project load canceled");
return false;
}

plugin->setCustomData(LV2_ATOM__Path,
"http://sfztools.github.io/sfizz:sfzfile",
stateSave.binary,
false);

plugin->restoreLV2State();

plugin->setDryWet(stateSave.dryWet, true, true);
plugin->setVolume(stateSave.volume, true, true);
plugin->setBalanceLeft(stateSave.balanceLeft, true, true);
plugin->setBalanceRight(stateSave.balanceRight, true, true);
plugin->setPanning(stateSave.panning, true, true);
plugin->setCtrlChannel(stateSave.ctrlChannel, true, true);
plugin->setActive(stateSave.active, true, true);
plugin->setEnabled(true);

++pData->curPluginCount;
callback(true, true, ENGINE_CALLBACK_PLUGIN_ADDED, pluginId, 0, 0, 0, 0.0f, plugin->getName());

if (isPatchbay)
pData->graph.addPlugin(plugin);
}
else
{
carla_stderr2("Failed to get new plugin, state will not be restored correctly\n");
}
}
else
{
carla_stderr2("Failed to load a sfizz LV2 plugin, SFZ file won't be loaded");
}

callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);
continue;
}
# endif
#endif

const void* extraStuff = nullptr;


+ 1
- 2
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -7602,8 +7602,7 @@ bool CarlaPipeServerLV2::msgReceived(const char* const msg) noexcept

CarlaPluginPtr CarlaPlugin::newLV2(const Initializer& init)
{
carla_debug("CarlaPlugin::newLV2({%p, \"%s\", \"%s\", " P_INT64 "})",
init.engine, init.name, init.label, init.uniqueId);
carla_debug("CarlaPlugin::newLV2({%p, \"%s\", \"%s\"})", init.engine, init.name, init.label);

std::shared_ptr<CarlaPluginLV2> plugin(new CarlaPluginLV2(init.engine, init.id));



Loading…
Cancel
Save