[go: up one dir, main page]

Menu

[r41]: / Source / GuiTVA.cpp  Maximize  Restore  History

Download this file

396 lines (329 with data), 17.8 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
/*
==============================================================================
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&amp; name, const String &amp; 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]