mirror of
https://github.com/yokemura/Magical8bitPlug2.git
synced 2025-06-03 00:58:05 -04:00
Detailed UI behavior
This commit is contained in:
parent
439d67ee85
commit
857ac48b58
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
MonophonicComponent::MonophonicComponent (Magical8bitPlug2AudioProcessor& p)
|
MonophonicComponent::MonophonicComponent (Magical8bitPlug2AudioProcessor& p)
|
||||||
|
: processor(p)
|
||||||
{
|
{
|
||||||
//[Constructor_pre] You can add your own custom stuff here..
|
//[Constructor_pre] You can add your own custom stuff here..
|
||||||
//[/Constructor_pre]
|
//[/Constructor_pre]
|
||||||
@ -43,13 +44,13 @@ MonophonicComponent::MonophonicComponent (Magical8bitPlug2AudioProcessor& p)
|
|||||||
|
|
||||||
label->setBounds (0, 4, 150, 22);
|
label->setBounds (0, 4, 150, 22);
|
||||||
|
|
||||||
behaviorChoice.reset (new ChoiceComponent (p, "monophonicBehavior", "Behavior"));
|
behaviorChoice.reset (new ChoiceComponent (p, "monophonicBehavior_raw", "Behavior"));
|
||||||
addAndMakeVisible (behaviorChoice.get());
|
addAndMakeVisible (behaviorChoice.get());
|
||||||
behaviorChoice->setName ("behavior selector");
|
behaviorChoice->setName ("behavior selector");
|
||||||
|
|
||||||
behaviorChoice->setBounds (0, 28, 224, 26);
|
behaviorChoice->setBounds (0, 28, 224, 26);
|
||||||
|
|
||||||
intervalChoice.reset (new ChoiceComponent (p, "arpeggioIntervalType", "Interval"));
|
intervalChoice.reset (new ChoiceComponent (p, "arpeggioIntervalType_raw", "Interval"));
|
||||||
addAndMakeVisible (intervalChoice.get());
|
addAndMakeVisible (intervalChoice.get());
|
||||||
intervalChoice->setName ("interval selector");
|
intervalChoice->setName ("interval selector");
|
||||||
|
|
||||||
@ -61,6 +62,10 @@ MonophonicComponent::MonophonicComponent (Magical8bitPlug2AudioProcessor& p)
|
|||||||
intervalSlider->setSliderStyle (juce::Slider::LinearHorizontal);
|
intervalSlider->setSliderStyle (juce::Slider::LinearHorizontal);
|
||||||
intervalSlider->setTextBoxStyle (juce::Slider::TextBoxRight, false, 50, 20);
|
intervalSlider->setTextBoxStyle (juce::Slider::TextBoxRight, false, 50, 20);
|
||||||
|
|
||||||
|
portamentoSlider.reset (new SliderComponent (p, "portamentoTime", "Portamento"));
|
||||||
|
addAndMakeVisible (portamentoSlider.get());
|
||||||
|
portamentoSlider->setName ("portamento slider");
|
||||||
|
|
||||||
|
|
||||||
//[UserPreSize]
|
//[UserPreSize]
|
||||||
//[/UserPreSize]
|
//[/UserPreSize]
|
||||||
@ -70,6 +75,9 @@ MonophonicComponent::MonophonicComponent (Magical8bitPlug2AudioProcessor& p)
|
|||||||
|
|
||||||
//[Constructor] You can add your own custom stuff here..
|
//[Constructor] You can add your own custom stuff here..
|
||||||
attc.reset (new SliderAttachment (p.parameters, "arpeggioIntervalSliderValue", *intervalSlider));
|
attc.reset (new SliderAttachment (p.parameters, "arpeggioIntervalSliderValue", *intervalSlider));
|
||||||
|
behaviorChoice->setListener(this);
|
||||||
|
intervalChoice->setListener(this);
|
||||||
|
updateVisibility();
|
||||||
//[/Constructor]
|
//[/Constructor]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,6 +91,7 @@ MonophonicComponent::~MonophonicComponent()
|
|||||||
behaviorChoice = nullptr;
|
behaviorChoice = nullptr;
|
||||||
intervalChoice = nullptr;
|
intervalChoice = nullptr;
|
||||||
intervalSlider = nullptr;
|
intervalSlider = nullptr;
|
||||||
|
portamentoSlider = nullptr;
|
||||||
|
|
||||||
|
|
||||||
//[Destructor]. You can add your own custom destruction code here..
|
//[Destructor]. You can add your own custom destruction code here..
|
||||||
@ -105,6 +114,7 @@ void MonophonicComponent::resized()
|
|||||||
//[/UserPreResize]
|
//[/UserPreResize]
|
||||||
|
|
||||||
intervalSlider->setBounds (getWidth() - (getWidth() - 420), 28, getWidth() - 420, 24);
|
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] Add your own custom resize handling here..
|
||||||
//[/UserResized]
|
//[/UserResized]
|
||||||
}
|
}
|
||||||
@ -112,6 +122,35 @@ void MonophonicComponent::resized()
|
|||||||
|
|
||||||
|
|
||||||
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
|
//[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]
|
//[/MiscUserCode]
|
||||||
|
|
||||||
|
|
||||||
@ -125,9 +164,10 @@ void MonophonicComponent::resized()
|
|||||||
BEGIN_JUCER_METADATA
|
BEGIN_JUCER_METADATA
|
||||||
|
|
||||||
<JUCER_COMPONENT documentType="Component" className="MonophonicComponent" componentName=""
|
<JUCER_COMPONENT documentType="Component" className="MonophonicComponent" componentName=""
|
||||||
parentClasses="public juce::Component" constructorParams="Magical8bitPlug2AudioProcessor& p"
|
parentClasses="public Component, public ComboBox::Listener" constructorParams="Magical8bitPlug2AudioProcessor& p"
|
||||||
variableInitialisers="" snapPixels="8" snapActive="1" snapShown="1"
|
variableInitialisers="processor(p)" snapPixels="8" snapActive="1"
|
||||||
overlayOpacity="0.330" fixedSize="1" initialWidth="640" initialHeight="82">
|
snapShown="1" overlayOpacity="0.330" fixedSize="1" initialWidth="640"
|
||||||
|
initialHeight="82">
|
||||||
<BACKGROUND backgroundColour="ffffff"/>
|
<BACKGROUND backgroundColour="ffffff"/>
|
||||||
<LABEL name="label" id="bae3132bcad681ce" memberName="label" virtualName=""
|
<LABEL name="label" id="bae3132bcad681ce" memberName="label" virtualName=""
|
||||||
explicitFocusOrder="0" pos="0 4 150 22" edTextCol="ff000000"
|
explicitFocusOrder="0" pos="0 4 150 22" edTextCol="ff000000"
|
||||||
@ -136,15 +176,18 @@ BEGIN_JUCER_METADATA
|
|||||||
fontsize="17.0" kerning="0.0" bold="0" italic="0" justification="33"/>
|
fontsize="17.0" kerning="0.0" bold="0" italic="0" justification="33"/>
|
||||||
<GENERICCOMPONENT name="behavior selector" id="fa2387d441a3005d" memberName="behaviorChoice"
|
<GENERICCOMPONENT name="behavior selector" id="fa2387d441a3005d" memberName="behaviorChoice"
|
||||||
virtualName="" explicitFocusOrder="0" pos="0 28 224 26" class="ChoiceComponent"
|
virtualName="" explicitFocusOrder="0" pos="0 28 224 26" class="ChoiceComponent"
|
||||||
params="p, "monophonicBehavior", "Behavior""/>
|
params="p, "monophonicBehavior_raw", "Behavior""/>
|
||||||
<GENERICCOMPONENT name="interval selector" id="21d73ddc37680dd7" memberName="intervalChoice"
|
<GENERICCOMPONENT name="interval selector" id="21d73ddc37680dd7" memberName="intervalChoice"
|
||||||
virtualName="" explicitFocusOrder="0" pos="228 28 185 28" class="ChoiceComponent"
|
virtualName="" explicitFocusOrder="0" pos="228 28 185 28" class="ChoiceComponent"
|
||||||
params="p, "arpeggioIntervalType", "Interval""/>
|
params="p, "arpeggioIntervalType_raw", "Interval""/>
|
||||||
<SLIDER name="interval slider" id="2d6901c46e73c1e" memberName="intervalSlider"
|
<SLIDER name="interval slider" id="2d6901c46e73c1e" memberName="intervalSlider"
|
||||||
virtualName="" explicitFocusOrder="0" pos="0Rr 28 420M 24" min="0.0"
|
virtualName="" explicitFocusOrder="0" pos="0Rr 28 420M 24" min="0.0"
|
||||||
max="10.0" int="0.01" style="LinearHorizontal" textBoxPos="TextBoxRight"
|
max="10.0" int="0.01" style="LinearHorizontal" textBoxPos="TextBoxRight"
|
||||||
textBoxEditable="1" textBoxWidth="50" textBoxHeight="20" skewFactor="1.0"
|
textBoxEditable="1" textBoxWidth="50" textBoxHeight="20" skewFactor="1.0"
|
||||||
needsCallback="0"/>
|
needsCallback="0"/>
|
||||||
|
<GENERICCOMPONENT name="portamento slider" id="b01ddc412ec6dc27" memberName="portamentoSlider"
|
||||||
|
virtualName="" explicitFocusOrder="0" pos="0Rr 28 50% 28" class="SliderComponent"
|
||||||
|
params="p, "portamentoTime", "Portamento""/>
|
||||||
</JUCER_COMPONENT>
|
</JUCER_COMPONENT>
|
||||||
|
|
||||||
END_JUCER_METADATA
|
END_JUCER_METADATA
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
//[Headers] -- You can add your own extra header files here --
|
//[Headers] -- You can add your own extra header files here --
|
||||||
#include <JuceHeader.h>
|
#include <JuceHeader.h>
|
||||||
|
#include "SliderComponent.h"
|
||||||
#include "ChoiceComponent.h"
|
#include "ChoiceComponent.h"
|
||||||
//[/Headers]
|
//[/Headers]
|
||||||
|
|
||||||
@ -34,15 +35,19 @@
|
|||||||
Describe your class and how it works here!
|
Describe your class and how it works here!
|
||||||
//[/Comments]
|
//[/Comments]
|
||||||
*/
|
*/
|
||||||
class MonophonicComponent : public juce::Component
|
class MonophonicComponent : public Component,
|
||||||
|
public ComboBox::Listener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
MonophonicComponent (Magical8bitPlug2AudioProcessor& p);
|
MonophonicComponent (Magical8bitPlug2AudioProcessor& p);
|
||||||
~MonophonicComponent() override;
|
~MonophonicComponent() override;
|
||||||
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
//[UserMethods] -- You can add your own custom methods in this section.
|
//[UserMethods] -- You can add your own custom methods in this section.
|
||||||
|
void comboBoxChanged(juce::ComboBox *comboBoxThatHasChanged) override;
|
||||||
|
void updateVisibility();
|
||||||
//[/UserMethods]
|
//[/UserMethods]
|
||||||
|
|
||||||
void paint (juce::Graphics& g) override;
|
void paint (juce::Graphics& g) override;
|
||||||
@ -53,6 +58,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
//[UserVariables] -- You can add your own custom variables in this section.
|
//[UserVariables] -- You can add your own custom variables in this section.
|
||||||
std::unique_ptr<SliderAttachment> attc;
|
std::unique_ptr<SliderAttachment> attc;
|
||||||
|
Magical8bitPlug2AudioProcessor& processor;
|
||||||
//[/UserVariables]
|
//[/UserVariables]
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@ -60,6 +66,7 @@ private:
|
|||||||
std::unique_ptr<ChoiceComponent> behaviorChoice;
|
std::unique_ptr<ChoiceComponent> behaviorChoice;
|
||||||
std::unique_ptr<ChoiceComponent> intervalChoice;
|
std::unique_ptr<ChoiceComponent> intervalChoice;
|
||||||
std::unique_ptr<juce::Slider> intervalSlider;
|
std::unique_ptr<juce::Slider> intervalSlider;
|
||||||
|
std::unique_ptr<SliderComponent> portamentoSlider;
|
||||||
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
@ -67,8 +67,8 @@ Magical8bitPlug2AudioProcessor::Magical8bitPlug2AudioProcessor()
|
|||||||
//
|
//
|
||||||
// Monophonic
|
// Monophonic
|
||||||
//
|
//
|
||||||
std::make_unique<AudioParameterChoice> ("monophonicBehavior", "Behavior", StringArray ({"Legato", "Arpeggio Up", "Arpeggio Down", "Non-legato"}), 0),
|
std::make_unique<AudioParameterChoice> ("monophonicBehavior_raw", "Behavior", StringArray ({"Legato", "Arpeggio Up", "Arpeggio Down", "Non-legato"}), 0),
|
||||||
std::make_unique<AudioParameterChoice> ("arpeggioIntervalType", "Interval", StringArray ({"1 frame", "2 frames", "3 frames", "96th", "64th", "48th", "32th", "24th", "Slider"}), 0),
|
std::make_unique<AudioParameterChoice> ("arpeggioIntervalType_raw", "Interval", StringArray ({"1 frame", "2 frames", "3 frames", "96th", "64th", "48th", "32nd", "24th", "Slider"}), 0),
|
||||||
std::make_unique<AudioParameterFloat> ("arpeggioIntervalSliderValue", //ID
|
std::make_unique<AudioParameterFloat> ("arpeggioIntervalSliderValue", //ID
|
||||||
"Interval", //name
|
"Interval", //name
|
||||||
NormalisableRange<float> (0.001f, //min
|
NormalisableRange<float> (0.001f, //min
|
||||||
@ -76,7 +76,6 @@ Magical8bitPlug2AudioProcessor::Magical8bitPlug2AudioProcessor()
|
|||||||
0.001f, //step
|
0.001f, //step
|
||||||
0.5f), //skew
|
0.5f), //skew
|
||||||
0.001f), //default
|
0.001f), //default
|
||||||
std::make_unique<AudioParameterChoice> ("arpeggioDirection", "Direction", StringArray ({"up", "down"}), 0),
|
|
||||||
std::make_unique<AudioParameterFloat> ("portamentoTime", "Portamento Time", 0.0f, 1.0f, 0.0f),
|
std::make_unique<AudioParameterFloat> ("portamentoTime", "Portamento Time", 0.0f, 1.0f, 0.0f),
|
||||||
//
|
//
|
||||||
// Bend
|
// Bend
|
||||||
|
@ -35,6 +35,32 @@ struct PluginSettings
|
|||||||
double bendRange = 2;
|
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
|
// Tone Specific
|
||||||
@ -95,10 +121,11 @@ struct SettingRefs
|
|||||||
float* decay = nullptr;
|
float* decay = nullptr;
|
||||||
float* suslevel = nullptr;
|
float* suslevel = nullptr;
|
||||||
float* release = nullptr;
|
float* release = nullptr;
|
||||||
// Arpeggio
|
// Monophonic
|
||||||
float* isArpeggioEnabled_raw = nullptr;
|
float* monophonicBehavior_raw = nullptr;
|
||||||
float* arpeggioTime = nullptr;
|
float* arpeggioIntervalType_raw = nullptr;
|
||||||
float* arpeggioDirection = nullptr;
|
float* arpeggioIntervalSliderValue = nullptr;
|
||||||
|
float* portamentoTime = nullptr;
|
||||||
// Bend
|
// Bend
|
||||||
float* bendRange = nullptr;
|
float* bendRange = nullptr;
|
||||||
// Vibrato
|
// Vibrato
|
||||||
@ -143,7 +170,6 @@ struct SettingRefs
|
|||||||
bool isAdvancedPanelOpen() { return *isAdvancedPanelOpen_raw > 0.5; }
|
bool isAdvancedPanelOpen() { return *isAdvancedPanelOpen_raw > 0.5; }
|
||||||
ColorSchemeType colorSchemeType() { return (ColorSchemeType) ((int) (*colorScheme)); }
|
ColorSchemeType colorSchemeType() { return (ColorSchemeType) ((int) (*colorScheme)); }
|
||||||
|
|
||||||
bool isArpeggioEnabled() { return *isArpeggioEnabled_raw > 0.5; }
|
|
||||||
NoiseAlgorithm noiseAlgorithm() { return (NoiseAlgorithm) ((int) (*noiseAlgorithm_raw)); }
|
NoiseAlgorithm noiseAlgorithm() { return (NoiseAlgorithm) ((int) (*noiseAlgorithm_raw)); }
|
||||||
|
|
||||||
bool vibratoIgnoresWheel() { return *vibratoIgnoresWheel_raw > 0.5; }
|
bool vibratoIgnoresWheel() { return *vibratoIgnoresWheel_raw > 0.5; }
|
||||||
@ -152,7 +178,8 @@ struct SettingRefs
|
|||||||
bool isPitchSequenceEnabled() { return *isPitchSequenceEnabled_raw > 0.5; }
|
bool isPitchSequenceEnabled() { return *isPitchSequenceEnabled_raw > 0.5; }
|
||||||
bool isDutySequenceEnabled() { return *isDutySequenceEnabled_raw > 0.5; }
|
bool isDutySequenceEnabled() { return *isDutySequenceEnabled_raw > 0.5; }
|
||||||
PitchSequenceMode pitchSequenceMode() { return (PitchSequenceMode) ((int) (*pitchSequenceMode_raw)); }
|
PitchSequenceMode pitchSequenceMode() { return (PitchSequenceMode) ((int) (*pitchSequenceMode_raw)); }
|
||||||
|
MonophonicBehavior monophonicBehavior() { return (MonophonicBehavior) ((int) (*monophonicBehavior_raw)); }
|
||||||
|
ArpeggioIntervalType apreggioIntervalType() { return (ArpeggioIntervalType) ((int) (*arpeggioIntervalType_raw)); }
|
||||||
|
|
||||||
//
|
//
|
||||||
// constructor
|
// constructor
|
||||||
@ -171,10 +198,11 @@ struct SettingRefs
|
|||||||
decay = (float*) parameters->getRawParameterValue ("decay");
|
decay = (float*) parameters->getRawParameterValue ("decay");
|
||||||
suslevel = (float*) parameters->getRawParameterValue ("suslevel");
|
suslevel = (float*) parameters->getRawParameterValue ("suslevel");
|
||||||
release = (float*) parameters->getRawParameterValue ("release");
|
release = (float*) parameters->getRawParameterValue ("release");
|
||||||
// Arpeggio
|
// Monophonic
|
||||||
isArpeggioEnabled_raw = (float*) parameters->getRawParameterValue ("isArpeggioEnabled_raw");
|
monophonicBehavior_raw = (float*) parameters->getRawParameterValue ("monophonicBehavior_raw");
|
||||||
arpeggioTime = (float*) parameters->getRawParameterValue ("arpeggioTime");
|
arpeggioIntervalType_raw = (float*) parameters->getRawParameterValue ("arpeggioIntervalType_raw");
|
||||||
arpeggioDirection = (float*) parameters->getRawParameterValue ("arpeggioDirection");
|
arpeggioIntervalSliderValue = (float*) parameters->getRawParameterValue ("arpeggioIntervalSliderValue");
|
||||||
|
portamentoTime = (float*) parameters->getRawParameterValue ("portamentoTime");
|
||||||
// Bend
|
// Bend
|
||||||
bendRange = (float*) parameters->getRawParameterValue ("bendRange");
|
bendRange = (float*) parameters->getRawParameterValue ("bendRange");
|
||||||
// Vibrato
|
// Vibrato
|
||||||
|
Loading…
x
Reference in New Issue
Block a user