[go: up one dir, main page]

Menu

[r39]: / Source / GuiTVFMod.cpp  Maximize  Restore  History

Download this file

368 lines (313 with data), 18.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
/*
==============================================================================
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 "GuiTVFMod.h"
//[MiscUserDefs] You can add your own user definitions and misc code here...
//[/MiscUserDefs]
//==============================================================================
GUITVFMod::GUITVFMod ( 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::RED_LNF);
setLookAndFeel(molossLNF.get());
//[/Constructor_pre]
setName ("GUITVFMod");
labelBenderFreq.reset (new Label ("labelBenderFreq",
TRANS("Bnd>Freq")));
addAndMakeVisible (labelBenderFreq.get());
labelBenderFreq->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelBenderFreq->setJustificationType (Justification::centred);
labelBenderFreq->setEditable (false, false, false);
labelBenderFreq->setColour (TextEditor::textColourId, Colours::black);
labelBenderFreq->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
benderFreq.reset (new Slider ("benderFreq"));
addAndMakeVisible (benderFreq.get());
benderFreq->setTooltip (TRANS("Influence of bender on filter frequency"));
benderFreq->setRange (0, 100, 1);
benderFreq->setSliderStyle (Slider::RotaryVerticalDrag);
benderFreq->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelAftrFreq.reset (new Label ("labelAftrFreq",
TRANS("Aftr>Freq")));
addAndMakeVisible (labelAftrFreq.get());
labelAftrFreq->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelAftrFreq->setJustificationType (Justification::centred);
labelAftrFreq->setEditable (false, false, false);
labelAftrFreq->setColour (TextEditor::textColourId, Colours::black);
labelAftrFreq->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
aftrFreq.reset (new Slider ("aftrFreq"));
addAndMakeVisible (aftrFreq.get());
aftrFreq->setTooltip (TRANS("Influence of atertouch on filter frequency"));
aftrFreq->setRange (-100, 100, 1);
aftrFreq->setSliderStyle (Slider::RotaryVerticalDrag);
aftrFreq->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
controllerTVFCombo.reset (new ComboBox ("controllerTVFCombo"));
addAndMakeVisible (controllerTVFCombo.get());
controllerTVFCombo->setTooltip (TRANS("Additionnal controller to drive TVF"));
controllerTVFCombo->setEditableText (false);
controllerTVFCombo->setJustificationType (Justification::centredLeft);
controllerTVFCombo->setTextWhenNothingSelected (String());
controllerTVFCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)"));
controllerTVFCombo->addListener (this);
labelCtrlFreq.reset (new Label ("labelCtrlFreq",
TRANS("Ctrl>Freq")));
addAndMakeVisible (labelCtrlFreq.get());
labelCtrlFreq->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelCtrlFreq->setJustificationType (Justification::centred);
labelCtrlFreq->setEditable (false, false, false);
labelCtrlFreq->setColour (TextEditor::textColourId, Colours::black);
labelCtrlFreq->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
ctrlFreq.reset (new Slider ("ctrlFreq"));
addAndMakeVisible (ctrlFreq.get());
ctrlFreq->setTooltip (TRANS("Influence of controller on filter frequency"));
ctrlFreq->setRange (0, 100, 1);
ctrlFreq->setSliderStyle (Slider::RotaryVerticalDrag);
ctrlFreq->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelBenderReso.reset (new Label ("labelBenderReso",
TRANS("Bnd>Reso")));
addAndMakeVisible (labelBenderReso.get());
labelBenderReso->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelBenderReso->setJustificationType (Justification::centred);
labelBenderReso->setEditable (false, false, false);
labelBenderReso->setColour (TextEditor::textColourId, Colours::black);
labelBenderReso->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
benderReso.reset (new Slider ("benderReso"));
addAndMakeVisible (benderReso.get());
benderReso->setTooltip (TRANS("Influence of bender on filter resonance"));
benderReso->setRange (0, 100, 1);
benderReso->setSliderStyle (Slider::RotaryVerticalDrag);
benderReso->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelAftrReso.reset (new Label ("labelAftrReso",
TRANS("Aftr>Reso")));
addAndMakeVisible (labelAftrReso.get());
labelAftrReso->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelAftrReso->setJustificationType (Justification::centred);
labelAftrReso->setEditable (false, false, false);
labelAftrReso->setColour (TextEditor::textColourId, Colours::black);
labelAftrReso->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
aftrReso.reset (new Slider ("aftrReso"));
addAndMakeVisible (aftrReso.get());
aftrReso->setTooltip (TRANS("Influence of atertouch on filter resonance"));
aftrReso->setRange (-100, 100, 1);
aftrReso->setSliderStyle (Slider::RotaryVerticalDrag);
aftrReso->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelCtrlReso.reset (new Label ("labelCtrlReso",
TRANS("Ctrl>Reso")));
addAndMakeVisible (labelCtrlReso.get());
labelCtrlReso->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelCtrlReso->setJustificationType (Justification::centred);
labelCtrlReso->setEditable (false, false, false);
labelCtrlReso->setColour (TextEditor::textColourId, Colours::black);
labelCtrlReso->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
ctrlReso.reset (new Slider ("ctrlReso"));
addAndMakeVisible (ctrlReso.get());
ctrlReso->setTooltip (TRANS("Influence of controller on filter resonance"));
ctrlReso->setRange (0, 100, 1);
ctrlReso->setSliderStyle (Slider::RotaryVerticalDrag);
ctrlReso->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
groupLink.reset (new ComboBox ("groupLink"));
addAndMakeVisible (groupLink.get());
groupLink->setTooltip (TRANS("Group to which this voice TVF MOD is linked. All voices of a group have the same TVF Mod parameters."));
groupLink->setEditableText (false);
groupLink->setJustificationType (Justification::centred);
groupLink->setTextWhenNothingSelected (String());
groupLink->setTextWhenNoChoicesAvailable (TRANS("(no choices)"));
groupLink->addListener (this);
//[UserPreSize]
//[/UserPreSize]
setSize (600, 400);
//[Constructor] You can add your own custom stuff here..
//[/Constructor]
}
GUITVFMod::~GUITVFMod()
{
//[Destructor_pre]. You can add your own custom destruction code here..
mAttachment = nullptr;
setLookAndFeel(nullptr);
//[/Destructor_pre]
labelBenderFreq = nullptr;
benderFreq = nullptr;
labelAftrFreq = nullptr;
aftrFreq = nullptr;
controllerTVFCombo = nullptr;
labelCtrlFreq = nullptr;
ctrlFreq = nullptr;
labelBenderReso = nullptr;
benderReso = nullptr;
labelAftrReso = nullptr;
aftrReso = nullptr;
labelCtrlReso = nullptr;
ctrlReso = nullptr;
groupLink = nullptr;
//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]
}
//==============================================================================
void GUITVFMod::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 GUITVFMod::resized()
{
//[UserPreResize] Add your own custom resize code here..
//[/UserPreResize]
labelBenderFreq->setBounds (52 - (73 / 2), 60 - (24 / 2), 73, 24);
benderFreq->setBounds (52 - (56 / 2), 100 - (72 / 2), 56, 72);
labelAftrFreq->setBounds (120 - (73 / 2), 48, 73, 24);
aftrFreq->setBounds (120 - (56 / 2), (100 - (72 / 2)) + 72 / 2 - (72 / 2), 56, 72);
controllerTVFCombo->setBounds (120 - (176 / 2), 30 - (24 / 2), 176, 24);
labelCtrlFreq->setBounds (188 - (73 / 2), 48, 73, 24);
ctrlFreq->setBounds (188 - (56 / 2), (100 - (72 / 2)) + 72 / 2 - (72 / 2), 56, 72);
labelBenderReso->setBounds (52 - (73 / 2), 144 - (24 / 2), 73, 24);
benderReso->setBounds (52 - (56 / 2), 184 - (72 / 2), 56, 72);
labelAftrReso->setBounds (120 - (73 / 2), (144 - (24 / 2)) + 24 / 2 - (24 / 2), 73, 24);
aftrReso->setBounds (116 - (56 / 2), (184 - (72 / 2)) + 72 / 2 - (72 / 2), 56, 72);
labelCtrlReso->setBounds (188 - (73 / 2), (144 - (24 / 2)) + 24 / 2 - (24 / 2), 73, 24);
ctrlReso->setBounds (188 - (56 / 2), (184 - (72 / 2)) + 72 / 2 - (72 / 2), 56, 72);
groupLink->setBounds (216 - (29 / 2), 228 - (24 / 2), 29, 24);
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
void GUITVFMod::comboBoxChanged (ComboBox* comboBoxThatHasChanged)
{
//[UsercomboBoxChanged_Pre]
//[/UsercomboBoxChanged_Pre]
if (comboBoxThatHasChanged == controllerTVFCombo.get())
{
//[UserComboBoxCode_controllerTVFCombo] -- add your combo box handling code here..
//[/UserComboBoxCode_controllerTVFCombo]
}
else 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 GUITVFMod::setParameters(TVFParameters * tvfParam) {
mTVFParameters = tvfParam;
mAttachment = std::make_unique<GuiAttachment>(mTVFParameters->getProcessor());
updateFromParameters();
}
void GUITVFMod::updateFromParameters() {
mAttachment->attachSlider(mTVFParameters->mPitchWheelCutoffDepth, *benderFreq);
mAttachment->attachSlider(mTVFParameters->mAfterTouchCutoffDepth, *aftrFreq);
mAttachment->attachSlider(mTVFParameters->mControllerCutoffDepth, *ctrlFreq);
mAttachment->attachSlider(mTVFParameters->mPitchWheelResonanceDepth, *benderReso);
mAttachment->attachSlider(mTVFParameters->mAfterTouchResonanceDepth, *aftrReso);
mAttachment->attachSlider(mTVFParameters->mControllerResonanceDepth, *ctrlReso);
mAttachment->attachCombobox(mTVFParameters->mControlNumber, *controllerTVFCombo);
mAttachment->attachCombobox(mTVFParameters->mModLinkGroup, *groupLink);
}
//[/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="GUITVFMod" componentName="GUITVFMod"
parentClasses="public GroupComponent" constructorParams=" const String&amp; name, const String &amp; text"
variableInitialisers="GroupComponent (name, text)&#10;" snapPixels="8"
snapActive="1" snapShown="1" overlayOpacity="0.330" fixedSize="0"
initialWidth="600" initialHeight="400">
<BACKGROUND backgroundColour="323e44"/>
<LABEL name="labelBenderFreq" id="5962b9b394ef3ffe" memberName="labelBenderFreq"
virtualName="" explicitFocusOrder="0" pos="52.5c 60c 73 24" edTextCol="ff000000"
edBkgCol="0" labelText="Bnd&gt;Freq" editableSingleClick="0"
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
fontsize="15.0" kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="benderFreq" id="ef267dc30588d4" memberName="benderFreq"
virtualName="" explicitFocusOrder="0" pos="52c 100c 56 72" posRelativeX="b8a5ef2d0601f570"
posRelativeY="b8a5ef2d0601f570" tooltip="Influence of bender on filter frequency"
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="labelAftrFreq" id="11b27eb3a1efb597" memberName="labelAftrFreq"
virtualName="" explicitFocusOrder="0" pos="120.5c 48 73 24" edTextCol="ff000000"
edBkgCol="0" labelText="Aftr&gt;Freq" editableSingleClick="0"
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
fontsize="15.0" kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="aftrFreq" id="7af95f84a2b08150" memberName="aftrFreq" virtualName=""
explicitFocusOrder="0" pos="120c 0Cc 56 72" posRelativeX="b8a5ef2d0601f570"
posRelativeY="ef267dc30588d4" tooltip="Influence of atertouch on filter frequency"
min="-100.0" max="100.0" int="1.0" style="RotaryVerticalDrag"
textBoxPos="TextBoxBelow" textBoxEditable="1" textBoxWidth="40"
textBoxHeight="20" skewFactor="1.0" needsCallback="0"/>
<COMBOBOX name="controllerTVFCombo" id="654ddd4ac2c2be99" memberName="controllerTVFCombo"
virtualName="" explicitFocusOrder="0" pos="120c 30c 176 24" tooltip="Additionnal controller to drive TVF"
editable="0" layout="33" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/>
<LABEL name="labelCtrlFreq" id="4e6e16c4c07d42fc" memberName="labelCtrlFreq"
virtualName="" explicitFocusOrder="0" pos="188.5c 48 73 24" edTextCol="ff000000"
edBkgCol="0" labelText="Ctrl&gt;Freq" editableSingleClick="0"
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
fontsize="15.0" kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="ctrlFreq" id="1b596392560503de" memberName="ctrlFreq" virtualName=""
explicitFocusOrder="0" pos="188c 0Cc 56 72" posRelativeX="b8a5ef2d0601f570"
posRelativeY="ef267dc30588d4" tooltip="Influence of controller on filter frequency"
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="labelBenderReso" id="7bf8fc178722c530" memberName="labelBenderReso"
virtualName="" explicitFocusOrder="0" pos="52.5c 144c 73 24"
edTextCol="ff000000" edBkgCol="0" labelText="Bnd&gt;Reso" editableSingleClick="0"
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
fontsize="15.0" kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="benderReso" id="ea4c9f0e4d9e1135" memberName="benderReso"
virtualName="" explicitFocusOrder="0" pos="52c 184c 56 72" posRelativeX="b8a5ef2d0601f570"
posRelativeY="b8a5ef2d0601f570" tooltip="Influence of bender on filter resonance"
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="labelAftrReso" id="f4e54585b0bf4b9d" memberName="labelAftrReso"
virtualName="" explicitFocusOrder="0" pos="120.5c 0Cc 73 24"
posRelativeY="7bf8fc178722c530" edTextCol="ff000000" edBkgCol="0"
labelText="Aftr&gt;Reso" editableSingleClick="0" editableDoubleClick="0"
focusDiscardsChanges="0" fontname="Default font" fontsize="15.0"
kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="aftrReso" id="bddf6afc41091bee" memberName="aftrReso" virtualName=""
explicitFocusOrder="0" pos="116c 0Cc 56 72" posRelativeX="b8a5ef2d0601f570"
posRelativeY="ea4c9f0e4d9e1135" tooltip="Influence of atertouch on filter resonance"
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="labelCtrlReso" id="19ce5d5ebc456bb3" memberName="labelCtrlReso"
virtualName="" explicitFocusOrder="0" pos="188.5c 0Cc 73 24"
posRelativeY="7bf8fc178722c530" edTextCol="ff000000" edBkgCol="0"
labelText="Ctrl&gt;Reso" editableSingleClick="0" editableDoubleClick="0"
focusDiscardsChanges="0" fontname="Default font" fontsize="15.0"
kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="ctrlReso" id="fc497eb7d6a5e815" memberName="ctrlReso" virtualName=""
explicitFocusOrder="0" pos="188c 0Cc 56 72" posRelativeX="b8a5ef2d0601f570"
posRelativeY="ea4c9f0e4d9e1135" tooltip="Influence of controller on filter resonance"
min="0.0" max="100.0" int="1.0" style="RotaryVerticalDrag" textBoxPos="TextBoxBelow"
textBoxEditable="1" textBoxWidth="40" textBoxHeight="20" skewFactor="1.0"
needsCallback="0"/>
<COMBOBOX name="groupLink" id="2f4c27038f31a098" memberName="groupLink"
virtualName="" explicitFocusOrder="0" pos="216.5c 228c 29 24"
posRelativeY="2bec03bff2a1a6d8" tooltip="Group to which this voice TVF MOD is linked. All voices of a group have the same TVF Mod parameters."
editable="0" layout="36" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/>
</JUCER_COMPONENT>
END_JUCER_METADATA
*/
#endif
//[EndFile] You can add extra defines here...
//[/EndFile]