diff --git a/plugins/Cardinal/res/Ildaeil.svg b/plugins/Cardinal/res/Ildaeil.svg
index 7c7a19c..bda08fd 100644
--- a/plugins/Cardinal/res/Ildaeil.svg
+++ b/plugins/Cardinal/res/Ildaeil.svg
@@ -9,9 +9,9 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="131.44501mm"
+ width="132.08mm"
height="128.5mm"
- viewBox="0 0 131.44501 128.5"
+ viewBox="0 0 132.08 128.5"
version="1.1"
id="svg4620"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
@@ -38,8 +38,8 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4142136"
- inkscape:cx="260.22565"
- inkscape:cy="198.9489"
+ inkscape:cx="211.24317"
+ inkscape:cy="346.0322"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
@@ -59,6 +59,7 @@
image/svg+xml
+
@@ -70,7 +71,7 @@
+ transform="matrix(6.342689,0,0,6.342689,4.2887574,175.6457)">
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/Cardinal/src/Ildaeil.cpp b/plugins/Cardinal/src/Ildaeil.cpp
index 49c85fa..30990f5 100644
--- a/plugins/Cardinal/src/Ildaeil.cpp
+++ b/plugins/Cardinal/src/Ildaeil.cpp
@@ -148,6 +148,13 @@ struct IldaeilModule : Module {
unsigned audioDataFill = 0;
int64_t lastBlockFrame = -1;
+ volatile bool resetMeterIn = true;
+ volatile bool resetMeterOut = true;
+ float meterInL = 0.0f;
+ float meterInR = 0.0f;
+ float meterOutL = 0.0f;
+ float meterOutR = 0.0f;
+
IldaeilModule()
: pcontext(static_cast(APP))
{
@@ -418,15 +425,37 @@ struct IldaeilModule : Module {
audioDataFill = 0;
float* ins[2] = { audioDataIn1, audioDataIn2 };
float* outs[2] = { audioDataOut1, audioDataOut2 };
+
+ if (resetMeterIn)
+ meterInL = meterInR = 0.0f;
+
+ meterInL = std::max(meterInL, d_findMaxNormalizedFloat(audioDataIn1, BUFFER_SIZE));
+ meterInR = std::max(meterInR, d_findMaxNormalizedFloat(audioDataIn2, BUFFER_SIZE));
+
fCarlaPluginDescriptor->process(fCarlaPluginHandle, ins, outs, BUFFER_SIZE, midiEvents, midiEventCount);
+
+ if (resetMeterOut)
+ meterOutL = meterOutR = 0.0f;
+
+ meterOutL = std::max(meterOutL, d_findMaxNormalizedFloat(audioDataOut1, BUFFER_SIZE));
+ meterOutR = std::max(meterOutR, d_findMaxNormalizedFloat(audioDataOut2, BUFFER_SIZE));
+
+ resetMeterIn = resetMeterOut = false;
}
}
+ void onReset() override
+ {
+ resetMeterIn = resetMeterOut = true;
+ }
+
void onSampleRateChange(const SampleRateChangeEvent& e) override
{
if (fCarlaPluginHandle == nullptr)
return;
+ resetMeterIn = resetMeterOut = true;
+
fCarlaPluginDescriptor->deactivate(fCarlaPluginHandle);
fCarlaPluginDescriptor->dispatcher(fCarlaPluginHandle, NATIVE_PLUGIN_OPCODE_SAMPLE_RATE_CHANGED,
0, 0, nullptr, e.sampleRate);
@@ -1520,6 +1549,44 @@ static void projectLoadedFromDSP(void* const ui)
// --------------------------------------------------------------------------------------------------------------------
+struct IldaeilNanoMeterIn : NanoMeter {
+ IldaeilModule* const module;
+
+ IldaeilNanoMeterIn(IldaeilModule* const m)
+ : module(m) {}
+
+ void updateMeters() override
+ {
+ if (module == nullptr || module->resetMeterIn)
+ return;
+
+ // Only fetch new values once DSP side is updated
+ gainMeterL = module->meterInL;
+ gainMeterR = module->meterInR;
+ module->resetMeterIn = true;
+ }
+};
+
+struct IldaeilNanoMeterOut : NanoMeter {
+ IldaeilModule* const module;
+
+ IldaeilNanoMeterOut(IldaeilModule* const m)
+ : module(m) {}
+
+ void updateMeters() override
+ {
+ if (module == nullptr || module->resetMeterOut)
+ return;
+
+ // Only fetch new values once DSP side is updated
+ gainMeterL = module->meterOutL;
+ gainMeterR = module->meterOutR;
+ module->resetMeterOut = true;
+ }
+};
+
+// --------------------------------------------------------------------------------------------------------------------
+
struct IldaeilModuleWidget : ModuleWidgetWithSideScrews<26> {
bool hasLeftSideExpander = false;
IldaeilWidget* ildaeilWidget = nullptr;
@@ -1543,6 +1610,16 @@ struct IldaeilModuleWidget : ModuleWidgetWithSideScrews<26> {
for (uint i=0; ibox.pos = Vec(2.0f, startY + padding * 2);
+ meterIn->box.size = Vec(RACK_GRID_WIDTH * 3 - 2.0f, box.size.y - meterIn->box.pos.y - 20.0f);
+ addChild(meterIn);
+
+ IldaeilNanoMeterOut* const meterOut = new IldaeilNanoMeterOut(module);
+ meterOut->box.pos = Vec(box.size.x - RACK_GRID_WIDTH * 3 + 1.0f, startY + padding * 2);
+ meterOut->box.size = Vec(RACK_GRID_WIDTH * 3 - 2.0f, box.size.y - meterOut->box.pos.y - 20.0f);
+ addChild(meterOut);
}
void draw(const DrawArgs& args) override
@@ -1569,7 +1646,7 @@ struct IldaeilModuleWidget : ModuleWidgetWithSideScrews<26> {
}
}
- ModuleWidgetWithSideScrews::draw(args);
+ ModuleWidgetWithSideScrews<26>::draw(args);
}
void step() override
@@ -1578,7 +1655,7 @@ struct IldaeilModuleWidget : ModuleWidgetWithSideScrews<26> {
&& module->leftExpander.module != nullptr
&& module->leftExpander.module->model == modelExpanderInputMIDI;
- ModuleWidgetWithSideScrews::step();
+ ModuleWidgetWithSideScrews<26>::step();
}
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(IldaeilModuleWidget)