Arpeggio parameters UI

This commit is contained in:
Takeshi Yokemura 2021-05-17 09:33:28 +09:00
parent 7ac0e80624
commit 439d67ee85
5 changed files with 75 additions and 10 deletions

View File

@ -27,27 +27,62 @@
//[/MiscUserDefs] //[/MiscUserDefs]
//============================================================================== //==============================================================================
MonophonicComponent::MonophonicComponent () MonophonicComponent::MonophonicComponent (Magical8bitPlug2AudioProcessor& 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]
label.reset (new juce::Label ("label",
TRANS("Monophonic Options")));
addAndMakeVisible (label.get());
label->setFont (juce::Font (17.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
label->setJustificationType (juce::Justification::centredLeft);
label->setEditable (false, false, false);
label->setColour (juce::TextEditor::textColourId, juce::Colours::black);
label->setColour (juce::TextEditor::backgroundColourId, juce::Colour (0x00000000));
label->setBounds (0, 4, 150, 22);
behaviorChoice.reset (new ChoiceComponent (p, "monophonicBehavior", "Behavior"));
addAndMakeVisible (behaviorChoice.get());
behaviorChoice->setName ("behavior selector");
behaviorChoice->setBounds (0, 28, 224, 26);
intervalChoice.reset (new ChoiceComponent (p, "arpeggioIntervalType", "Interval"));
addAndMakeVisible (intervalChoice.get());
intervalChoice->setName ("interval selector");
intervalChoice->setBounds (228, 28, 185, 28);
intervalSlider.reset (new juce::Slider ("interval slider"));
addAndMakeVisible (intervalSlider.get());
intervalSlider->setRange (0, 10, 0.01);
intervalSlider->setSliderStyle (juce::Slider::LinearHorizontal);
intervalSlider->setTextBoxStyle (juce::Slider::TextBoxRight, false, 50, 20);
//[UserPreSize] //[UserPreSize]
//[/UserPreSize] //[/UserPreSize]
setSize (640, 400); setSize (640, 82);
//[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));
//[/Constructor] //[/Constructor]
} }
MonophonicComponent::~MonophonicComponent() MonophonicComponent::~MonophonicComponent()
{ {
//[Destructor_pre]. You can add your own custom destruction code here.. //[Destructor_pre]. You can add your own custom destruction code here..
attc.reset();
//[/Destructor_pre] //[/Destructor_pre]
label = nullptr;
behaviorChoice = nullptr;
intervalChoice = nullptr;
intervalSlider = nullptr;
//[Destructor]. You can add your own custom destruction code here.. //[Destructor]. You can add your own custom destruction code here..
@ -60,8 +95,6 @@ void MonophonicComponent::paint (juce::Graphics& g)
//[UserPrePaint] Add your own custom painting code here.. //[UserPrePaint] Add your own custom painting code here..
//[/UserPrePaint] //[/UserPrePaint]
g.fillAll (juce::Colour (0xff323e44));
//[UserPaint] Add your own custom painting code here.. //[UserPaint] Add your own custom painting code here..
//[/UserPaint] //[/UserPaint]
} }
@ -71,6 +104,7 @@ void MonophonicComponent::resized()
//[UserPreResize] Add your own custom resize code here.. //[UserPreResize] Add your own custom resize code here..
//[/UserPreResize] //[/UserPreResize]
intervalSlider->setBounds (getWidth() - (getWidth() - 420), 28, getWidth() - 420, 24);
//[UserResized] Add your own custom resize handling here.. //[UserResized] Add your own custom resize handling here..
//[/UserResized] //[/UserResized]
} }
@ -91,10 +125,26 @@ 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="" variableInitialisers="" parentClasses="public juce::Component" constructorParams="Magical8bitPlug2AudioProcessor&amp; p"
snapPixels="8" snapActive="1" snapShown="1" overlayOpacity="0.330" variableInitialisers="" snapPixels="8" snapActive="1" snapShown="1"
fixedSize="0" initialWidth="640" initialHeight="400"> overlayOpacity="0.330" fixedSize="1" initialWidth="640" initialHeight="82">
<BACKGROUND backgroundColour="ff323e44"/> <BACKGROUND backgroundColour="ffffff"/>
<LABEL name="label" id="bae3132bcad681ce" memberName="label" virtualName=""
explicitFocusOrder="0" pos="0 4 150 22" edTextCol="ff000000"
edBkgCol="0" labelText="Monophonic Options" editableSingleClick="0"
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
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, &quot;monophonicBehavior&quot;, &quot;Behavior&quot;"/>
<GENERICCOMPONENT name="interval selector" id="21d73ddc37680dd7" memberName="intervalChoice"
virtualName="" explicitFocusOrder="0" pos="228 28 185 28" class="ChoiceComponent"
params="p, &quot;arpeggioIntervalType&quot;, &quot;Interval&quot;"/>
<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"/>
</JUCER_COMPONENT> </JUCER_COMPONENT>
END_JUCER_METADATA END_JUCER_METADATA

View File

@ -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 "ChoiceComponent.h"
//[/Headers] //[/Headers]
@ -37,7 +38,7 @@ class MonophonicComponent : public juce::Component
{ {
public: public:
//============================================================================== //==============================================================================
MonophonicComponent (); MonophonicComponent (Magical8bitPlug2AudioProcessor& p);
~MonophonicComponent() override; ~MonophonicComponent() override;
//============================================================================== //==============================================================================
@ -51,9 +52,14 @@ 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;
//[/UserVariables] //[/UserVariables]
//============================================================================== //==============================================================================
std::unique_ptr<juce::Label> label;
std::unique_ptr<ChoiceComponent> behaviorChoice;
std::unique_ptr<ChoiceComponent> intervalChoice;
std::unique_ptr<juce::Slider> intervalSlider;
//============================================================================== //==============================================================================

View File

@ -11,6 +11,7 @@
#include "PluginProcessor.h" #include "PluginProcessor.h"
#include "PluginEditor.h" #include "PluginEditor.h"
#include "AdvancedParamsComponent.h" #include "AdvancedParamsComponent.h"
#include "MonophonicComponent.h"
#include "PulseParamsComponent.h" #include "PulseParamsComponent.h"
#include "BasicParamsComponent.h" #include "BasicParamsComponent.h"
#include "EnvelopeParamsComponent.h" #include "EnvelopeParamsComponent.h"
@ -32,6 +33,9 @@ Magical8bitPlug2AudioProcessorEditor::Magical8bitPlug2AudioProcessorEditor (Magi
basicCompo.reset (new BasicParamsComponent (p, *this)); basicCompo.reset (new BasicParamsComponent (p, *this));
addAndMakeVisible (basicCompo.get()); addAndMakeVisible (basicCompo.get());
monoCompo.reset (new MonophonicComponent (p));
addAndMakeVisible(monoCompo.get());
envCompo.reset (new EnvelopeParamsComponent (p)); envCompo.reset (new EnvelopeParamsComponent (p));
addAndMakeVisible (envCompo.get()); addAndMakeVisible (envCompo.get());
@ -211,6 +215,7 @@ void Magical8bitPlug2AudioProcessorEditor::resized()
// Monophonic // Monophonic
// //
if (processor.settingRefs.isMonophonic()) { if (processor.settingRefs.isMonophonic()) {
monoCompo->setBounds(x, y, sizes.fullComponentWidth, sizes.monoCompoHeight);
y += sizes.monoCompoHeight; y += sizes.monoCompoHeight;
} }
@ -271,6 +276,8 @@ void Magical8bitPlug2AudioProcessorEditor::resized()
break; break;
} }
monoCompo->setVisible(processor.settingRefs.isMonophonic());
// //
// Enable/Disable // Enable/Disable
// //

View File

@ -13,6 +13,7 @@
#include "../JuceLibraryCode/JuceHeader.h" #include "../JuceLibraryCode/JuceHeader.h"
#include "PluginProcessor.h" #include "PluginProcessor.h"
class AdvancedParamsComponent; class AdvancedParamsComponent;
class MonophonicComponent;
class PulseParamsComponent; class PulseParamsComponent;
class BasicParamsComponent; class BasicParamsComponent;
class EnvelopeParamsComponent; class EnvelopeParamsComponent;
@ -44,6 +45,7 @@ private:
Magical8bitPlug2AudioProcessor& processor; Magical8bitPlug2AudioProcessor& processor;
std::unique_ptr<BasicParamsComponent> basicCompo; std::unique_ptr<BasicParamsComponent> basicCompo;
std::unique_ptr<MonophonicComponent> monoCompo;
std::unique_ptr<EnvelopeParamsComponent> envCompo; std::unique_ptr<EnvelopeParamsComponent> envCompo;
std::unique_ptr<AdvancedParamsComponent> advCompo; std::unique_ptr<AdvancedParamsComponent> advCompo;
std::unique_ptr<PulseParamsComponent> pulCompo; std::unique_ptr<PulseParamsComponent> pulCompo;

View File

@ -68,7 +68,7 @@ Magical8bitPlug2AudioProcessor::Magical8bitPlug2AudioProcessor()
// Monophonic // Monophonic
// //
std::make_unique<AudioParameterChoice> ("monophonicBehavior", "Behavior", StringArray ({"Legato", "Arpeggio Up", "Arpeggio Down", "Non-legato"}), 0), std::make_unique<AudioParameterChoice> ("monophonicBehavior", "Behavior", StringArray ({"Legato", "Arpeggio Up", "Arpeggio Down", "Non-legato"}), 0),
std::make_unique<AudioParameterChoice> ("arpeggioIntervalType", "Interval", StringArray ({"1frame", "2frames", "3frames", "96th", "64th", "48th", "32th", "24th", "Slider"}), 0), std::make_unique<AudioParameterChoice> ("arpeggioIntervalType", "Interval", StringArray ({"1 frame", "2 frames", "3 frames", "96th", "64th", "48th", "32th", "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