AnalogTapeModel

Physical modelling signal processing for analog tape recording
Log | Files | Refs | Submodules | README | LICENSE

commit bc75dd275f7ab8183eacdb9b0aa09220ecfff76c
parent efd27aebc809343989b1def831c24fefd3edf208
Author: jatinchowdhury18 <jatinchowdhury18@gmail.com>
Date:   Sun, 25 Oct 2020 11:29:52 -0700

Add circle visualizer for mix groups (#100)

Co-authored-by: jatinchowdhury18 <jatinchowdhury18@users.noreply.github.com>
Diffstat:
MCHANGELOG.md | 3+++
MPlugin/CHOWTapeModel.jucer | 2++
MPlugin/Source/GUI/Assets/gui.xml | 28++++++++++++++++------------
APlugin/Source/GUI/MixGroupViz.cpp | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
APlugin/Source/GUI/MixGroupViz.h | 48++++++++++++++++++++++++++++++++++++++++++++++++
MPlugin/Source/PluginProcessor.cpp | 2++
6 files changed, 131 insertions(+), 12 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. +## [Unreleased] +- Added coloured circle on bottom bar to visualize mix group + ## [2.6.0] - 2020-09-29 - Added Pre/post emphasis filters for the hysteresis stage. - Added "mix groups" to allow instances of the plugin to be synced across a mix. diff --git a/Plugin/CHOWTapeModel.jucer b/Plugin/CHOWTapeModel.jucer @@ -24,6 +24,8 @@ <FILE id="u8IfBD" name="AutoUpdating.h" compile="0" resource="0" file="Source/GUI/AutoUpdating.h"/> <FILE id="rOj90C" name="InfoComp.cpp" compile="1" resource="0" file="Source/GUI/InfoComp.cpp"/> <FILE id="FxvDV3" name="InfoComp.h" compile="0" resource="0" file="Source/GUI/InfoComp.h"/> + <FILE id="SYzWcj" name="MixGroupViz.cpp" compile="1" resource="0" file="Source/GUI/MixGroupViz.cpp"/> + <FILE id="YzAgWK" name="MixGroupViz.h" compile="0" resource="0" file="Source/GUI/MixGroupViz.h"/> <FILE id="IgOtsG" name="MyLNF.cpp" compile="1" resource="0" file="Source/GUI/MyLNF.cpp"/> <FILE id="pj6eEc" name="MyLNF.h" compile="0" resource="0" file="Source/GUI/MyLNF.h"/> <FILE id="WfCYvA" name="TitleComp.cpp" compile="1" resource="0" file="Source/GUI/TitleComp.cpp"/> diff --git a/Plugin/Source/GUI/Assets/gui.xml b/Plugin/Source/GUI/Assets/gui.xml @@ -55,8 +55,8 @@ <View display="tabbed" padding="0" background-color="FF31323A" lookAndFeel="MyLNF"> <View flex-direction="column" tab-color="" background-color="FF31323A" padding="0" tab-caption="Tape"> - <Slider caption="Bias" parameter="width" class="Slider" name="Bias" - padding="0" margin="0" tooltip="Controls the amount of bias used by the tape recorder. Turning down the bias can create &quot;deadzone&quot; distortion."/> + <Slider caption="Bias" parameter="width" class="Slider" name="Bias" padding="0" + margin="0" tooltip="Controls the amount of bias used by the tape recorder. Turning down the bias can create &quot;deadzone&quot; distortion."/> <Slider caption="Saturation" parameter="sat" class="Slider" name="Saturation" padding="0" margin="0" tooltip="Controls the amount of tape saturation applied to the signal."/> <Slider caption="Drive" parameter="drive" class="Slider" name="Drive" @@ -106,12 +106,12 @@ padding="0" margin="0" tooltip="Sets the variance of the tape degradation. Use lower values for uniform degradation, or higher values for variation across different sections of tape."/> </View> <View tab-caption="CHEW" padding="0" flex-direction="column" background-color="FF31323A"> - <Slider parameter="chew_depth" caption="Depth" padding="0" margin="0" class="Slider" - name="Chew Depth" tooltip="Controls how intensely the tape has been chewed up."/> - <Slider caption="Frequency" parameter="chew_freq" padding="0" margin="0" class="Slider" - name="Chew Frequency" tooltip="Controls the amount of time in between chewed-up sections of tape."/> - <Slider caption="Variance" parameter="chew_var" padding="0" margin="0" class="Slider" - name="Chew Variance" tooltip="Controls the amount of variance in the chew frequency."/> + <Slider parameter="chew_depth" caption="Depth" padding="0" margin="0" + class="Slider" name="Chew Depth" tooltip="Controls how intensely the tape has been chewed up."/> + <Slider caption="Frequency" parameter="chew_freq" padding="0" margin="0" + class="Slider" name="Chew Frequency" tooltip="Controls the amount of time in between chewed-up sections of tape."/> + <Slider caption="Variance" parameter="chew_var" padding="0" margin="0" + class="Slider" name="Chew Variance" tooltip="Controls the amount of variance in the chew frequency."/> </View> </View> <View display="tabbed" padding="0" background-color="FF31323A" lookAndFeel="MyLNF"> @@ -133,6 +133,7 @@ tooltip-text="FFFFFFFF"/> <View max-height="35" margin="0" padding="0" background-color="FF31323A" flex-grow="0.1"> + <View background-color="00000000" flex-grow="0.1"/> <ComboBox caption="Oversampling" parameter="os" class="Slider" caption-size="0" padding="0" combo-text="FFEAA92C" combo-background="00000000" max-height="100" margin="" lookAndFeel="ComboBoxLNF" name="Oversampling" @@ -141,13 +142,16 @@ name="Hysteresis Mode" caption="Hysteresis Mode" caption-size="0" combo-text="FFEAA92C" caption-color="FFFFFFFF" max-height="100" margin="" parameter="mode" combo-background="00000000" tooltip="Selects the mode to use for hysteresis processing. Choose between 2nd/4th order Runge-Kutta method, 4 or 8 Newton-Raphson iterations, or revert to version 1.0."/> + <View flex-grow="0.1" background-color="00000000"/> <ComboBox lookAndFeel="ComboBoxLNF" padding="0" border="0" background-color="00000000" - name="Mix Group" caption="Mix Group" caption-size="0" flex-grow="0.9" - combo-text="FFEAA92C" caption-color="FFFFFFFF" max-height="100" margin="0" - parameter="mix_group" combo-background="00000000" tooltip="Adds this plugin to a mix group. When the plugin is added to a group, the group parameters will be copied to this plugin, and their parameters will remain in sync."/> + name="Mix Group" caption="Mix Group" caption-size="0" flex-grow="0.85" + combo-text="FFEAA92C" caption-color="FFFFFFFF" max-height="100" + margin="0" parameter="mix_group" combo-background="00000000" + tooltip="Adds this plugin to a mix group. When the plugin is added to a group, the group parameters will be copied to this plugin, and their parameters will remain in sync."/> + <MixGroupViz flex-grow="0.3" margin="5" padding="0" background-color="00000000"/> <presets margin="5" padding="0" background-color="00000000" border-color="595C6B" radius="" border="" lookAndFeel="ComboBoxLNF" tooltip="Selects a preset for the plugin." - flex-grow="1.75" max-height="100"/> + flex-grow="1.9" max-height="100"/> </View> </View> </magic> diff --git a/Plugin/Source/GUI/MixGroupViz.cpp b/Plugin/Source/GUI/MixGroupViz.cpp @@ -0,0 +1,60 @@ +#include "MixGroupViz.h" + +MixGroupViz::MixGroupViz (AudioProcessorParameter* mixGroupParam) : + mixGroupParam (mixGroupParam) +{ + mixGroupParam->addListener (this); + setMixGroupColour (int (mixGroupParam->getValue() * MixGroupsConstants::numMixGroups)); +} + +MixGroupViz::~MixGroupViz() +{ + mixGroupParam->removeListener (this); +} + +void MixGroupViz::parameterValueChanged (int, float newValue) +{ + setMixGroupColour (int (newValue * MixGroupsConstants::numMixGroups)); +} + +void MixGroupViz::setMixGroupColour (int mixGroupIdx) +{ + switch (mixGroupIdx) + { + case 0: + circleColour = Colour (0x00000000); // no circle + break; + + case 1: + circleColour = Colour (0xFF8B3232); // red + break; + + case 2: + circleColour = Colour (0xFFEAA92C); // orange + break; + + case 3: + circleColour = Colour (0xFF9CBCBD); // grey/blue + break; + + case 4: + circleColour = Colour (0xFFBDB09C); // beige + break; + + default: + circleColour = Colour (0x00000000); + }; + + repaint(); +} + +void MixGroupViz::paint (Graphics& g) +{ + const auto height = float (getHeight() - getPosition().getY()); + const auto centre = Point<int> (getWidth() / 2, getHeight() / 2).toFloat(); + auto bounds = Rectangle<float> (height, height) + .withCentre (centre); + + g.setColour (circleColour); + g.fillEllipse (bounds); +} diff --git a/Plugin/Source/GUI/MixGroupViz.h b/Plugin/Source/GUI/MixGroupViz.h @@ -0,0 +1,48 @@ +#ifndef MIXGROUPVIZ_H_INCLUDED +#define MIXGROUPVIZ_H_INCLUDED + +#include <JuceHeader.h> +#include "../MixGroups/MixGroupsController.h" + +class MixGroupViz : public Component, + private AudioProcessorParameter::Listener +{ +public: + MixGroupViz (AudioProcessorParameter* mixGroupParam); + ~MixGroupViz(); + + void parameterValueChanged (int parameterIndex, float newValue) override; + void parameterGestureChanged (int, bool) override {} + void paint (Graphics& g) override; + void setMixGroupColour (int mixGroupIdx); + +private: + Colour circleColour; + AudioProcessorParameter* mixGroupParam; + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MixGroupViz) +}; + +class MixGroupVizItem : public foleys::GuiItem +{ +public: + FOLEYS_DECLARE_GUI_FACTORY (MixGroupVizItem) + + MixGroupVizItem (foleys::MagicGUIBuilder& builder, const ValueTree& node) : + foleys::GuiItem (builder, node), + viz (builder.getMagicState().getParameter (MixGroupsConstants::mixGroupParamID)) + { + addAndMakeVisible (viz); + } + + void update() override { viz.repaint(); } + Component* getWrappedComponent() override { return &viz; } + +private: + MixGroupViz viz; + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MixGroupVizItem) +}; + +#endif // !MIXGROUPVIZ_H_INCLUDED + diff --git a/Plugin/Source/PluginProcessor.cpp b/Plugin/Source/PluginProcessor.cpp @@ -12,6 +12,7 @@ #include "GUI/InfoComp.h" #include "GUI/TitleComp.h" #include "GUI/TooltipComp.h" +#include "GUI/MixGroupViz.h" //============================================================================== ChowtapeModelAudioProcessor::ChowtapeModelAudioProcessor() @@ -263,6 +264,7 @@ AudioProcessorEditor* ChowtapeModelAudioProcessor::createEditor() builder->registerFactory ("TooltipComp", &TooltipItem::factory); builder->registerFactory ("InfoComp", &InfoItem::factory); builder->registerFactory ("TitleComp", &TitleItem::factory); + builder->registerFactory ("MixGroupViz", &MixGroupVizItem::factory); builder->registerJUCELookAndFeels(); builder->registerLookAndFeel ("MyLNF", std::make_unique<MyLNF>());