[go: up one dir, main page]

Menu

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

Download this file

304 lines (254 with data), 14.7 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
/*
==============================================================================
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 "GuiTVAMod.h"
//[MiscUserDefs] You can add your own user definitions and misc code here...
//[/MiscUserDefs]
//==============================================================================
GUITVAMod::GUITVAMod ( 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 ("GUITVAMod");
controllerTVACombo.reset (new ComboBox ("controllerTVACombo"));
addAndMakeVisible (controllerTVACombo.get());
controllerTVACombo->setTooltip (TRANS("Additionnal controller to drive TVA"));
controllerTVACombo->setEditableText (false);
controllerTVACombo->setJustificationType (Justification::centredLeft);
controllerTVACombo->setTextWhenNothingSelected (String());
controllerTVACombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)"));
controllerTVACombo->addListener (this);
labelAftrLvl.reset (new Label ("labelAftrLvl",
TRANS("Aftr>Level")));
addAndMakeVisible (labelAftrLvl.get());
labelAftrLvl->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelAftrLvl->setJustificationType (Justification::centred);
labelAftrLvl->setEditable (false, false, false);
labelAftrLvl->setColour (TextEditor::textColourId, Colours::black);
labelAftrLvl->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
aftrLevel.reset (new Slider ("aftrLevel"));
addAndMakeVisible (aftrLevel.get());
aftrLevel->setTooltip (TRANS("Influence of atertouch on level"));
aftrLevel->setRange (-100, 100, 1);
aftrLevel->setSliderStyle (Slider::RotaryVerticalDrag);
aftrLevel->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelCtrlLvl.reset (new Label ("labelCtrlLvl",
TRANS("Ctrl>Level")));
addAndMakeVisible (labelCtrlLvl.get());
labelCtrlLvl->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelCtrlLvl->setJustificationType (Justification::centred);
labelCtrlLvl->setEditable (false, false, false);
labelCtrlLvl->setColour (TextEditor::textColourId, Colours::black);
labelCtrlLvl->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
ctrlLevel.reset (new Slider ("ctrlLevel"));
addAndMakeVisible (ctrlLevel.get());
ctrlLevel->setTooltip (TRANS("Influence of controller on level"));
ctrlLevel->setRange (0, 100, 1);
ctrlLevel->setSliderStyle (Slider::RotaryVerticalDrag);
ctrlLevel->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelHoldRelease.reset (new Label ("labelHoldRelease",
TRANS("Hold>Release")));
addAndMakeVisible (labelHoldRelease.get());
labelHoldRelease->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelHoldRelease->setJustificationType (Justification::centred);
labelHoldRelease->setEditable (false, false, false);
labelHoldRelease->setColour (TextEditor::textColourId, Colours::black);
labelHoldRelease->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
holdReleaseLevel.reset (new Slider ("holdReleaseLevel"));
addAndMakeVisible (holdReleaseLevel.get());
holdReleaseLevel->setTooltip (TRANS("Influence of hold pedal on TVA release"));
holdReleaseLevel->setRange (0, 100, 1);
holdReleaseLevel->setSliderStyle (Slider::RotaryVerticalDrag);
holdReleaseLevel->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
benderTVA.reset (new Slider ("benderTVA"));
addAndMakeVisible (benderTVA.get());
benderTVA->setTooltip (TRANS("Influence of bender on level"));
benderTVA->setRange (0, 100, 1);
benderTVA->setSliderStyle (Slider::RotaryVerticalDrag);
benderTVA->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
labelBenderPitch2.reset (new Label ("labelBenderPitch",
TRANS("Bender")));
addAndMakeVisible (labelBenderPitch2.get());
labelBenderPitch2->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
labelBenderPitch2->setJustificationType (Justification::centred);
labelBenderPitch2->setEditable (false, false, false);
labelBenderPitch2->setColour (TextEditor::textColourId, Colours::black);
labelBenderPitch2->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
groupLink.reset (new ComboBox ("groupLink"));
addAndMakeVisible (groupLink.get());
groupLink->setTooltip (TRANS("Group to which this voice TVA MOD is linked. All voices of a group have the same TVA 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]
}
GUITVAMod::~GUITVAMod()
{
//[Destructor_pre]. You can add your own custom destruction code here..
mAttachment = nullptr;
setLookAndFeel(nullptr);
//[/Destructor_pre]
controllerTVACombo = nullptr;
labelAftrLvl = nullptr;
aftrLevel = nullptr;
labelCtrlLvl = nullptr;
ctrlLevel = nullptr;
labelHoldRelease = nullptr;
holdReleaseLevel = nullptr;
benderTVA = nullptr;
labelBenderPitch2 = nullptr;
groupLink = nullptr;
//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]
}
//==============================================================================
void GUITVAMod::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 GUITVAMod::resized()
{
//[UserPreResize] Add your own custom resize code here..
//[/UserPreResize]
controllerTVACombo->setBounds (120 - (176 / 2), 20, 176, 24);
labelAftrLvl->setBounds (82 - (73 / 2), 65 - (24 / 2), 73, 24);
aftrLevel->setBounds (82 - (56 / 2), 105 - (72 / 2), 56, 72);
labelCtrlLvl->setBounds (158 - (73 / 2), (65 - (24 / 2)) + 24 / 2 - (24 / 2), 73, 24);
ctrlLevel->setBounds (158 - (56 / 2), (105 - (72 / 2)) + 72 / 2 - (72 / 2), 56, 72);
labelHoldRelease->setBounds (82 - (82 / 2), 149 - (24 / 2), 82, 24);
holdReleaseLevel->setBounds (82 - (56 / 2), 189 - (72 / 2), 56, 72);
benderTVA->setBounds (158 - (56 / 2), (189 - (72 / 2)) + 72 / 2 - (72 / 2), 56, 72);
labelBenderPitch2->setBounds (158 - (73 / 2), (149 - (24 / 2)) + 24 / 2 - (24 / 2), 73, 24);
groupLink->setBounds (216 - (29 / 2), 228 - (24 / 2), 29, 24);
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
void GUITVAMod::comboBoxChanged (ComboBox* comboBoxThatHasChanged)
{
//[UsercomboBoxChanged_Pre]
//[/UsercomboBoxChanged_Pre]
if (comboBoxThatHasChanged == controllerTVACombo.get())
{
//[UserComboBoxCode_controllerTVACombo] -- add your combo box handling code here..
//[/UserComboBoxCode_controllerTVACombo]
}
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 GUITVAMod::setParameters(TVAParameters * tvaParam) {
mTVAParameters = tvaParam;
mAttachment = std::make_unique<GuiAttachment>(mTVAParameters->getProcessor());
updateFromParameters();
}
void GUITVAMod::updateFromParameters()
{
mAttachment->attachSlider(mTVAParameters->mAfterTouchLevelDepth, *aftrLevel);
mAttachment->attachSlider(mTVAParameters->mControllerLevelDepth, *ctrlLevel);
mAttachment->attachSlider(mTVAParameters->mPitchWheelLevelDepth, *benderTVA);
mAttachment->attachCombobox(mTVAParameters->mControlNumber, *controllerTVACombo);
mAttachment->attachSlider(mTVAParameters->mHoldRelease, *holdReleaseLevel);
mAttachment->attachCombobox(mTVAParameters->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="GUITVAMod" componentName="GUITVAMod"
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"/>
<COMBOBOX name="controllerTVACombo" id="4318b7efdaf7c09f" memberName="controllerTVACombo"
virtualName="" explicitFocusOrder="0" pos="120c 20 176 24" tooltip="Additionnal controller to drive TVA"
editable="0" layout="33" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/>
<LABEL name="labelAftrLvl" id="2768f143efd1d706" memberName="labelAftrLvl"
virtualName="" explicitFocusOrder="0" pos="82.5c 65c 73 24" edTextCol="ff000000"
edBkgCol="0" labelText="Aftr&gt;Level" editableSingleClick="0"
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
fontsize="15.0" kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="aftrLevel" id="3c9c5d0350ab5df7" memberName="aftrLevel"
virtualName="" explicitFocusOrder="0" pos="82c 105c 56 72" posRelativeX="b8a5ef2d0601f570"
posRelativeY="b8a5ef2d0601f570" tooltip="Influence of atertouch 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="labelCtrlLvl" id="801f86fdd23d9725" memberName="labelCtrlLvl"
virtualName="" explicitFocusOrder="0" pos="158.5c 0Cc 73 24"
posRelativeY="2768f143efd1d706" edTextCol="ff000000" edBkgCol="0"
labelText="Ctrl&gt;Level" editableSingleClick="0" editableDoubleClick="0"
focusDiscardsChanges="0" fontname="Default font" fontsize="15.0"
kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="ctrlLevel" id="b6dcfe415b85786e" memberName="ctrlLevel"
virtualName="" explicitFocusOrder="0" pos="158c 0Cc 56 72" posRelativeX="b8a5ef2d0601f570"
posRelativeY="3c9c5d0350ab5df7" tooltip="Influence of controller 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="labelHoldRelease" id="cd44b9f3d80dcd39" memberName="labelHoldRelease"
virtualName="" explicitFocusOrder="0" pos="82c 149c 82 24" edTextCol="ff000000"
edBkgCol="0" labelText="Hold&gt;Release" editableSingleClick="0"
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
fontsize="15.0" kerning="0.0" bold="0" italic="0" justification="36"/>
<SLIDER name="holdReleaseLevel" id="dc1d146aa2fc0576" memberName="holdReleaseLevel"
virtualName="" explicitFocusOrder="0" pos="82c 189c 56 72" posRelativeX="b8a5ef2d0601f570"
posRelativeY="b8a5ef2d0601f570" tooltip="Influence of hold pedal on TVA release"
min="0.0" max="100.0" int="1.0" style="RotaryVerticalDrag" textBoxPos="TextBoxBelow"
textBoxEditable="1" textBoxWidth="40" textBoxHeight="20" skewFactor="1.0"
needsCallback="0"/>
<SLIDER name="benderTVA" id="8baba07e52b96391" memberName="benderTVA"
virtualName="" explicitFocusOrder="0" pos="158c 0Cc 56 72" posRelativeX="b8a5ef2d0601f570"
posRelativeY="dc1d146aa2fc0576" tooltip="Influence of bender 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="labelBenderPitch" id="1932bd944b3db32c" memberName="labelBenderPitch2"
virtualName="" explicitFocusOrder="0" pos="158.5c 0Cc 73 24"
posRelativeY="cd44b9f3d80dcd39" edTextCol="ff000000" edBkgCol="0"
labelText="Bender" editableSingleClick="0" editableDoubleClick="0"
focusDiscardsChanges="0" fontname="Default font" fontsize="15.0"
kerning="0.0" bold="0" italic="0" justification="36"/>
<COMBOBOX name="groupLink" id="2f4c27038f31a098" memberName="groupLink"
virtualName="" explicitFocusOrder="0" pos="216.5c 228c 29 24"
posRelativeY="2bec03bff2a1a6d8" tooltip="Group to which this voice TVA MOD is linked. All voices of a group have the same TVA 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]