/*
==============================================================================
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 "GuiLFO.h"
#include "GuiADSR.h"
#include "AudioParameters.h"
//[/Headers]
#include "GuiPitch.h"
//[MiscUserDefs] You can add your own user definitions and misc code here...
//[/MiscUserDefs]
//==============================================================================
GuiPitch::GuiPitch ( 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::CYAN_LNF);
setLookAndFeel(molossLNF.get());
//[/Constructor_pre]
setName ("GuiPitch");
labelCoarse.reset (new Label ("labelCoarse",
TRANS("Coarse")));
addAndMakeVisible (labelCoarse.get());
labelCoarse->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelCoarse->setJustificationType (Justification::centred);
labelCoarse->setEditable (false, false, false);
labelCoarse->setColour (TextEditor::textColourId, Colours::black);
labelCoarse->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
coarseSlider.reset (new Slider ("coarseSlider"));
addAndMakeVisible (coarseSlider.get());
coarseSlider->setTooltip (TRANS("Coarse pitch in semi-tones. 0 means A4 key is 400 Hz."));
coarseSlider->setRange (-24, 24, 1);
coarseSlider->setSliderStyle (Slider::RotaryVerticalDrag);
coarseSlider->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelFine.reset (new Label ("labelFine",
TRANS("Fine")));
addAndMakeVisible (labelFine.get());
labelFine->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelFine->setJustificationType (Justification::centred);
labelFine->setEditable (false, false, false);
labelFine->setColour (TextEditor::textColourId, Colours::black);
labelFine->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
fineSlider.reset (new Slider ("fineSlider"));
addAndMakeVisible (fineSlider.get());
fineSlider->setTooltip (TRANS("Fine pitch in cents of semi-tones."));
fineSlider->setRange (-50, 50, 1);
fineSlider->setSliderStyle (Slider::RotaryVerticalDrag);
fineSlider->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
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, 253, 200);
keyFollow.reset (new Label ("keyFollow",
TRANS("KF")));
addAndMakeVisible (keyFollow.get());
keyFollow->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
keyFollow->setJustificationType (Justification::centred);
keyFollow->setEditable (false, false, false);
keyFollow->setColour (TextEditor::textColourId, Colours::black);
keyFollow->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
kfSlider.reset (new Slider ("kfSlider"));
addAndMakeVisible (kfSlider.get());
kfSlider->setTooltip (TRANS("Pitch KeyFollow in cents of semitone per note. 100 is one semi-tone per note (normal pitch)."));
kfSlider->setRange (-200, 200, 1);
kfSlider->setSliderStyle (Slider::RotaryVerticalDrag);
kfSlider->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
copyButton.reset (new TextButton ("copyButton"));
addAndMakeVisible (copyButton.get());
copyButton->setTooltip (TRANS("Copy Pitch 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 Pitch 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 pitch of this voice is linked. All voices of a group have the same pitch 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 (600, 400);
//[Constructor] You can add your own custom stuff here..
//[/Constructor]
}
GuiPitch::~GuiPitch()
{
//[Destructor_pre]. You can add your own custom destruction code here..
mAttachment = nullptr;
setLookAndFeel(nullptr);
//[/Destructor_pre]
labelCoarse = nullptr;
coarseSlider = nullptr;
labelFine = nullptr;
fineSlider = nullptr;
groupLFO = nullptr;
groupADSR = nullptr;
keyFollow = nullptr;
kfSlider = 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 GuiPitch::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 GuiPitch::resized()
{
//[UserPreResize] Add your own custom resize code here..
//[/UserPreResize]
labelCoarse->setBounds (50 - (47 / 2), 27 - (24 / 2), 47, 24);
coarseSlider->setBounds (50 - (56 / 2), (27 - (24 / 2)) + 16, 56, 72);
labelFine->setBounds (116 - (47 / 2), (27 - (24 / 2)) + 24 / 2 - (24 / 2), 47, 24);
fineSlider->setBounds (116 - (56 / 2), ((27 - (24 / 2)) + 16) + 0, 56, 72);
keyFollow->setBounds (182 - (47 / 2), (27 - (24 / 2)) + 24 / 2 - (24 / 2), 47, 24);
kfSlider->setBounds (182 - (56 / 2), ((27 - (24 / 2)) + 16) + 0, 56, 72);
groupLink->setBounds (236 - (29 / 2), 37 - (24 / 2), 29, 24);
adsrDepth->setBounds (83 - (56 / 2), 151 - (72 / 2), 56, 72);
labelADSRDepth->setBounds (84 - (47 / 2), 111 - (24 / 2), 47, 24);
lfoDepth->setBounds (149 - (56 / 2), 151 - (72 / 2), 56, 72);
labelDepth->setBounds (150 - (47 / 2), 111 - (24 / 2), 47, 24);
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
void GuiPitch::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 GuiPitch::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 GuiPitch::setParameters(PitchParameters * pitchParam) {
mPitchParameters = pitchParam;
groupADSR->setParameters(pitchParam);
groupLFO->setParameters(pitchParam);
mAttachment = std::make_unique<GuiAttachment>(mPitchParameters->getProcessor());
updateFromParameters();
}
void GuiPitch::updateFromParameters()
{
mAttachment->attachSlider(mPitchParameters->mCoarse, *coarseSlider);
mAttachment->attachSlider(mPitchParameters->mFine, *fineSlider);
mAttachment->attachSlider(mPitchParameters->mKeyFollow, *kfSlider);
mAttachment->attachCombobox(mPitchParameters->mLinkGroup, *groupLink);
mAttachment->attachSlider(mPitchParameters->mADSRDepth, *adsrDepth);
mAttachment->attachSlider(mPitchParameters->mDepth, *lfoDepth);
}
void GuiPitch::paste(String prefix) {
mPitchParameters->pasteParameters(prefix);
}
void GuiPitch::copy(String prefix) {
mPitchParameters->copyParameters(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="GuiPitch" componentName="GuiPitch"
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="600" initialHeight="400">
<BACKGROUND backgroundColour="323e44"/>
<LABEL name="labelCoarse" id="ddf178a525ed6f14" memberName="labelCoarse"
virtualName="" explicitFocusOrder="0" pos="49.5c 27c 47 24" edTextCol="ff000000"
edBkgCol="0" labelText="Coarse" editableSingleClick="0" editableDoubleClick="0"
focusDiscardsChanges="0" fontname="Default font" fontsize="15.0"
kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="coarseSlider" id="586690c5050f6d69" memberName="coarseSlider"
virtualName="" explicitFocusOrder="0" pos="50c 16 56 72" posRelativeY="ddf178a525ed6f14"
tooltip="Coarse pitch in semi-tones. 0 means A4 key is 400 Hz."
min="-24.0" max="24.0" int="1.0" style="RotaryVerticalDrag" textBoxPos="TextBoxBelow"
textBoxEditable="1" textBoxWidth="40" textBoxHeight="20" skewFactor="1.0"
needsCallback="0"/>
<LABEL name="labelFine" id="3c93d39de5afafb4" memberName="labelFine"
virtualName="" explicitFocusOrder="0" pos="115.5c 0Cc 47 24"
posRelativeY="ddf178a525ed6f14" edTextCol="ff000000" edBkgCol="0"
labelText="Fine" editableSingleClick="0" editableDoubleClick="0"
focusDiscardsChanges="0" fontname="Default font" fontsize="15.0"
kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="fineSlider" id="c64ccea4e8040931" memberName="fineSlider"
virtualName="" explicitFocusOrder="0" pos="116c 0 56 72" posRelativeY="586690c5050f6d69"
tooltip="Fine pitch in cents of semi-tones." min="-50.0" max="50.0"
int="1.0" style="RotaryVerticalDrag" textBoxPos="TextBoxBelow"
textBoxEditable="1" textBoxWidth="40" textBoxHeight="20" skewFactor="1.0"
needsCallback="0"/>
<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 253 200"
title="ADSR"/>
<LABEL name="keyFollow" id="1fcf2f01a92aba57" memberName="keyFollow"
virtualName="" explicitFocusOrder="0" pos="181.5c 0Cc 47 24"
posRelativeY="ddf178a525ed6f14" edTextCol="ff000000" edBkgCol="0"
labelText="KF" editableSingleClick="0" editableDoubleClick="0"
focusDiscardsChanges="0" fontname="Default font" fontsize="15.0"
kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="kfSlider" id="326bb555d48d4078" memberName="kfSlider" virtualName=""
explicitFocusOrder="0" pos="182c 0 56 72" posRelativeY="586690c5050f6d69"
tooltip="Pitch KeyFollow in cents of semitone per note. 100 is one semi-tone per note (normal pitch)."
min="-200.0" max="200.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="224 56 24 24" tooltip="Copy Pitch 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 Pitch 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 pitch of this voice is linked. All voices of a group have the same pitch parameters."
editable="0" layout="36" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/>
<SLIDER name="adsrDepth" id="1ee1f85231b01491" memberName="adsrDepth"
virtualName="" explicitFocusOrder="0" pos="83c 151c 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="83.5c 111c 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 151c 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 111c 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]