/*
==============================================================================
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 "GuiTVA.h"
//[MiscUserDefs] You can add your own user definitions and misc code here...
//[/MiscUserDefs]
//==============================================================================
GuiTVA::GuiTVA ( const String& name, const String & text)
: GroupComponent (name, text)
{
//[Constructor_pre] You can add your own custom stuff here..
molossLNF = std::make_unique< MolossLookNFeel>(MolossLookNFeel::GREEN_LNF);
setLookAndFeel(molossLNF.get());
//[/Constructor_pre]
setName ("GuiTVA");
level.reset (new Slider ("level"));
addAndMakeVisible (level.get());
level->setTooltip (TRANS("Output level"));
level->setRange (0, 100, 1);
level->setSliderStyle (Slider::RotaryVerticalDrag);
level->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelLevel.reset (new Label ("labelLevel",
TRANS("Level")));
addAndMakeVisible (labelLevel.get());
labelLevel->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelLevel->setJustificationType (Justification::centredLeft);
labelLevel->setEditable (false, false, false);
labelLevel->setColour (TextEditor::textColourId, Colours::black);
labelLevel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
groupLFO.reset (new GuiLFO ("groupLFO",
TRANS("LFO")));
addAndMakeVisible (groupLFO.get());
groupLFO->setBounds (16, 504, 238, 190);
groupADSR.reset (new GuiADSR ("groupADSR",
TRANS("ADSR")));
addAndMakeVisible (groupADSR.get());
groupADSR->setBounds (8, 312, 256, 200);
levelKF.reset (new Slider ("levelKF"));
addAndMakeVisible (levelKF.get());
levelKF->setTooltip (TRANS("Influence of note on level."));
levelKF->setRange (-100, 100, 1);
levelKF->setSliderStyle (Slider::RotaryVerticalDrag);
levelKF->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelKF.reset (new Label ("labelKF",
TRANS("Key Follow")));
addAndMakeVisible (labelKF.get());
labelKF->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelKF->setJustificationType (Justification::centredLeft);
labelKF->setEditable (false, false, false);
labelKF->setColour (TextEditor::textColourId, Colours::black);
labelKF->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
levelVelo.reset (new Slider ("levelVelo"));
addAndMakeVisible (levelVelo.get());
levelVelo->setTooltip (TRANS("Influence of velocity on level."));
levelVelo->setRange (0, 100, 1);
levelVelo->setSliderStyle (Slider::RotaryVerticalDrag);
levelVelo->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelKF2.reset (new Label ("labelKF",
TRANS("Velo.")));
addAndMakeVisible (labelKF2.get());
labelKF2->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelKF2->setJustificationType (Justification::centredLeft);
labelKF2->setEditable (false, false, false);
labelKF2->setColour (TextEditor::textColourId, Colours::black);
labelKF2->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
copyButton.reset (new TextButton ("copyButton"));
addAndMakeVisible (copyButton.get());
copyButton->setTooltip (TRANS("Copy TVA Parameters"));
copyButton->setButtonText (TRANS("C"));
copyButton->addListener (this);
copyButton->setBounds (224, 56, 24, 24);
pasteButton.reset (new TextButton ("pasteButton"));
addAndMakeVisible (pasteButton.get());
pasteButton->setTooltip (TRANS("Paste TVA Parameters"));
pasteButton->setButtonText (TRANS("P"));
pasteButton->addListener (this);
pasteButton->setBounds (224, 88, 24, 24);
groupLink.reset (new ComboBox ("groupLink"));
addAndMakeVisible (groupLink.get());
groupLink->setTooltip (TRANS("Group to which the TVA of this voice is linked. All voices of a group have the same TVA parameters."));
groupLink->setEditableText (false);
groupLink->setJustificationType (Justification::centred);
groupLink->setTextWhenNothingSelected (String());
groupLink->setTextWhenNoChoicesAvailable (TRANS("(no choices)"));
groupLink->addListener (this);
adsrDepth.reset (new Slider ("adsrDepth"));
addAndMakeVisible (adsrDepth.get());
adsrDepth->setTooltip (TRANS("Envelope depth. 0 is a shortcut for square envelope (ADSR parameters are not used)."));
adsrDepth->setRange (-100, 100, 1);
adsrDepth->setSliderStyle (Slider::RotaryVerticalDrag);
adsrDepth->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelADSRDepth.reset (new Label ("labelADSRDepth",
TRANS("ADSR")));
addAndMakeVisible (labelADSRDepth.get());
labelADSRDepth->setTooltip (TRANS("ADSR Depth"));
labelADSRDepth->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelADSRDepth->setJustificationType (Justification::centred);
labelADSRDepth->setEditable (false, false, false);
labelADSRDepth->setColour (TextEditor::textColourId, Colours::black);
labelADSRDepth->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
lfoDepth.reset (new Slider ("lfoDepth"));
addAndMakeVisible (lfoDepth.get());
lfoDepth->setTooltip (TRANS("LFO depth. Positive and negative values are in phase opposition."));
lfoDepth->setRange (0, 100, 1);
lfoDepth->setSliderStyle (Slider::RotaryVerticalDrag);
lfoDepth->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelDepth.reset (new Label ("labelDepth",
TRANS("LFO")));
addAndMakeVisible (labelDepth.get());
labelDepth->setTooltip (TRANS("LFO Depth"));
labelDepth->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelDepth->setJustificationType (Justification::centred);
labelDepth->setEditable (false, false, false);
labelDepth->setColour (TextEditor::textColourId, Colours::black);
labelDepth->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
//[UserPreSize]
//[/UserPreSize]
setSize (230, 320);
//[Constructor] You can add your own custom stuff here..
//[/Constructor]
}
GuiTVA::~GuiTVA()
{
//[Destructor_pre]. You can add your own custom destruction code here..
mAttachment = nullptr;
setLookAndFeel(nullptr);
//[/Destructor_pre]
level = nullptr;
labelLevel = nullptr;
groupLFO = nullptr;
groupADSR = nullptr;
levelKF = nullptr;
labelKF = nullptr;
levelVelo = nullptr;
labelKF2 = nullptr;
copyButton = nullptr;
pasteButton = nullptr;
groupLink = nullptr;
adsrDepth = nullptr;
labelADSRDepth = nullptr;
lfoDepth = nullptr;
labelDepth = nullptr;
//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]
}
//==============================================================================
void GuiTVA::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 GuiTVA::resized()
{
//[UserPreResize] Add your own custom resize code here..
//[/UserPreResize]
level->setBounds (50 - (56 / 2), 68 - (73 / 2), 56, 73);
labelLevel->setBounds (50 - (47 / 2), 27 - (24 / 2), 47, 24);
levelKF->setBounds (116 - (56 / 2), (68 - (73 / 2)) + 73 / 2 - (73 / 2), 56, 73);
labelKF->setBounds (116 - (67 / 2), (27 - (24 / 2)) + 0, 67, 24);
levelVelo->setBounds (182 - (56 / 2), (68 - (73 / 2)) + 73 / 2 - (73 / 2), 56, 73);
labelKF2->setBounds (182 - (50 / 2), (27 - (24 / 2)) + 0, 50, 24);
groupLink->setBounds (236 - (29 / 2), 37 - (24 / 2), 29, 24);
adsrDepth->setBounds (82 - (56 / 2), 156 - (72 / 2), 56, 72);
labelADSRDepth->setBounds (82 - (47 / 2), 116 - (24 / 2), 47, 24);
lfoDepth->setBounds (149 - (56 / 2), 156 - (72 / 2), 56, 72);
labelDepth->setBounds (150 - (47 / 2), 116 - (24 / 2), 47, 24);
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
void GuiTVA::buttonClicked (Button* buttonThatWasClicked)
{
//[UserbuttonClicked_Pre]
//[/UserbuttonClicked_Pre]
if (buttonThatWasClicked == copyButton.get())
{
//[UserButtonCode_copyButton] -- add your button handler code here..
copy();
//[/UserButtonCode_copyButton]
}
else if (buttonThatWasClicked == pasteButton.get())
{
//[UserButtonCode_pasteButton] -- add your button handler code here..
paste();
//[/UserButtonCode_pasteButton]
}
//[UserbuttonClicked_Post]
//[/UserbuttonClicked_Post]
}
void GuiTVA::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 GuiTVA::copy(String prefix)
{
mTVAParameters->copyParameters(prefix);
}
void GuiTVA::setParameters(TVAParameters * tvaParam) {
groupLFO->setParameters(tvaParam);
groupADSR->setParameters(tvaParam);
mTVAParameters = tvaParam;
mAttachment = std::make_unique<GuiAttachment>(mTVAParameters->getProcessor());
updateFromParameters();
}
void GuiTVA::updateFromParameters()
{
mAttachment->attachSlider(mTVAParameters->mLevel, *level);
mAttachment->attachSlider(mTVAParameters->mKeyFollowLevelDepth, *levelKF);
mAttachment->attachSlider(mTVAParameters->mVelocityLevelDepth, *levelVelo);
mAttachment->attachCombobox(mTVAParameters->mLinkGroup, *groupLink);
mAttachment->attachSlider(mTVAParameters->mADSRDepth, *adsrDepth);
mAttachment->attachSlider(mTVAParameters->mDepth, *lfoDepth);
}
void GuiTVA::paste(String prefix) {
mTVAParameters->pasteParameters(prefix);
}
MolossI & GuiTVA::getProcessor() const { return mTVAParameters->getProcessor(); }
//[/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="GuiTVA" componentName="GuiTVA"
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="230" initialHeight="320">
<BACKGROUND backgroundColour="323e44"/>
<SLIDER name="level" id="47970c50792f9c3" memberName="level" virtualName=""
explicitFocusOrder="0" pos="50c 67.5c 56 73" tooltip="Output level"
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="labelLevel" id="d43004658944c0e8" memberName="labelLevel"
virtualName="" explicitFocusOrder="0" pos="49.5c 27c 47 24" edTextCol="ff000000"
edBkgCol="0" labelText="Level" editableSingleClick="0" editableDoubleClick="0"
focusDiscardsChanges="0" fontname="Default font" fontsize="15.0"
kerning="0.0" bold="0" italic="0" justification="33"/>
<GROUPCOMPONENT name="groupLFO" id="e688a7661f1c7439" memberName="groupLFO" virtualName="GuiLFO"
explicitFocusOrder="0" pos="16 504 238 190" title="LFO"/>
<GROUPCOMPONENT name="groupADSR" id="2631439cf016426b" memberName="groupADSR"
virtualName="GuiADSR" explicitFocusOrder="0" pos="8 312 256 200"
title="ADSR"/>
<SLIDER name="levelKF" id="b7e6cb1119fb52f" memberName="levelKF" virtualName=""
explicitFocusOrder="0" pos="116c 0.5Cc 56 73" posRelativeY="47970c50792f9c3"
tooltip="Influence of note on level." 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="labelKF" id="2d3b4deb139d344" memberName="labelKF" virtualName=""
explicitFocusOrder="0" pos="115.5c 0 67 24" posRelativeY="d43004658944c0e8"
edTextCol="ff000000" edBkgCol="0" labelText="Key Follow" editableSingleClick="0"
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
fontsize="15.0" kerning="0.0" bold="0" italic="0" justification="33"/>
<SLIDER name="levelVelo" id="c27f062555be4c48" memberName="levelVelo"
virtualName="" explicitFocusOrder="0" pos="182c 0.5Cc 56 73"
posRelativeY="47970c50792f9c3" tooltip="Influence of velocity on level."
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="labelKF" id="3ae37effbe68afcf" memberName="labelKF2" virtualName=""
explicitFocusOrder="0" pos="182c 0 50 24" posRelativeY="d43004658944c0e8"
edTextCol="ff000000" edBkgCol="0" labelText="Velo." editableSingleClick="0"
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
fontsize="15.0" kerning="0.0" bold="0" italic="0" justification="33"/>
<TEXTBUTTON name="copyButton" id="36caa20fb07405f3" memberName="copyButton"
virtualName="" explicitFocusOrder="0" pos="224 56 24 24" tooltip="Copy TVA Parameters"
buttonText="C" connectedEdges="0" needsCallback="1" radioGroupId="0"/>
<TEXTBUTTON name="pasteButton" id="4af5e8f91f632b47" memberName="pasteButton"
virtualName="" explicitFocusOrder="0" pos="224 88 24 24" tooltip="Paste TVA Parameters"
buttonText="P" connectedEdges="0" needsCallback="1" radioGroupId="0"/>
<COMBOBOX name="groupLink" id="2f4c27038f31a098" memberName="groupLink"
virtualName="" explicitFocusOrder="0" pos="235.5c 37c 29 24"
posRelativeY="2bec03bff2a1a6d8" tooltip="Group to which the TVA of this voice is linked. All voices of a group have the same TVA parameters."
editable="0" layout="36" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/>
<SLIDER name="adsrDepth" id="1ee1f85231b01491" memberName="adsrDepth"
virtualName="" explicitFocusOrder="0" pos="82c 156c 56 72" tooltip="Envelope depth. 0 is a shortcut for square envelope (ADSR parameters are not used)."
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="labelADSRDepth" id="7f1c016bfd48e1db" memberName="labelADSRDepth"
virtualName="" explicitFocusOrder="0" pos="82.5c 116c 47 24"
tooltip="ADSR Depth" edTextCol="ff000000" edBkgCol="0" labelText="ADSR"
editableSingleClick="0" editableDoubleClick="0" focusDiscardsChanges="0"
fontname="Default font" fontsize="15.0" kerning="0.0" bold="0"
italic="0" justification="36"/>
<SLIDER name="lfoDepth" id="4d6fc8c39c5814ad" memberName="lfoDepth" virtualName=""
explicitFocusOrder="0" pos="149c 156c 56 72" tooltip="LFO depth. Positive and negative values are in phase opposition."
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="labelDepth" id="95c77e6805cb89d2" memberName="labelDepth"
virtualName="" explicitFocusOrder="0" pos="149.5c 116c 47 24"
tooltip="LFO Depth" edTextCol="ff000000" edBkgCol="0" labelText="LFO"
editableSingleClick="0" editableDoubleClick="0" focusDiscardsChanges="0"
fontname="Default font" fontsize="15.0" kerning="0.0" bold="0"
italic="0" justification="36"/>
</JUCER_COMPONENT>
END_JUCER_METADATA
*/
#endif
//[EndFile] You can add extra defines here...
//[/EndFile]