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)
|
||||
: 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
|
||||
|
||||
<JUCER_COMPONENT documentType="Component" className="MonophonicComponent" componentName=""
|
||||
parentClasses="public juce::Component" constructorParams="Magical8bitPlug2AudioProcessor& p"
|
||||
variableInitialisers="" snapPixels="8" snapActive="1" snapShown="1"
|
||||
overlayOpacity="0.330" fixedSize="1" initialWidth="640" initialHeight="82">
|
||||
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">
|
||||
<BACKGROUND backgroundColour="ffffff"/>
|
||||
<LABEL name="label" id="bae3132bcad681ce" memberName="label" virtualName=""
|
||||
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"/>
|
||||
<GENERICCOMPONENT name="behavior selector" id="fa2387d441a3005d" memberName="behaviorChoice"
|
||||
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"
|
||||
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"
|
||||
virtualName="" explicitFocusOrder="0" pos="0Rr 28 420M 24" min="0.0"
|
||||
max="10.0" int="0.01" style="LinearHorizontal" textBoxPos="TextBoxRight"
|
||||
textBoxEditable="1" textBoxWidth="50" textBoxHeight="20" skewFactor="1.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>
|
||||
|
||||
END_JUCER_METADATA
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
//[Headers] -- You can add your own extra header files here --
|
||||
#include <JuceHeader.h>
|
||||
#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<SliderAttachment> attc;
|
||||
Magical8bitPlug2AudioProcessor& processor;
|
||||
//[/UserVariables]
|
||||
|
||||
//==============================================================================
|
||||
@ -60,6 +66,7 @@ private:
|
||||
std::unique_ptr<ChoiceComponent> behaviorChoice;
|
||||
std::unique_ptr<ChoiceComponent> intervalChoice;
|
||||
std::unique_ptr<juce::Slider> intervalSlider;
|
||||
std::unique_ptr<SliderComponent> portamentoSlider;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
@ -67,8 +67,8 @@ Magical8bitPlug2AudioProcessor::Magical8bitPlug2AudioProcessor()
|
||||
//
|
||||
// Monophonic
|
||||
//
|
||||
std::make_unique<AudioParameterChoice> ("monophonicBehavior", "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> ("monophonicBehavior_raw", "Behavior", StringArray ({"Legato", "Arpeggio Up", "Arpeggio Down", "Non-legato"}), 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
|
||||
"Interval", //name
|
||||
NormalisableRange<float> (0.001f, //min
|
||||
@ -76,7 +76,6 @@ Magical8bitPlug2AudioProcessor::Magical8bitPlug2AudioProcessor()
|
||||
0.001f, //step
|
||||
0.5f), //skew
|
||||
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),
|
||||
//
|
||||
// Bend
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user