diff --git a/Source/MonophonicComponent.cpp b/Source/MonophonicComponent.cpp
index 3f63dab..57f61b1 100644
--- a/Source/MonophonicComponent.cpp
+++ b/Source/MonophonicComponent.cpp
@@ -28,6 +28,7 @@
//==============================================================================
MonophonicComponent::MonophonicComponent (Magical8bitPlug2AudioProcessor& p)
+ : processor(p)
{
//[Constructor_pre] You can add your own custom stuff here..
//[/Constructor_pre]
@@ -43,13 +44,13 @@ MonophonicComponent::MonophonicComponent (Magical8bitPlug2AudioProcessor& p)
label->setBounds (0, 4, 150, 22);
- behaviorChoice.reset (new ChoiceComponent (p, "monophonicBehavior", "Behavior"));
+ behaviorChoice.reset (new ChoiceComponent (p, "monophonicBehavior_raw", "Behavior"));
addAndMakeVisible (behaviorChoice.get());
behaviorChoice->setName ("behavior selector");
behaviorChoice->setBounds (0, 28, 224, 26);
- intervalChoice.reset (new ChoiceComponent (p, "arpeggioIntervalType", "Interval"));
+ intervalChoice.reset (new ChoiceComponent (p, "arpeggioIntervalType_raw", "Interval"));
addAndMakeVisible (intervalChoice.get());
intervalChoice->setName ("interval selector");
@@ -61,6 +62,10 @@ MonophonicComponent::MonophonicComponent (Magical8bitPlug2AudioProcessor& p)
intervalSlider->setSliderStyle (juce::Slider::LinearHorizontal);
intervalSlider->setTextBoxStyle (juce::Slider::TextBoxRight, false, 50, 20);
+ portamentoSlider.reset (new SliderComponent (p, "portamentoTime", "Portamento"));
+ addAndMakeVisible (portamentoSlider.get());
+ portamentoSlider->setName ("portamento slider");
+
//[UserPreSize]
//[/UserPreSize]
@@ -70,6 +75,9 @@ MonophonicComponent::MonophonicComponent (Magical8bitPlug2AudioProcessor& p)
//[Constructor] You can add your own custom stuff here..
attc.reset (new SliderAttachment (p.parameters, "arpeggioIntervalSliderValue", *intervalSlider));
+ behaviorChoice->setListener(this);
+ intervalChoice->setListener(this);
+ updateVisibility();
//[/Constructor]
}
@@ -83,6 +91,7 @@ MonophonicComponent::~MonophonicComponent()
behaviorChoice = nullptr;
intervalChoice = nullptr;
intervalSlider = nullptr;
+ portamentoSlider = nullptr;
//[Destructor]. You can add your own custom destruction code here..
@@ -105,6 +114,7 @@ void MonophonicComponent::resized()
//[/UserPreResize]
intervalSlider->setBounds (getWidth() - (getWidth() - 420), 28, getWidth() - 420, 24);
+ portamentoSlider->setBounds (getWidth() - proportionOfWidth (0.5000f), 28, proportionOfWidth (0.5000f), 28);
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
@@ -112,6 +122,35 @@ void MonophonicComponent::resized()
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
+void MonophonicComponent::comboBoxChanged(juce::ComboBox *comboBoxThatHasChanged) {
+ updateVisibility();
+}
+
+void MonophonicComponent::updateVisibility()
+{
+ portamentoSlider->setVisible(false);
+ intervalSlider->setVisible(false);
+ intervalChoice->setVisible(false);
+
+ switch (processor.settingRefs.monophonicBehavior()) {
+ case kLegato:
+ portamentoSlider->setVisible(true);
+ break;
+ case kArpeggioUp:
+ case kArpeggioDown:
+ intervalChoice->setVisible(true);
+ switch (processor.settingRefs.apreggioIntervalType()) {
+ case kSlider:
+ intervalSlider->setVisible(true);
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+}
//[/MiscUserCode]
@@ -125,9 +164,10 @@ void MonophonicComponent::resized()
BEGIN_JUCER_METADATA
+ parentClasses="public Component, public ComboBox::Listener" constructorParams="Magical8bitPlug2AudioProcessor& p"
+ variableInitialisers="processor(p)" snapPixels="8" snapActive="1"
+ snapShown="1" overlayOpacity="0.330" fixedSize="1" initialWidth="640"
+ initialHeight="82">
+ params="p, "monophonicBehavior_raw", "Behavior""/>
+ params="p, "arpeggioIntervalType_raw", "Interval""/>
+
END_JUCER_METADATA
diff --git a/Source/MonophonicComponent.h b/Source/MonophonicComponent.h
index 228c8fe..2c653e2 100644
--- a/Source/MonophonicComponent.h
+++ b/Source/MonophonicComponent.h
@@ -21,6 +21,7 @@
//[Headers] -- You can add your own extra header files here --
#include
+#include "SliderComponent.h"
#include "ChoiceComponent.h"
//[/Headers]
@@ -34,15 +35,19 @@
Describe your class and how it works here!
//[/Comments]
*/
-class MonophonicComponent : public juce::Component
+class MonophonicComponent : public Component,
+ public ComboBox::Listener
{
public:
//==============================================================================
MonophonicComponent (Magical8bitPlug2AudioProcessor& p);
~MonophonicComponent() override;
+
//==============================================================================
//[UserMethods] -- You can add your own custom methods in this section.
+ void comboBoxChanged(juce::ComboBox *comboBoxThatHasChanged) override;
+ void updateVisibility();
//[/UserMethods]
void paint (juce::Graphics& g) override;
@@ -53,6 +58,7 @@ public:
private:
//[UserVariables] -- You can add your own custom variables in this section.
std::unique_ptr attc;
+ Magical8bitPlug2AudioProcessor& processor;
//[/UserVariables]
//==============================================================================
@@ -60,6 +66,7 @@ private:
std::unique_ptr behaviorChoice;
std::unique_ptr intervalChoice;
std::unique_ptr intervalSlider;
+ std::unique_ptr portamentoSlider;
//==============================================================================
diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp
index 904e29e..1ca7883 100644
--- a/Source/PluginProcessor.cpp
+++ b/Source/PluginProcessor.cpp
@@ -67,8 +67,8 @@ Magical8bitPlug2AudioProcessor::Magical8bitPlug2AudioProcessor()
//
// Monophonic
//
- std::make_unique ("monophonicBehavior", "Behavior", StringArray ({"Legato", "Arpeggio Up", "Arpeggio Down", "Non-legato"}), 0),
- std::make_unique ("arpeggioIntervalType", "Interval", StringArray ({"1 frame", "2 frames", "3 frames", "96th", "64th", "48th", "32th", "24th", "Slider"}), 0),
+ std::make_unique ("monophonicBehavior_raw", "Behavior", StringArray ({"Legato", "Arpeggio Up", "Arpeggio Down", "Non-legato"}), 0),
+ std::make_unique ("arpeggioIntervalType_raw", "Interval", StringArray ({"1 frame", "2 frames", "3 frames", "96th", "64th", "48th", "32nd", "24th", "Slider"}), 0),
std::make_unique ("arpeggioIntervalSliderValue", //ID
"Interval", //name
NormalisableRange (0.001f, //min
@@ -76,7 +76,6 @@ Magical8bitPlug2AudioProcessor::Magical8bitPlug2AudioProcessor()
0.001f, //step
0.5f), //skew
0.001f), //default
- std::make_unique ("arpeggioDirection", "Direction", StringArray ({"up", "down"}), 0),
std::make_unique ("portamentoTime", "Portamento Time", 0.0f, 1.0f, 0.0f),
//
// Bend
diff --git a/Source/Settings.h b/Source/Settings.h
index 8b29dad..5afbd4d 100644
--- a/Source/Settings.h
+++ b/Source/Settings.h
@@ -35,6 +35,32 @@ struct PluginSettings
double bendRange = 2;
};
+//---------------------------------------------
+//
+// Monophonic Options
+//
+//---------------------------------------------
+enum MonophonicBehavior
+{
+ kLegato = 0,
+ kArpeggioUp,
+ kArpeggioDown,
+ kNonLegato,
+};
+
+enum ArpeggioIntervalType
+{
+ k1frame = 0,
+ k2frames,
+ k3frames,
+ k96th,
+ k64th,
+ k48th,
+ k32nd,
+ k24th,
+ kSlider,
+};
+
//---------------------------------------------
//
// Tone Specific
@@ -95,10 +121,11 @@ struct SettingRefs
float* decay = nullptr;
float* suslevel = nullptr;
float* release = nullptr;
- // Arpeggio
- float* isArpeggioEnabled_raw = nullptr;
- float* arpeggioTime = nullptr;
- float* arpeggioDirection = nullptr;
+ // Monophonic
+ float* monophonicBehavior_raw = nullptr;
+ float* arpeggioIntervalType_raw = nullptr;
+ float* arpeggioIntervalSliderValue = nullptr;
+ float* portamentoTime = nullptr;
// Bend
float* bendRange = nullptr;
// Vibrato
@@ -143,7 +170,6 @@ struct SettingRefs
bool isAdvancedPanelOpen() { return *isAdvancedPanelOpen_raw > 0.5; }
ColorSchemeType colorSchemeType() { return (ColorSchemeType) ((int) (*colorScheme)); }
- bool isArpeggioEnabled() { return *isArpeggioEnabled_raw > 0.5; }
NoiseAlgorithm noiseAlgorithm() { return (NoiseAlgorithm) ((int) (*noiseAlgorithm_raw)); }
bool vibratoIgnoresWheel() { return *vibratoIgnoresWheel_raw > 0.5; }
@@ -152,7 +178,8 @@ struct SettingRefs
bool isPitchSequenceEnabled() { return *isPitchSequenceEnabled_raw > 0.5; }
bool isDutySequenceEnabled() { return *isDutySequenceEnabled_raw > 0.5; }
PitchSequenceMode pitchSequenceMode() { return (PitchSequenceMode) ((int) (*pitchSequenceMode_raw)); }
-
+ MonophonicBehavior monophonicBehavior() { return (MonophonicBehavior) ((int) (*monophonicBehavior_raw)); }
+ ArpeggioIntervalType apreggioIntervalType() { return (ArpeggioIntervalType) ((int) (*arpeggioIntervalType_raw)); }
//
// constructor
@@ -171,10 +198,11 @@ struct SettingRefs
decay = (float*) parameters->getRawParameterValue ("decay");
suslevel = (float*) parameters->getRawParameterValue ("suslevel");
release = (float*) parameters->getRawParameterValue ("release");
- // Arpeggio
- isArpeggioEnabled_raw = (float*) parameters->getRawParameterValue ("isArpeggioEnabled_raw");
- arpeggioTime = (float*) parameters->getRawParameterValue ("arpeggioTime");
- arpeggioDirection = (float*) parameters->getRawParameterValue ("arpeggioDirection");
+ // Monophonic
+ monophonicBehavior_raw = (float*) parameters->getRawParameterValue ("monophonicBehavior_raw");
+ arpeggioIntervalType_raw = (float*) parameters->getRawParameterValue ("arpeggioIntervalType_raw");
+ arpeggioIntervalSliderValue = (float*) parameters->getRawParameterValue ("arpeggioIntervalSliderValue");
+ portamentoTime = (float*) parameters->getRawParameterValue ("portamentoTime");
// Bend
bendRange = (float*) parameters->getRawParameterValue ("bendRange");
// Vibrato