commit 0eecad3612fa499ea72e968ecd2a45b92e10e7aa
parent a758f09886b9c4da2d881c01e4cf6a9a94cc096f
Author: Matt Demanett <matt@demanett.net>
Date: Fri, 1 Oct 2021 21:10:14 -0400
Rack2: for nightmode, when modules are bypassed, disable drawing displays or "lights" on LED-like widgets.
Diffstat:
10 files changed, 61 insertions(+), 48 deletions(-)
diff --git a/src/Blank3.cpp b/src/Blank3.cpp
@@ -36,7 +36,7 @@ struct Blank3Display : OpaqueWidget {
std::string skin = skins.defaultKey();
bool haveLevel = false;
float level = 0.0f;
- if (_module) {
+ if (_module && !_module->isBypassed()) {
haveLevel = _module->_level;
level = _module->_level;
skin = _module->_skin;
diff --git a/src/Blank6.cpp b/src/Blank6.cpp
@@ -36,7 +36,7 @@ struct Blank6Display : OpaqueWidget {
std::string skin = skins.defaultKey();
bool haveLevel = false;
float level = 0.0f;
- if (_module) {
+ if (_module && !_module->isBypassed()) {
haveLevel = _module->_level;
level = _module->_level;
skin = _module->_skin;
diff --git a/src/Mono.cpp b/src/Mono.cpp
@@ -67,7 +67,7 @@ struct MonoWidget : BGModuleWidget {
nvgSave(args.vg);
for (int i = 0; i < _module->maxChannels; ++i) {
nvgBeginPath(args.vg);
- if (!_module || i >= _module->_activeChannels) {
+ if (!_module || _module->isBypassed() || i >= _module->_activeChannels) {
nvgFillColor(args.vg, inactiveBgColor);
}
else {
@@ -79,7 +79,7 @@ struct MonoWidget : BGModuleWidget {
nvgCircle(args.vg, (i % 4) * 10 + 5.0f, (i / 4) * 10 + 5.0f, 3.2f);
nvgFill(args.vg);
- if (_module && _module->_channelLevels[i] > 0.0f) {
+ if (_module && !_module->isBypassed() && _module->_channelLevels[i] > 0.0f) {
nvgSave(args.vg);
nvgGlobalTint(args.vg, color::WHITE);
nvgFillColor(args.vg, decibelsToColor(amplitudeToDecibels(_module->_channelLevels[i])));
@@ -113,7 +113,7 @@ struct MonoWidget : BGModuleWidget {
void draw(const DrawArgs& args) override {
float compressionDb = 0.0f;
- if (_module) {
+ if (_module && !_module->isBypassed()) {
compressionDb = _module->_compressionDb;
}
diff --git a/src/Pressor.cpp b/src/Pressor.cpp
@@ -214,7 +214,7 @@ struct PressorWidget : BGModuleWidget {
void draw(const DrawArgs& args) override {
float compressionDb = 0.0f;
- if (_module) {
+ if (_module && !_module->isBypassed()) {
compressionDb = _module->_compressionDb;
}
diff --git a/src/Reftone.cpp b/src/Reftone.cpp
@@ -132,18 +132,23 @@ void ReftoneDisplay::draw(const DrawArgs& args) {
}
nvgSave(args.vg);
- nvgGlobalTint(args.vg, color::WHITE);
- drawBackground(args);
- if (sharpFlat) {
- drawText(args, pitch, 3, 20, 28);
- drawText(args, sharpFlat, 16, 12, 16);
- drawText(args, octave.c_str(), 22, 20, 28);
+ if (_module && _module->isBypassed()) {
+ drawBackground(args);
}
else {
- drawCenteredText(args, (pitch + octave).c_str(), 20, 28);
+ nvgGlobalTint(args.vg, color::WHITE);
+ drawBackground(args);
+ if (sharpFlat) {
+ drawText(args, pitch, 3, 20, 28);
+ drawText(args, sharpFlat, 16, 12, 16);
+ drawText(args, octave.c_str(), 22, 20, 28);
+ }
+ else {
+ drawCenteredText(args, (pitch + octave).c_str(), 20, 28);
+ }
+ drawCenteredText(args, fine.c_str(), 32.5, 14);
+ drawCenteredText(args, frequency.c_str(), 45, 14);
}
- drawCenteredText(args, fine.c_str(), 32.5, 14);
- drawCenteredText(args, frequency.c_str(), 45, 14);
nvgRestore(args.vg);
}
diff --git a/src/VU.cpp b/src/VU.cpp
@@ -81,7 +81,7 @@ struct VUDisplay : OpaqueWidget {
float rDb = -100.0f;
float lPeakDb = -100.0f;
float rPeakDb = -100.0f;
- if (_module) {
+ if (_module && !_module->isBypassed()) {
lDb = amplitudeToDecibels(_module->_lLevel);
rDb = amplitudeToDecibels(_module->_rLevel);
lPeakDb = amplitudeToDecibels(_module->_lPeakLevel);
diff --git a/src/Walk2.cpp b/src/Walk2.cpp
@@ -229,7 +229,9 @@ struct Walk2Display : TransparentWidget {
float strokeWidth = std::max(1.0f, 3.0f - getZoom());
nvgSave(args.vg);
- nvgGlobalTint(args.vg, color::WHITE);
+ if (_module && !_module->isBypassed()) {
+ nvgGlobalTint(args.vg, color::WHITE);
+ }
drawBackground(args);
nvgScissor(args.vg, _insetAround, _insetAround, _drawSize.x / 2, _drawSize.y / 2);
if (_module && _module->_zoomOut) {
@@ -247,7 +249,7 @@ struct Walk2Display : TransparentWidget {
}
drawAxes(args, strokeWidth);
- if (_module) {
+ if (_module && !_module->isBypassed()) {
switch (_module->_traceColor) {
case Walk2::ORANGE_TRACE_COLOR: {
_traceColor = nvgRGBA(0xff, 0x80, 0x00, 0xee);
diff --git a/src/analyzer_base.cpp b/src/analyzer_base.cpp
@@ -488,12 +488,14 @@ void AnalyzerDisplay::draw(const DrawArgs& args) {
nvgGlobalTint(args.vg, color::WHITE);
drawBackground(args);
nvgScissor(args.vg, _insetAround, _insetAround, _size.x - _insetAround, _size.y - _insetAround);
- if (_module) {
- drawHeader(args, rangeMinHz, rangeMaxHz);
+ if (!_module || _module->isBypassed()) {
+ drawYAxis(args, strokeWidth, amplitudePlot);
+ drawXAxis(args, strokeWidth, frequencyPlot, rangeMinHz, rangeMaxHz);
}
- drawYAxis(args, strokeWidth, amplitudePlot);
- drawXAxis(args, strokeWidth, frequencyPlot, rangeMinHz, rangeMaxHz);
- if (_module) {
+ else {
+ drawHeader(args, rangeMinHz, rangeMaxHz);
+ drawYAxis(args, strokeWidth, amplitudePlot);
+ drawXAxis(args, strokeWidth, frequencyPlot, rangeMinHz, rangeMaxHz);
int freezeBinI = 0;
float freezeLowHz = 0.0f;
float freezeHighHz = 0.0f;
diff --git a/src/mixer.cpp b/src/mixer.cpp
@@ -114,7 +114,7 @@ void MuteButton::onButton(const event::Button& e) {
void MuteButton::draw(const DrawArgs& args) {
nvgSave(args.vg);
- if (getParamQuantity() && getParamQuantity()->getValue() > 0.0f) {
+ if (module && !module->isBypassed() && getParamQuantity() && getParamQuantity()->getValue() > 0.0f) {
nvgGlobalTint(args.vg, color::WHITE);
}
ToggleButton::draw(args);
@@ -178,7 +178,7 @@ void SoloMuteButton::onChange(const event::Change& e) {
void SoloMuteButton::draw(const DrawArgs& args) {
nvgSave(args.vg);
- if (getParamQuantity() && getParamQuantity()->getValue() > 0.0f) {
+ if (module && !module->isBypassed() && getParamQuantity() && getParamQuantity()->getValue() > 0.0f) {
nvgGlobalTint(args.vg, color::WHITE);
}
ParamWidget::draw(args);
diff --git a/src/widgets.cpp b/src/widgets.cpp
@@ -229,7 +229,7 @@ void IndicatorKnob::redraw() {
void IndicatorKnob::draw(const DrawArgs& args) {
nvgSave(args.vg);
- if (getParamQuantity() &&
+ if (module && !module->isBypassed() && getParamQuantity() &&
(getParamQuantity()->getValue() < -0.01f || getParamQuantity()->getValue() > 0.01f) &&
(!w->_drawColorsCB || w->_drawColorsCB()))
{
@@ -351,7 +351,7 @@ IndicatorButtonGreen9::IndicatorButtonGreen9() {
void IndicatorButtonGreen9::draw(const DrawArgs& args) {
nvgSave(args.vg);
- if (getParamQuantity() && getParamQuantity()->getValue() > 0.0f) {
+ if (module && !module->isBypassed() && getParamQuantity() && getParamQuantity()->getValue() > 0.0f) {
nvgGlobalTint(args.vg, color::WHITE);
}
SvgSwitch::draw(args);
@@ -497,7 +497,9 @@ void InvertingIndicatorButton::onChange(const event::Change& e) {
void InvertingIndicatorButton::draw(const DrawArgs& args) {
nvgSave(args.vg);
- if (getParamQuantity() && (getParamQuantity()->getValue() < -0.01f || getParamQuantity()->getValue() > 0.01f)) {
+ if (module && !module->isBypassed() && getParamQuantity() &&
+ (getParamQuantity()->getValue() < -0.01f || getParamQuantity()->getValue() > 0.01f))
+ {
nvgGlobalTint(args.vg, color::WHITE);
}
ParamWidget::draw(args);
@@ -571,28 +573,30 @@ void VUSlider::draw(const DrawArgs& args) {
stereo = true;
stereoDb = *_stereoVuLevel;
}
- if (db > 0.0f) {
- nvgSave(args.vg);
- nvgGlobalTint(args.vg, color::WHITE);
- nvgBeginPath(args.vg);
- if (stereo) {
- nvgRoundedRect(args.vg, 2, 4, stereo ? 7 : 14, 5, 1.0);
+ if (module && !module->isBypassed()) {
+ if (db > 0.0f) {
+ nvgSave(args.vg);
+ nvgGlobalTint(args.vg, color::WHITE);
+ nvgBeginPath(args.vg);
+ if (stereo) {
+ nvgRoundedRect(args.vg, 2, 4, stereo ? 7 : 14, 5, 1.0);
+ }
+ else {
+ nvgRoundedRect(args.vg, 2, 4, 14, 5, 1.0);
+ }
+ nvgFillColor(args.vg, decibelsToColor(amplitudeToDecibels(db)));
+ nvgFill(args.vg);
+ nvgRestore(args.vg);
}
- else {
- nvgRoundedRect(args.vg, 2, 4, 14, 5, 1.0);
+ if (stereo && stereoDb > 0.0f) {
+ nvgSave(args.vg);
+ nvgGlobalTint(args.vg, color::WHITE);
+ nvgBeginPath(args.vg);
+ nvgRoundedRect(args.vg, 9, 4, 7, 5, 1.0);
+ nvgFillColor(args.vg, decibelsToColor(amplitudeToDecibels(stereoDb)));
+ nvgFill(args.vg);
+ nvgRestore(args.vg);
}
- nvgFillColor(args.vg, decibelsToColor(amplitudeToDecibels(db)));
- nvgFill(args.vg);
- nvgRestore(args.vg);
- }
- if (stereo && stereoDb > 0.0f) {
- nvgSave(args.vg);
- nvgGlobalTint(args.vg, color::WHITE);
- nvgBeginPath(args.vg);
- nvgRoundedRect(args.vg, 9, 4, 7, 5, 1.0);
- nvgFillColor(args.vg, decibelsToColor(amplitudeToDecibels(stereoDb)));
- nvgFill(args.vg);
- nvgRestore(args.vg);
}
}
nvgRestore(args.vg);