From ff5f9f62851240131422d5da7f770379339b57a1 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 31 Oct 2021 09:46:36 +0000 Subject: [PATCH] Tests to fetch info from module Signed-off-by: falkTX --- lv2export/Makefile | 1 + lv2export/dep2.cpp | 7 +++++++ lv2export/test.cpp | 29 ++++++++++++++++++++++++++++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/lv2export/Makefile b/lv2export/Makefile index 3763171..7b1bffc 100644 --- a/lv2export/Makefile +++ b/lv2export/Makefile @@ -112,6 +112,7 @@ BUILD_FILES += ../src/Rack/src/logger.cpp BUILD_FILES += ../src/Rack/src/random.cpp BUILD_FILES += ../src/Rack/src/string.cpp BUILD_FILES += ../src/Rack/src/system.cpp +BUILD_FILES += ../src/Rack/src/tinyexpr.c BUILD_FILES += ../src/Rack/src/Quantity.cpp BUILD_FILES += ../src/Rack/src/engine/Module.cpp BUILD_FILES += ../src/Rack/src/engine/ParamQuantity.cpp diff --git a/lv2export/dep2.cpp b/lv2export/dep2.cpp index 4147c02..3baf360 100644 --- a/lv2export/dep2.cpp +++ b/lv2export/dep2.cpp @@ -168,6 +168,13 @@ void SvgSlider::onChange(const ChangeEvent& e) {} } +namespace engine { + +std::string LightInfo::getName() { return name; } +std::string LightInfo::getDescription() { return description; } + +} + namespace widget { FramebufferWidget::FramebufferWidget() {} diff --git a/lv2export/test.cpp b/lv2export/test.cpp index ba7a7b6..fc323b8 100644 --- a/lv2export/test.cpp +++ b/lv2export/test.cpp @@ -79,7 +79,34 @@ int main() Plugin* const p = new Plugin; pluginInstance__Befaco = p; p->addModel(modelSpringReverb); + engine::Module* module = modelSpringReverb->createModule(); - d_stdout("modelSpringReverb is %p", modelSpringReverb); + d_stdout("modelSpringReverb is %p %p", modelSpringReverb, module); + d_stdout("modelSpringReverb has %d ins, %d outs, %d lights, %d params", + module->getNumInputs(), module->getNumOutputs(), module->getNumLights(), module->getNumParams()); + + for (int i=0; igetNumInputs(); ++i) + d_stdout(" in %d has name '%s'; description '%s'", + i+1, module->getInputInfo(i)->getFullName().c_str(), module->getInputInfo(i)->getDescription().c_str()); + + for (int i=0; igetNumOutputs(); ++i) + d_stdout(" out %d has name '%s'; description '%s'", + i+1, module->getOutputInfo(i)->getFullName().c_str(), module->getOutputInfo(i)->getDescription().c_str()); + +// for (int i=0; igetNumLights(); ++i) +// { +// LightInfo* l = module->getLightInfo(i); +// DISTRHO_SAFE_ASSERT_CONTINUE(l != nullptr); +// d_stdout(" light %d has name '%s'; description '%s'", +// i+1, l->getName().c_str(), l->getDescription().c_str()); +// } + + for (int i=0; igetNumParams(); ++i) + { + ParamQuantity* q = module->getParamQuantity(i); + d_stdout(" param %d has name '%s'; description '%s'; unit '%s'; min %f; max %f; def %f", + i+1, q->name.c_str(), q->getDescription().c_str(), q->unit.c_str(), + q->minValue, q->maxValue, q->defaultValue); + } return 0; }