/*
==============================================================================
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"
//[/Headers]
#include "GuiTVF.h"
//[MiscUserDefs] You can add your own user definitions and misc code here...
//[/MiscUserDefs]
//==============================================================================
GuiTVF::GuiTVF ( const String& name, const String & text)
: GroupComponent (name, text)
{
//[Constructor_pre] You can add your own custom stuff here..
//[/Constructor_pre]
setName ("GuiTVF");
frequency.reset (new Slider ("frequency"));
addAndMakeVisible (frequency.get());
frequency->setTooltip (TRANS("Filter cutoff frequency"));
frequency->setRange (0, 100, 1);
frequency->setSliderStyle (Slider::Rotary);
frequency->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelFreq.reset (new Label ("labelFreq",
TRANS("Freq.")));
addAndMakeVisible (labelFreq.get());
labelFreq->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelFreq->setJustificationType (Justification::centredLeft);
labelFreq->setEditable (false, false, false);
labelFreq->setColour (TextEditor::textColourId, Colours::black);
labelFreq->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
labelFreq->setBounds (25, 9, 47, 24);
groupLFO.reset (new GuiLFO ("groupLFO",
TRANS("LFO")));
addAndMakeVisible (groupLFO.get());
groupLFO->setBounds (17, 209, 238, 200);
groupADSR.reset (new GuiADSR ("groupADSR",
TRANS("ADSR")));
addAndMakeVisible (groupADSR.get());
resonance.reset (new Slider ("frequency"));
addAndMakeVisible (resonance.get());
resonance->setTooltip (TRANS("Filter cutoff resonance"));
resonance->setRange (0, 100, 1);
resonance->setSliderStyle (Slider::Rotary);
resonance->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelReso.reset (new Label ("labelReso",
TRANS("Reso.")));
addAndMakeVisible (labelReso.get());
labelReso->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelReso->setJustificationType (Justification::centredLeft);
labelReso->setEditable (false, false, false);
labelReso->setColour (TextEditor::textColourId, Colours::black);
labelReso->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
labelReso->setBounds (25, 104, 47, 24);
freqKF.reset (new Slider ("freqKF"));
addAndMakeVisible (freqKF.get());
freqKF->setTooltip (TRANS("Key Follow : Influence of note on filter frequency"));
freqKF->setRange (-100, 100, 1);
freqKF->setSliderStyle (Slider::Rotary);
freqKF->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelFreqKF.reset (new Label ("labelFreqKF",
TRANS("KF>Freq")));
addAndMakeVisible (labelFreqKF.get());
labelFreqKF->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelFreqKF->setJustificationType (Justification::centred);
labelFreqKF->setEditable (false, false, false);
labelFreqKF->setColour (TextEditor::textColourId, Colours::black);
labelFreqKF->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
freqVel.reset (new Slider ("freqVel"));
addAndMakeVisible (freqVel.get());
freqVel->setTooltip (TRANS("Influence of velocity on filter frequency. The louder the brighter."));
freqVel->setRange (0, 100, 1);
freqVel->setSliderStyle (Slider::Rotary);
freqVel->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelFreqVel.reset (new Label ("labelFreqVel",
TRANS("Vel>Freq")));
addAndMakeVisible (labelFreqVel.get());
labelFreqVel->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelFreqVel->setJustificationType (Justification::centred);
labelFreqVel->setEditable (false, false, false);
labelFreqVel->setColour (TextEditor::textColourId, Colours::black);
labelFreqVel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
resKF.reset (new Slider ("resKF"));
addAndMakeVisible (resKF.get());
resKF->setTooltip (TRANS("Key Follow : Influence of note on filter resonance"));
resKF->setRange (-100, 100, 1);
resKF->setSliderStyle (Slider::Rotary);
resKF->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelResKF.reset (new Label ("labelResKF",
TRANS("KF>Res")));
addAndMakeVisible (labelResKF.get());
labelResKF->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelResKF->setJustificationType (Justification::centred);
labelResKF->setEditable (false, false, false);
labelResKF->setColour (TextEditor::textColourId, Colours::black);
labelResKF->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
resVel.reset (new Slider ("resVel"));
addAndMakeVisible (resVel.get());
resVel->setTooltip (TRANS("Influence of velocity on the filter resonance."));
resVel->setRange (0, 100, 1);
resVel->setSliderStyle (Slider::Rotary);
resVel->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelFreqVel2.reset (new Label ("labelFreqVel",
TRANS("Vel>Res")));
addAndMakeVisible (labelFreqVel2.get());
labelFreqVel2->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelFreqVel2->setJustificationType (Justification::centred);
labelFreqVel2->setEditable (false, false, false);
labelFreqVel2->setColour (TextEditor::textColourId, Colours::black);
labelFreqVel2->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
copyButton.reset (new TextButton ("copyButton"));
addAndMakeVisible (copyButton.get());
copyButton->setTooltip (TRANS("Copy TVF Parameters"));
copyButton->setButtonText (TRANS("C"));
copyButton->addListener (this);
copyButton->setBounds (230, 35, 24, 24);
pasteButton.reset (new TextButton ("pasteButton"));
addAndMakeVisible (pasteButton.get());
pasteButton->setTooltip (TRANS("Paste TVF Parameters"));
pasteButton->setButtonText (TRANS("P"));
pasteButton->addListener (this);
pasteButton->setBounds (230, 67, 24, 24);
//[UserPreSize]
//[/UserPreSize]
setSize (230, 320);
//[Constructor] You can add your own custom stuff here..
//[/Constructor]
}
GuiTVF::~GuiTVF()
{
//[Destructor_pre]. You can add your own custom destruction code here..
mAttachment = nullptr;
//[/Destructor_pre]
frequency = nullptr;
labelFreq = nullptr;
groupLFO = nullptr;
groupADSR = nullptr;
resonance = nullptr;
labelReso = nullptr;
freqKF = nullptr;
labelFreqKF = nullptr;
freqVel = nullptr;
labelFreqVel = nullptr;
resKF = nullptr;
labelResKF = nullptr;
resVel = nullptr;
labelFreqVel2 = nullptr;
copyButton = nullptr;
pasteButton = nullptr;
//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]
}
//==============================================================================
void GuiTVF::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 GuiTVF::resized()
{
//[UserPreResize] Add your own custom resize code here..
//[/UserPreResize]
frequency->setBounds (25 + 47 / 2 - (56 / 2), 9 + 52 - (72 / 2), 56, 72);
groupADSR->setBounds (8, 209 + 200 - -1, 256, 230);
resonance->setBounds (25 + -5, 9 + 147 - (72 / 2), 56, 72);
freqKF->setBounds (92 + 57 / 2 - (56 / 2), 9 + 52 - (72 / 2), 56, 72);
labelFreqKF->setBounds (92, 9 + 0, 57, 24);
freqVel->setBounds (158 + 68 / 2 - (56 / 2), 9 + 52 - (72 / 2), 56, 72);
labelFreqVel->setBounds (158, 9 + 0, 68, 24);
resKF->setBounds (92 + 57 / 2 - (56 / 2), 9 + 147 - (72 / 2), 56, 72);
labelResKF->setBounds (89, 9 + 95, 54, 24);
resVel->setBounds (158 + 68 / 2 - (56 / 2), 9 + 147 - (72 / 2), 56, 72);
labelFreqVel2->setBounds (161, 9 + 95, 56, 24);
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
void GuiTVF::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]
}
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
void GuiTVF::copy(String prefix)
{
mTVFParameters->copyParameters(prefix);
}
void GuiTVF::setParameters(TVFParameters * tvfParam) {
groupLFO->setParameters(tvfParam);
groupADSR->setParameters(tvfParam);
mTVFParameters = tvfParam;
mAttachment = std::make_unique<GuiAttachment>(mTVFParameters->getProcessor());
updateFromParameters();
}
void GuiTVF::updateFromParameters()
{
mAttachment->attachSlider(mTVFParameters->mFrequency, *frequency);
mAttachment->attachSlider(mTVFParameters->mKeyFollowCutoffDepth, *freqKF);
mAttachment->attachSlider(mTVFParameters->mVelocityCutoffDepth, *freqVel);
mAttachment->attachSlider(mTVFParameters->mResonance, *resonance);
mAttachment->attachSlider(mTVFParameters->mKeyFollowResonanceDepth, *resKF);
mAttachment->attachSlider(mTVFParameters->mVelocityResonanceDepth, *resVel);
}
void GuiTVF::paste(String prefix) {
mTVFParameters->pasteParameters(prefix);
}
//[/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="GuiTVF" componentName="GuiTVF"
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="frequency" id="47970c50792f9c3" memberName="frequency"
virtualName="" explicitFocusOrder="0" pos="0Cc 52c 56 72" posRelativeX="d43004658944c0e8"
posRelativeY="d43004658944c0e8" tooltip="Filter cutoff frequency"
min="0.0" max="100.0" int="1.0" style="Rotary" textBoxPos="TextBoxBelow"
textBoxEditable="1" textBoxWidth="40" textBoxHeight="20" skewFactor="1.0"
needsCallback="0"/>
<LABEL name="labelFreq" id="d43004658944c0e8" memberName="labelFreq"
virtualName="" explicitFocusOrder="0" pos="25 9 47 24" edTextCol="ff000000"
edBkgCol="0" labelText="Freq." 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="17 209 238 200" title="LFO"/>
<GROUPCOMPONENT name="groupADSR" id="2631439cf016426b" memberName="groupADSR"
virtualName="GuiADSR" explicitFocusOrder="0" pos="8 -1R 256 230"
posRelativeY="e688a7661f1c7439" title="ADSR"/>
<SLIDER name="frequency" id="7b09eb2a44617626" memberName="resonance"
virtualName="" explicitFocusOrder="0" pos="-5 147c 56 72" posRelativeX="d43004658944c0e8"
posRelativeY="d43004658944c0e8" tooltip="Filter cutoff resonance"
min="0.0" max="100.0" int="1.0" style="Rotary" textBoxPos="TextBoxBelow"
textBoxEditable="1" textBoxWidth="40" textBoxHeight="20" skewFactor="1.0"
needsCallback="0"/>
<LABEL name="labelReso" id="7acf27dca0f8051b" memberName="labelReso"
virtualName="" explicitFocusOrder="0" pos="25 104 47 24" edTextCol="ff000000"
edBkgCol="0" labelText="Reso." editableSingleClick="0" editableDoubleClick="0"
focusDiscardsChanges="0" fontname="Default font" fontsize="15.0"
kerning="0.0" bold="0" italic="0" justification="33"/>
<SLIDER name="freqKF" id="a32dbe13d7e1341a" memberName="freqKF" virtualName=""
explicitFocusOrder="0" pos="0Cc 52c 56 72" posRelativeX="b61445e063006a7b"
posRelativeY="d43004658944c0e8" tooltip="Key Follow : Influence of note on filter frequency"
min="-100.0" max="100.0" int="1.0" style="Rotary" textBoxPos="TextBoxBelow"
textBoxEditable="1" textBoxWidth="40" textBoxHeight="20" skewFactor="1.0"
needsCallback="0"/>
<LABEL name="labelFreqKF" id="b61445e063006a7b" memberName="labelFreqKF"
virtualName="" explicitFocusOrder="0" pos="92 0 57 24" posRelativeY="d43004658944c0e8"
edTextCol="ff000000" edBkgCol="0" labelText="KF>Freq" editableSingleClick="0"
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
fontsize="15.0" kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="freqVel" id="bdbf34623bb6dec7" memberName="freqVel" virtualName=""
explicitFocusOrder="0" pos="0Cc 52c 56 72" posRelativeX="853e2985b4bce468"
posRelativeY="d43004658944c0e8" tooltip="Influence of velocity on filter frequency. The louder the brighter."
min="0.0" max="100.0" int="1.0" style="Rotary" textBoxPos="TextBoxBelow"
textBoxEditable="1" textBoxWidth="40" textBoxHeight="20" skewFactor="1.0"
needsCallback="0"/>
<LABEL name="labelFreqVel" id="853e2985b4bce468" memberName="labelFreqVel"
virtualName="" explicitFocusOrder="0" pos="158 0 68 24" posRelativeY="d43004658944c0e8"
edTextCol="ff000000" edBkgCol="0" labelText="Vel>Freq" editableSingleClick="0"
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
fontsize="15.0" kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="resKF" id="c3bdad3e25daaa0c" memberName="resKF" virtualName=""
explicitFocusOrder="0" pos="0Cc 147c 56 72" posRelativeX="b61445e063006a7b"
posRelativeY="d43004658944c0e8" tooltip="Key Follow : Influence of note on filter resonance"
min="-100.0" max="100.0" int="1.0" style="Rotary" textBoxPos="TextBoxBelow"
textBoxEditable="1" textBoxWidth="40" textBoxHeight="20" skewFactor="1.0"
needsCallback="0"/>
<LABEL name="labelResKF" id="c6e77fa30c870147" memberName="labelResKF"
virtualName="" explicitFocusOrder="0" pos="89 95 54 24" posRelativeY="d43004658944c0e8"
edTextCol="ff000000" edBkgCol="0" labelText="KF>Res" editableSingleClick="0"
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
fontsize="15.0" kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="resVel" id="4f5cd10a51774281" memberName="resVel" virtualName=""
explicitFocusOrder="0" pos="0Cc 147c 56 72" posRelativeX="853e2985b4bce468"
posRelativeY="d43004658944c0e8" tooltip="Influence of velocity on the filter resonance."
min="0.0" max="100.0" int="1.0" style="Rotary" textBoxPos="TextBoxBelow"
textBoxEditable="1" textBoxWidth="40" textBoxHeight="20" skewFactor="1.0"
needsCallback="0"/>
<LABEL name="labelFreqVel" id="749c1185791758a1" memberName="labelFreqVel2"
virtualName="" explicitFocusOrder="0" pos="161 95 56 24" posRelativeY="d43004658944c0e8"
edTextCol="ff000000" edBkgCol="0" labelText="Vel>Res" editableSingleClick="0"
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
fontsize="15.0" kerning="0.0" bold="0" italic="0" justification="36"/>
<TEXTBUTTON name="copyButton" id="36caa20fb07405f3" memberName="copyButton"
virtualName="" explicitFocusOrder="0" pos="230 35 24 24" tooltip="Copy TVF Parameters"
buttonText="C" connectedEdges="0" needsCallback="1" radioGroupId="0"/>
<TEXTBUTTON name="pasteButton" id="4af5e8f91f632b47" memberName="pasteButton"
virtualName="" explicitFocusOrder="0" pos="230 67 24 24" tooltip="Paste TVF Parameters"
buttonText="P" connectedEdges="0" needsCallback="1" radioGroupId="0"/>
</JUCER_COMPONENT>
END_JUCER_METADATA
*/
#endif
//[EndFile] You can add extra defines here...
//[/EndFile]