From adee5b94efa46908df6a25041b1d9b334a7b4f95 Mon Sep 17 00:00:00 2001 From: kockie69 Date: Tue, 28 Sep 2021 09:57:37 +0100 Subject: [PATCH] Ready for first v2 release --- plugin.json | 2 +- src/Display.cpp | 7 ++++--- src/RPJ.hpp | 10 ++++++++++ src/TuxOn.cpp | 37 ++++++++++++++++++++++++++++++++++++- src/VuMeters.cpp | 5 +++-- 5 files changed, 54 insertions(+), 7 deletions(-) diff --git a/plugin.json b/plugin.json index 7706eba..57f1476 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "slug": "RPJ", "name": "RPJ", - "version": "2.0.5", + "version": "2.0.0", "license": "GPL-3.0-or-later", "brand": "RPJ", "author": "Robert Kock", diff --git a/src/Display.cpp b/src/Display.cpp index 65eb982..a54b149 100644 --- a/src/Display.cpp +++ b/src/Display.cpp @@ -28,16 +28,18 @@ void Display::setEnd(float endRatio) { } void Display::setDisplayBuff(float begin, float end, vector> playBuffer) { - if (((end-begin)/width)>=1) { + if (abs(((end-begin)/width))>=1) { vector().swap(displayBuff); + for (int i=floor(begin); i < floor(end); i = i + floor((end-begin)/width)) { + float q = playBuffer[0][i]; displayBuff.push_back(playBuffer[0][i]); } } - float q = displayBuff.size(); } void Display::draw(const DrawArgs &args) { + nvgGlobalTint(args.vg, color::WHITE); if (fontPath!="") { std::shared_ptr font = APP->window->loadFont(fontPath); nvgFontSize(args.vg, 12); @@ -102,7 +104,6 @@ void Display::draw(const DrawArgs &args) { for (unsigned int i = 0; i < displayBuff.size(); i++) { float x, y; x = (float)i / (displayBuff.size() - 1); - float q = displayBuff.size(); y = displayBuff[i] + 0.5; Vec p; p.x = b.pos.x + b.size.x * x; diff --git a/src/RPJ.hpp b/src/RPJ.hpp index 624130f..8759dd9 100644 --- a/src/RPJ.hpp +++ b/src/RPJ.hpp @@ -76,6 +76,11 @@ struct buttonPlusSmall : SvgSwitch { addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ButtonPlus_0.svg"))); addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ButtonPlus_1.svg"))); } + + void draw(const DrawArgs &args)override { + nvgGlobalTint(args.vg, color::WHITE); + SvgSwitch::draw(args); + } }; struct buttonMinSmall : SvgSwitch { @@ -84,6 +89,11 @@ struct buttonMinSmall : SvgSwitch { addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ButtonMin_0.svg"))); addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ButtonMin_1.svg"))); } + + void draw(const DrawArgs &args)override { + nvgGlobalTint(args.vg, color::WHITE); + SvgSwitch::draw(args); + } }; diff --git a/src/TuxOn.cpp b/src/TuxOn.cpp index 925b986..db6aa98 100644 --- a/src/TuxOn.cpp +++ b/src/TuxOn.cpp @@ -107,7 +107,6 @@ void TuxOn::process(const ProcessArgs &args) { adp.begin = getBegin(); adp.end = getEnd(); - if (params[PARAM_FWD].getValue()) audio.forward(stepSize()); if (params[PARAM_RWD].getValue()) @@ -148,6 +147,11 @@ void TuxOn::process(const ProcessArgs &args) { if (zoominTrigger.process((bool)params[PARAM_ZOOMIN].getValue())) { + if (endRatio < beginRatio) { + float temp = beginRatio; + beginRatio = endRatio; + endRatio = temp; + } zoom++; zoomParameters.push_back(zoomParameter()); zoomParameters[zoom].begin=zoomParameters[zoom-1].begin+zoomParameters[zoom-1].totalPCMFrameCount*beginRatio/1024; @@ -200,6 +204,11 @@ struct StartButton : SvgSwitch { addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Buttons/Start_Off.svg"))); addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Buttons/Start_On.svg"))); } + + void draw(const DrawArgs &args)override { + nvgGlobalTint(args.vg, color::WHITE); + SvgSwitch::draw(args); + } }; struct StopButton : SvgSwitch { @@ -209,6 +218,11 @@ struct StopButton : SvgSwitch { addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Buttons/Stop_Off.svg"))); addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Buttons/Stop_On.svg"))); } + + void draw(const DrawArgs &args)override { + nvgGlobalTint(args.vg, color::WHITE); + SvgSwitch::draw(args); + } }; struct PauseButton : SvgSwitch { @@ -217,6 +231,11 @@ struct PauseButton : SvgSwitch { addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Buttons/Pause_Off.svg"))); addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Buttons/Pause_On.svg"))); } + + void draw(const DrawArgs &args)override { + nvgGlobalTint(args.vg, color::WHITE); + SvgSwitch::draw(args); + } }; @@ -226,6 +245,11 @@ struct FwdButton : SvgSwitch { addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Buttons/Fwd_Off.svg"))); addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Buttons/Fwd_On.svg"))); } + + void draw(const DrawArgs &args)override { + nvgGlobalTint(args.vg, color::WHITE); + SvgSwitch::draw(args); + } }; struct RwdButton : SvgSwitch { @@ -234,6 +258,11 @@ struct RwdButton : SvgSwitch { addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Buttons/Rwd_Off.svg"))); addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Buttons/Rwd_On.svg"))); } + + void draw(const DrawArgs &args)override { + nvgGlobalTint(args.vg, color::WHITE); + SvgSwitch::draw(args); + } }; struct EjectButton : SvgSwitch { @@ -242,6 +271,11 @@ struct EjectButton : SvgSwitch { addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Buttons/Ejct_Off.svg"))); addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Buttons/Ejct_On.svg"))); } + + void draw(const DrawArgs &args)override { + nvgGlobalTint(args.vg, color::WHITE); + SvgSwitch::draw(args); + } }; @@ -272,6 +306,7 @@ void ButtonSVG::addFrame(std::shared_ptr svg) { } void ButtonSVG::draw(const DrawArgs &args) { + nvgGlobalTint(args.vg, color::WHITE); if (module) { // Bit weird check, shouldn't that be module->start ? if (!(module->buttonToDisplay == START && !module->audio.fileLoaded)) { diff --git a/src/VuMeters.cpp b/src/VuMeters.cpp index 4613b01..73ff53e 100644 --- a/src/VuMeters.cpp +++ b/src/VuMeters.cpp @@ -44,11 +44,13 @@ void VuMeterBase::processPeakHold() {// use APP->window->getLastFrameRate() } void VuMeterBase::draw(const DrawArgs &args) { - + processPeakHold(); setColor(); + nvgGlobalTint(args.vg, color::WHITE); + // PEAK drawVu(args, VuMeterAllDual::getPeak(srcLevels, 0), 0, 0); drawVu(args, VuMeterAllDual::getPeak(srcLevels, 1), barX + gapX, 0); @@ -61,7 +63,6 @@ void VuMeterBase::draw(const DrawArgs &args) { drawPeakHold(args, peakHold[0], 0); drawPeakHold(args, peakHold[1], barX + gapX); - Widget::draw(args); }