/*
==============================================================================
This is an automatically generated GUI class created by the Projucer!
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Created with Projucer version: 5.4.4
------------------------------------------------------------------------------
The Projucer is part of the JUCE library.
Copyright (c) 2017 - ROLI Ltd.
==============================================================================
*/
//[Headers] You can add your own extra header files here...
#include "AudioParameters.h"
#include "PluginProcessor.h"
//[/Headers]
#include "GuiLFO.h"
//[MiscUserDefs] You can add your own user definitions and misc code here...
//[/MiscUserDefs]
//==============================================================================
GuiLFO::GuiLFO ( const String& name, const String & text)
: GroupComponent (name, text)
{
//[Constructor_pre] You can add your own custom stuff here..
//[/Constructor_pre]
setName ("GuiLFO");
lfoDelay.reset (new Slider ("lfoDelay"));
addAndMakeVisible (lfoDelay.get());
lfoDelay->setTooltip (TRANS("LFO delay between note on & LFO triggering"));
lfoDelay->setRange (0, 100, 1);
lfoDelay->setSliderStyle (Slider::RotaryVerticalDrag);
lfoDelay->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelDelay.reset (new Label ("labelDelay",
TRANS("Delay")));
addAndMakeVisible (labelDelay.get());
labelDelay->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelDelay->setJustificationType (Justification::centred);
labelDelay->setEditable (false, false, false);
labelDelay->setColour (TextEditor::textColourId, Colours::black);
labelDelay->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
labelSpeed.reset (new Label ("labelSpeed",
TRANS("Speed")));
addAndMakeVisible (labelSpeed.get());
labelSpeed->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelSpeed->setJustificationType (Justification::centred);
labelSpeed->setEditable (false, false, false);
labelSpeed->setColour (TextEditor::textColourId, Colours::black);
labelSpeed->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
lfoSpeed.reset (new Slider ("lfoSpeed"));
addAndMakeVisible (lfoSpeed.get());
lfoSpeed->setTooltip (TRANS("LFO speed in 1/100 Hz"));
lfoSpeed->setRange (0, 100, 1);
lfoSpeed->setSliderStyle (Slider::RotaryVerticalDrag);
lfoSpeed->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelVelDly.reset (new Label ("labelVelDly",
TRANS("Vel.>Dly")));
addAndMakeVisible (labelVelDly.get());
labelVelDly->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelVelDly->setJustificationType (Justification::centred);
labelVelDly->setEditable (false, false, false);
labelVelDly->setColour (TextEditor::textColourId, Colours::black);
labelVelDly->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
lfoVelDly.reset (new Slider ("lfoVelDly"));
addAndMakeVisible (lfoVelDly.get());
lfoVelDly->setTooltip (TRANS("Influence of note velocity on LFO delay"));
lfoVelDly->setRange (-100, 100, 1);
lfoVelDly->setSliderStyle (Slider::RotaryVerticalDrag);
lfoVelDly->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelVelLFODpt.reset (new Label ("labelVelLFODpt",
TRANS("Vel.>Dpt")));
addAndMakeVisible (labelVelLFODpt.get());
labelVelLFODpt->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelVelLFODpt->setJustificationType (Justification::centred);
labelVelLFODpt->setEditable (false, false, false);
labelVelLFODpt->setColour (TextEditor::textColourId, Colours::black);
labelVelLFODpt->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
lfoVelDpt.reset (new Slider ("lfoVelDpt"));
addAndMakeVisible (lfoVelDpt.get());
lfoVelDpt->setTooltip (TRANS("Influence of note velocity on LFO depth"));
lfoVelDpt->setRange (0, 100, 1);
lfoVelDpt->setSliderStyle (Slider::RotaryVerticalDrag);
lfoVelDpt->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelVelLFOSpd.reset (new Label ("labelVelLFOSpd",
TRANS("Vel.>Spd")));
addAndMakeVisible (labelVelLFOSpd.get());
labelVelLFOSpd->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelVelLFOSpd->setJustificationType (Justification::centred);
labelVelLFOSpd->setEditable (false, false, false);
labelVelLFOSpd->setColour (TextEditor::textColourId, Colours::black);
labelVelLFOSpd->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
lfoVelSpd.reset (new Slider ("lfoVelSpd"));
addAndMakeVisible (lfoVelSpd.get());
lfoVelSpd->setTooltip (TRANS("Influence of note velocity on LFO speed"));
lfoVelSpd->setRange (0, 100, 1);
lfoVelSpd->setSliderStyle (Slider::RotaryVerticalDrag);
lfoVelSpd->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
copyButton.reset (new TextButton ("copyButton"));
addAndMakeVisible (copyButton.get());
copyButton->setTooltip (TRANS("Copy LFO Parameters"));
copyButton->setButtonText (TRANS("C"));
copyButton->addListener (this);
copyButton->setBounds (201, 56, 24, 24);
pasteButton.reset (new TextButton ("pasteButton"));
addAndMakeVisible (pasteButton.get());
pasteButton->setTooltip (TRANS("Paste LFO Parameters except Depth"));
pasteButton->setButtonText (TRANS("P"));
pasteButton->addListener (this);
pasteButton->setBounds (201, 88, 24, 24);
groupLink.reset (new ComboBox ("groupLink"));
addAndMakeVisible (groupLink.get());
groupLink->setTooltip (TRANS("Group to which this LFO is linked. All LFO of a group have the same parameters."));
groupLink->setEditableText (false);
groupLink->setJustificationType (Justification::centred);
groupLink->setTextWhenNothingSelected (String());
groupLink->setTextWhenNoChoicesAvailable (TRANS("(no choices)"));
groupLink->addListener (this);
//[UserPreSize]
//[/UserPreSize]
setSize (100, 200);
//[Constructor] You can add your own custom stuff here..
//[/Constructor]
}
GuiLFO::~GuiLFO()
{
//[Destructor_pre]. You can add your own custom destruction code here..
mAttachment = nullptr;
//[/Destructor_pre]
lfoDelay = nullptr;
labelDelay = nullptr;
labelSpeed = nullptr;
lfoSpeed = nullptr;
labelVelDly = nullptr;
lfoVelDly = nullptr;
labelVelLFODpt = nullptr;
lfoVelDpt = nullptr;
labelVelLFOSpd = nullptr;
lfoVelSpd = nullptr;
copyButton = nullptr;
pasteButton = nullptr;
groupLink = nullptr;
//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]
}
//==============================================================================
void GuiLFO::paint (Graphics& g)
{
//[UserPrePaint] Add your own custom painting code here..
GroupComponent::paint (g);
//[/UserPrePaint]
//[UserPaint] Add your own custom painting code here..
//[/UserPaint]
}
void GuiLFO::resized()
{
//[UserPreResize] Add your own custom resize code here..
//[/UserPreResize]
lfoDelay->setBounds (68 - (56 / 2), 67 - (72 / 2), 56, 72);
labelDelay->setBounds (68 - (48 / 2), 27 - (24 / 2), 48, 24);
labelSpeed->setBounds (132 - (47 / 2), 15, 47, 24);
lfoSpeed->setBounds (132 - (56 / 2), 31, 56, 72);
labelVelDly->setBounds (36 - (63 / 2), 111 - (24 / 2), 63, 24);
lfoVelDly->setBounds (36 - (56 / 2), 151 - (72 / 2), 56, 72);
labelVelLFODpt->setBounds (100 - (65 / 2), 111 - (24 / 2), 65, 24);
lfoVelDpt->setBounds (100 - (56 / 2), (151 - (72 / 2)) + 72 / 2 - (72 / 2), 56, 72);
labelVelLFOSpd->setBounds (164 - (58 / 2), (111 - (24 / 2)) + 24 / 2 - (24 / 2), 58, 24);
lfoVelSpd->setBounds (164 - (56 / 2), (151 - (72 / 2)) + 72 / 2 - (72 / 2), 56, 72);
groupLink->setBounds (214 - (29 / 2), 36 - (24 / 2), 29, 24);
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
void GuiLFO::buttonClicked (Button* buttonThatWasClicked)
{
//[UserbuttonClicked_Pre]
//[/UserbuttonClicked_Pre]
if (buttonThatWasClicked == copyButton.get())
{
//[UserButtonCode_copyButton] -- add your button handler code here..
mLFOParameters->copyParameters();
//[/UserButtonCode_copyButton]
}
else if (buttonThatWasClicked == pasteButton.get())
{
//[UserButtonCode_pasteButton] -- add your button handler code here..
mLFOParameters->pasteParameters(String(), "LFO");
mLFOParameters->pasteParameters(String(), "MOD LFO");
//[/UserButtonCode_pasteButton]
}
//[UserbuttonClicked_Post]
//[/UserbuttonClicked_Post]
}
void GuiLFO::comboBoxChanged (ComboBox* comboBoxThatHasChanged)
{
//[UsercomboBoxChanged_Pre]
//[/UsercomboBoxChanged_Pre]
if (comboBoxThatHasChanged == groupLink.get())
{
//[UserComboBoxCode_groupLink] -- add your combo box handling code here..
//[/UserComboBoxCode_groupLink]
}
//[UsercomboBoxChanged_Post]
//[/UsercomboBoxChanged_Post]
}
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
void GuiLFO::setParameters(LFOParameters * paramLFO) {
mLFOParameters = paramLFO;
mAttachment = std::make_unique<GuiAttachment>(mLFOParameters->getProcessor());
updateFromParameters();
}
void GuiLFO::updateFromParameters()
{
mAttachment->attachSlider(mLFOParameters->mDelay, *lfoDelay);
mAttachment->attachSlider(mLFOParameters->mFrequency, *lfoSpeed);
mAttachment->attachSlider(mLFOParameters->mVeloDelay, *lfoVelDly);
mAttachment->attachSlider(mLFOParameters->mVeloDepth, *lfoVelDpt);
mAttachment->attachSlider(mLFOParameters->mVeloFreq, *lfoVelSpd);
mAttachment->attachCombobox(mLFOParameters->mLFOLinkGroup, *groupLink);
}
void GuiLFO::copy(LFOParameters * paramLFO)
{
*mLFOParameters->mDelay = float(*paramLFO->mDelay);
*mLFOParameters->mDepth = float(*paramLFO->mDepth);
*mLFOParameters->mFrequency = float(*paramLFO->mFrequency);
*mLFOParameters->mVeloDelay = float(*paramLFO->mVeloDelay);
*mLFOParameters->mVeloDepth = float(*paramLFO->mVeloDepth);
*mLFOParameters->mVeloFreq = float(*paramLFO->mVeloFreq);
}
//[/MiscUserCode]
//==============================================================================
#if 0
/* -- Projucer information section --
This is where the Projucer stores the metadata that describe this GUI layout, so
make changes in here at your peril!
BEGIN_JUCER_METADATA
<JUCER_COMPONENT documentType="Component" className="GuiLFO" componentName="GuiLFO"
parentClasses="public GroupComponent" constructorParams=" const String& name, const String & text"
variableInitialisers="GroupComponent (name, text)" snapPixels="8"
snapActive="1" snapShown="1" overlayOpacity="0.330" fixedSize="0"
initialWidth="100" initialHeight="200">
<BACKGROUND backgroundColour="323e44"/>
<SLIDER name="lfoDelay" id="47970c50792f9c3" memberName="lfoDelay" virtualName=""
explicitFocusOrder="0" pos="68c 67c 56 72" tooltip="LFO delay between note on & LFO triggering"
min="0.0" max="100.0" int="1.0" style="RotaryVerticalDrag" textBoxPos="TextBoxBelow"
textBoxEditable="1" textBoxWidth="40" textBoxHeight="20" skewFactor="1.0"
needsCallback="0"/>
<LABEL name="labelDelay" id="d43004658944c0e8" memberName="labelDelay"
virtualName="" explicitFocusOrder="0" pos="68c 27c 48 24" edTextCol="ff000000"
edBkgCol="0" labelText="Delay" editableSingleClick="0" editableDoubleClick="0"
focusDiscardsChanges="0" fontname="Default font" fontsize="15.0"
kerning="0.0" bold="0" italic="0" justification="36"/>
<LABEL name="labelSpeed" id="4ae73b2f8c1f95e3" memberName="labelSpeed"
virtualName="" explicitFocusOrder="0" pos="131.5c 15 47 24" edTextCol="ff000000"
edBkgCol="0" labelText="Speed" editableSingleClick="0" editableDoubleClick="0"
focusDiscardsChanges="0" fontname="Default font" fontsize="15.0"
kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="lfoSpeed" id="11c6949eea6fa47e" memberName="lfoSpeed" virtualName=""
explicitFocusOrder="0" pos="132c 31 56 72" tooltip="LFO speed in 1/100 Hz"
min="0.0" max="100.0" int="1.0" style="RotaryVerticalDrag" textBoxPos="TextBoxBelow"
textBoxEditable="1" textBoxWidth="40" textBoxHeight="20" skewFactor="1.0"
needsCallback="0"/>
<LABEL name="labelVelDly" id="3d6220fb6c04fae4" memberName="labelVelDly"
virtualName="" explicitFocusOrder="0" pos="35.5c 111c 63 24"
posRelativeY="74953fe0ed9f4c42" edTextCol="ff000000" edBkgCol="0"
labelText="Vel.>Dly" editableSingleClick="0" editableDoubleClick="0"
focusDiscardsChanges="0" fontname="Default font" fontsize="15.0"
kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="lfoVelDly" id="a6517185cd7830f8" memberName="lfoVelDly"
virtualName="" explicitFocusOrder="0" pos="36c 151c 56 72" tooltip="Influence of note velocity on LFO delay"
min="-100.0" max="100.0" int="1.0" style="RotaryVerticalDrag"
textBoxPos="TextBoxBelow" textBoxEditable="1" textBoxWidth="40"
textBoxHeight="20" skewFactor="1.0" needsCallback="0"/>
<LABEL name="labelVelLFODpt" id="2853da8d4d6aa707" memberName="labelVelLFODpt"
virtualName="" explicitFocusOrder="0" pos="100.5c 111c 65 24"
posRelativeY="e085d448c80dad72" edTextCol="ff000000" edBkgCol="0"
labelText="Vel.>Dpt" editableSingleClick="0" editableDoubleClick="0"
focusDiscardsChanges="0" fontname="Default font" fontsize="15.0"
kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="lfoVelDpt" id="796c34174bb612dc" memberName="lfoVelDpt"
virtualName="" explicitFocusOrder="0" pos="100c 0Cc 56 72" posRelativeY="a6517185cd7830f8"
tooltip="Influence of note velocity on LFO depth" min="0.0" max="100.0"
int="1.0" style="RotaryVerticalDrag" textBoxPos="TextBoxBelow"
textBoxEditable="1" textBoxWidth="40" textBoxHeight="20" skewFactor="1.0"
needsCallback="0"/>
<LABEL name="labelVelLFOSpd" id="72044a2e96d5e6fc" memberName="labelVelLFOSpd"
virtualName="" explicitFocusOrder="0" pos="164c 0Cc 58 24" posRelativeY="3d6220fb6c04fae4"
edTextCol="ff000000" edBkgCol="0" labelText="Vel.>Spd" editableSingleClick="0"
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
fontsize="15.0" kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="lfoVelSpd" id="99e268029c12b035" memberName="lfoVelSpd"
virtualName="" explicitFocusOrder="0" pos="164c 0Cc 56 72" posRelativeY="a6517185cd7830f8"
tooltip="Influence of note velocity on LFO speed" min="0.0" max="100.0"
int="1.0" style="RotaryVerticalDrag" textBoxPos="TextBoxBelow"
textBoxEditable="1" textBoxWidth="40" textBoxHeight="20" skewFactor="1.0"
needsCallback="0"/>
<TEXTBUTTON name="copyButton" id="36caa20fb07405f3" memberName="copyButton"
virtualName="" explicitFocusOrder="0" pos="201 56 24 24" tooltip="Copy LFO Parameters"
buttonText="C" connectedEdges="0" needsCallback="1" radioGroupId="0"/>
<TEXTBUTTON name="pasteButton" id="4af5e8f91f632b47" memberName="pasteButton"
virtualName="" explicitFocusOrder="0" pos="201 88 24 24" tooltip="Paste LFO Parameters except Depth"
buttonText="P" connectedEdges="0" needsCallback="1" radioGroupId="0"/>
<COMBOBOX name="groupLink" id="2f4c27038f31a098" memberName="groupLink"
virtualName="" explicitFocusOrder="0" pos="213.5c 36c 29 24"
posRelativeY="2bec03bff2a1a6d8" tooltip="Group to which this LFO is linked. All LFO of a group have the same parameters."
editable="0" layout="36" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/>
</JUCER_COMPONENT>
END_JUCER_METADATA
*/
#endif
//[EndFile] You can add extra defines here...
//[/EndFile]