BogaudioModules

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

commit 81845436497cd8d74e6339e970ef9555bc93c9e6
parent 5e32bafc51fff9bda97512111fea3e4b8db670da
Author: Matt Demanett <matt@demanett.net>
Date:   Thu, 20 Aug 2020 21:28:52 -0400

RANALYZER: drop goofy "analysis" plot. #116

Diffstat:
MREADME-prerelease.md | 6+-----
Msrc/Ranalyzer.cpp | 10++++++++++
2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/README-prerelease.md b/README-prerelease.md @@ -870,11 +870,7 @@ RANALYZER is a frequency response analyzer: it passes a test signal to another m **This module is primarily useful to plugin developers**, especially when developing filters. Of course anyone may use it, to investigate the response of some module, or to tune a filter bank, or what have you. -By default, will produce a one-shot test signal, emitted at SEND, upon receipt of a trigger (manual or CV) at the TRIG inputs. The duration of the test signal is always 16384 samples; thus the duration in time will depend on Rack's current sample rate. The same number of samples is collected from RETURN, if it is patched. Both signals are converted to the frequency domain, and a third "analysis" signal is generated by dividing the spectrum of the response signal by the spectrum of the test signal. - -By default, the module displays all three spectral signals (test in green, response in magenta, analysis in orange); a context menu option sets it to display only the analysis signal. - -Note that the amplitude of the analysis signal plot is basically arbitrary, without any real relation to the amplitudes of the test and response signals. +By default, will produce a one-shot test signal, emitted at SEND, upon receipt of a trigger (manual or CV) at the TRIG inputs. The duration of the test signal is always 16384 samples; thus the duration in time will depend on Rack's current sample rate. The same number of samples is collected from RETURN, if it is patched. Both signals are converted to the frequency domain and displayed (test in green, response in magenta). The test signal is a swept sine wave (or "chirp", see <a href="#chirp">CHIRP</a>), with an exponential (if the EXP toggle is on) or linear sweep. The start and end frequencies for sine sweep are set by the FREQ1 and FREQ2 knobs, each with a range in hertz from 1 to the Nyquist rate (half the sampling rate); if FREQ1 is less than FREQ2 the sweep is upwards in frequency, downwards otherwise. diff --git a/src/Ranalyzer.cpp b/src/Ranalyzer.cpp @@ -1,6 +1,8 @@ #include "Ranalyzer.hpp" +// #define ANALYSIS_TRACE 1 + #define RANGE_KEY "range" #define RANGE_DB_KEY "range_db" #define DISPLAY_ALL "display_all" @@ -25,7 +27,9 @@ void Ranalyzer::sampleRateChange() { json_t* Ranalyzer::toJson(json_t* root) { json_object_set_new(root, RANGE_KEY, json_real(_range)); json_object_set_new(root, RANGE_DB_KEY, json_real(_rangeDb)); +#ifdef ANALYSIS_TRACE json_object_set_new(root, DISPLAY_ALL, json_boolean(_displayAll)); +#endif return root; } @@ -40,10 +44,12 @@ void Ranalyzer::fromJson(json_t* root) { _rangeDb = clamp(json_real_value(jrd), 80.0f, 140.0f); } +#ifdef ANALYSIS_TRACE json_t* da = json_object_get(root, DISPLAY_ALL); if (da) { setDisplayAll(json_boolean_value(da)); } +#endif } void Ranalyzer::modulate() { @@ -181,10 +187,12 @@ struct RanalyzerWidget : BGModuleWidget { auto display = new RanalyzerDisplay(module, size, false); display->box.pos = inset; display->box.size = size; +#ifdef ANALYSIS_TRACE if (module) { display->setChannelBinsReader(2, new AnalysisBinsReader(module)); module->setChannelDisplayListener(display); } +#endif addChild(display); } @@ -256,12 +264,14 @@ struct RanalyzerWidget : BGModuleWidget { mi->addItem(OptionMenuItem("To -120dB", [a]() { return a->_rangeDb == 140.0f; }, [a]() { a->_rangeDb = 140.0f; })); OptionsMenuItem::addToMenu(mi, menu); } +#ifdef ANALYSIS_TRACE { OptionsMenuItem* mi = new OptionsMenuItem("Display traces"); mi->addItem(OptionMenuItem("All", [a]() { return a->_displayAll; }, [a]() { a->setDisplayAll(true); })); mi->addItem(OptionMenuItem("Analysis only", [a]() { return !a->_displayAll; }, [a]() { a->setDisplayAll(false); })); OptionsMenuItem::addToMenu(mi, menu); } +#endif } };