BogaudioModules

BogaudioModules for VCV Rack
Log | Files | Refs | README | LICENSE

commit 734441f045be4fd79c6cb890b3151490ad6e4edf
parent 7d4d13386f889d9f23d4200861feac69ad9fd9ca
Author: Matt Demanett <matt@demanett.net>
Date:   Thu, 29 Mar 2018 01:42:40 -0400

Analyzer: thrus work even when powered off; grid lines etc draw if on but no input.

Diffstat:
Msrc/Analyzer.cpp | 23+++++++++++------------
Msrc/Analyzer.hpp | 1+
2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/Analyzer.cpp b/src/Analyzer.cpp @@ -127,15 +127,15 @@ void Analyzer::step() { resetChannels(); } - bool running = params[POWER_PARAM].value == 1.0; - stepChannel(_channelA, running, inputs[SIGNALA_INPUT], outputs[SIGNALA_OUTPUT]); - stepChannel(_channelB, running, inputs[SIGNALB_INPUT], outputs[SIGNALB_OUTPUT]); - stepChannel(_channelC, running, inputs[SIGNALC_INPUT], outputs[SIGNALC_OUTPUT]); - stepChannel(_channelD, running, inputs[SIGNALD_INPUT], outputs[SIGNALD_OUTPUT]); - - lights[QUALITY_HIGH_LIGHT].value = running && quality == QUALITY_HIGH; - lights[QUALITY_GOOD_LIGHT].value = running && quality == QUALITY_GOOD; - lights[POWER_ON_LIGHT].value = running; + _running = params[POWER_PARAM].value == 1.0; + stepChannel(_channelA, _running, inputs[SIGNALA_INPUT], outputs[SIGNALA_OUTPUT]); + stepChannel(_channelB, _running, inputs[SIGNALB_INPUT], outputs[SIGNALB_OUTPUT]); + stepChannel(_channelC, _running, inputs[SIGNALC_INPUT], outputs[SIGNALC_OUTPUT]); + stepChannel(_channelD, _running, inputs[SIGNALD_INPUT], outputs[SIGNALD_OUTPUT]); + + lights[QUALITY_HIGH_LIGHT].value = _running && quality == QUALITY_HIGH; + lights[QUALITY_GOOD_LIGHT].value = _running && quality == QUALITY_GOOD; + lights[POWER_ON_LIGHT].value = _running; } void Analyzer::stepChannel(ChannelAnalyzer*& channelPointer, bool running, Input& input, Output& output) { @@ -160,7 +160,7 @@ void Analyzer::stepChannel(ChannelAnalyzer*& channelPointer, bool running, Input channelPointer = NULL; } - output.value = 0.0; + output.value = input.value; } } @@ -213,8 +213,7 @@ struct AnalyzerDisplay : TransparentWidget { void AnalyzerDisplay::draw(NVGcontext* vg) { drawBackground(vg); - - if (_module->_channelA || _module->_channelB || _module->_channelC || _module->_channelD) { + if (_module->_running) { float strokeWidth = std::max(1.0f, 3 - gRackScene->zoomWidget->zoom); nvgSave(vg); nvgScissor(vg, _insetAround, _insetAround, _size.x - _insetAround, _size.y - _insetAround); diff --git a/src/Analyzer.hpp b/src/Analyzer.hpp @@ -48,6 +48,7 @@ struct Analyzer : Module { QUALITY_GOOD }; + bool _running = false; int _averageN; ChannelAnalyzer* _channelA = NULL; ChannelAnalyzer* _channelB = NULL;