From cb02a7981d466025552d39118ab47ab292ec96ad Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 26 Apr 2013 01:29:25 +0100 Subject: [PATCH] Adjustments to make carla-single load gig/sf2/sfz files --- source/bridges/CarlaBridgePlugin.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/source/bridges/CarlaBridgePlugin.cpp b/source/bridges/CarlaBridgePlugin.cpp index 478628410..927f5d3d1 100644 --- a/source/bridges/CarlaBridgePlugin.cpp +++ b/source/bridges/CarlaBridgePlugin.cpp @@ -467,7 +467,7 @@ int main(int argc, char* argv[]) const char* const stype = argv[2]; const char* const filename = argv[3]; const char* name = argv[4]; - const char* const label = argv[5]; + const char* label = argv[5]; const bool useBridge = (argc == 7); const bool useOsc = std::strcmp(oscUrl, "null"); @@ -475,6 +475,9 @@ int main(int argc, char* argv[]) if (std::strcmp(name, "(none)") == 0) name = nullptr; + if (std::strlen(label) == 0) + label = nullptr; + char bridgeBaseAudioName[6+1] = { 0 }; char bridgeBaseControlName[6+1] = { 0 }; @@ -495,8 +498,19 @@ int main(int argc, char* argv[]) QApplication app(argc, argv, true); app.setQuitOnLastWindowClosed(false); + CarlaString clientName((name != nullptr) ? name : label); + + if (clientName.isEmpty()) + { + QFileInfo fileinfo(filename); + clientName = fileinfo.baseName().toUtf8().constData(); + } + + if (itype >= CarlaBackend::PLUGIN_GIG && itype <= CarlaBackend::PLUGIN_SFZ && label == nullptr) + label = clientName; + // Init Plugin client - CarlaPluginClient client(useBridge, (name != nullptr) ? name : label, bridgeBaseAudioName, bridgeBaseControlName); + CarlaPluginClient client(useBridge, (const char*)clientName, bridgeBaseAudioName, bridgeBaseControlName); // Init OSC if (useOsc)