1 |
/* |
2 |
* Copyright (C) 2006, 2007 Andreas Persson |
3 |
* |
4 |
* This program is free software; you can redistribute it and/or |
5 |
* modify it under the terms of the GNU General Public License as |
6 |
* published by the Free Software Foundation; either version 2, or (at |
7 |
* your option) any later version. |
8 |
* |
9 |
* This program is distributed in the hope that it will be useful, but |
10 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 |
* General Public License for more details. |
13 |
* |
14 |
* You should have received a copy of the GNU General Public License |
15 |
* along with program; see the file COPYING. If not, write to the Free |
16 |
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
17 |
* 02110-1301 USA. |
18 |
*/ |
19 |
|
20 |
#include "dimregionedit.h" |
21 |
|
22 |
#include "global.h" |
23 |
|
24 |
DimRegionEdit::DimRegionEdit() : |
25 |
eEG1PreAttack("Pre-attack", 0, 100, 2), |
26 |
eEG1Attack("Attack", 0, 60, 3), |
27 |
eEG1Decay1("Decay 1", 0.005, 60, 3), |
28 |
eEG1Decay2("Decay 2", 0, 60, 3), |
29 |
eEG1InfiniteSustain("Infinite sustain"), |
30 |
eEG1Sustain("Sustain", 0, 100, 2), |
31 |
eEG1Release("Release", 0, 60, 3), |
32 |
eEG1Hold("Hold"), |
33 |
eEG1Controller("Controller"), |
34 |
eEG1ControllerInvert("Controller invert"), |
35 |
eEG1ControllerAttackInfluence("Controller attack influence", 0, 3), |
36 |
eEG1ControllerDecayInfluence("Controller decay influence", 0, 3), |
37 |
eEG1ControllerReleaseInfluence("Controller release influence", 0, 3), |
38 |
eLFO1Frequency("Frequency", 0.1, 10, 2), |
39 |
eLFO1InternalDepth("Internal depth", 0, 1200), |
40 |
eLFO1ControlDepth("Control depth", 0, 1200), |
41 |
eLFO1Controller("Controller"), |
42 |
eLFO1FlipPhase("Flip phase"), |
43 |
eLFO1Sync("Sync"), |
44 |
eEG2PreAttack("Pre-attack", 0, 100, 2), |
45 |
eEG2Attack("Attack", 0, 60, 3), |
46 |
eEG2Decay1("Decay 1", 0.005, 60, 3), |
47 |
eEG2Decay2("Decay 2", 0, 60, 3), |
48 |
eEG2InfiniteSustain("Infinite sustain"), |
49 |
eEG2Sustain("Sustain", 0, 100, 2), |
50 |
eEG2Release("Release", 0, 60, 3), |
51 |
eEG2Controller("Controller"), |
52 |
eEG2ControllerInvert("Controller invert"), |
53 |
eEG2ControllerAttackInfluence("Controller attack influence", 0, 3), |
54 |
eEG2ControllerDecayInfluence("Controller decay influence", 0, 3), |
55 |
eEG2ControllerReleaseInfluence("Controller release influence", 0, 3), |
56 |
eLFO2Frequency("Frequency", 0.1, 10, 2), |
57 |
eLFO2InternalDepth("Internal depth", 0, 1200), |
58 |
eLFO2ControlDepth("Control depth", 0, 1200), |
59 |
eLFO2Controller("Controller"), |
60 |
eLFO2FlipPhase("Flip phase"), |
61 |
eLFO2Sync("Sync"), |
62 |
eEG3Attack("Attack", 0, 10, 3), |
63 |
eEG3Depth("Depth", -1200, 1200), |
64 |
eLFO3Frequency("Frequency", 0.1, 10, 2), |
65 |
eLFO3InternalDepth("Internal depth", 0, 1200), |
66 |
eLFO3ControlDepth("Control depth", 0, 1200), |
67 |
eLFO3Controller("Controller"), |
68 |
eLFO3Sync("Sync"), |
69 |
eVCFEnabled("Enabled"), |
70 |
eVCFType("Type"), |
71 |
eVCFCutoffController("Cutoff controller"), |
72 |
eVCFCutoffControllerInvert("Cutoff controller invert"), |
73 |
eVCFCutoff("Cutoff"), |
74 |
eVCFVelocityCurve("Velocity curve"), |
75 |
eVCFVelocityScale("Velocity scale"), |
76 |
eVCFVelocityDynamicRange("Velocity dynamic range", 0, 4), |
77 |
eVCFResonance("Resonance"), |
78 |
eVCFResonanceDynamic("Resonance dynamic"), |
79 |
eVCFResonanceController("Resonance controller"), |
80 |
eVCFKeyboardTracking("Keyboard tracking"), |
81 |
eVCFKeyboardTrackingBreakpoint("Keyboard tracking breakpoint"), |
82 |
eVelocityResponseCurve("Velocity response curve"), |
83 |
eVelocityResponseDepth("Velocity response depth", 0, 4), |
84 |
eVelocityResponseCurveScaling("Velocity response curve scaling"), |
85 |
eReleaseVelocityResponseCurve("Release velocity response curve"), |
86 |
eReleaseVelocityResponseDepth("Release velocity response depth", 0, 4), |
87 |
eReleaseTriggerDecay("Release trigger decay", 0, 8), |
88 |
eCrossfade_in_start("Crossfade-in start"), |
89 |
eCrossfade_in_end("Crossfade-in end"), |
90 |
eCrossfade_out_start("Crossfade-out start"), |
91 |
eCrossfade_out_end("Crossfade-out end"), |
92 |
ePitchTrack("Pitch track"), |
93 |
eDimensionBypass("Dimension bypass"), |
94 |
ePan("Pan", -64, 63), |
95 |
eSelfMask("Self mask"), |
96 |
eAttenuationController("Attenuation controller"), |
97 |
eInvertAttenuationController("Invert attenuation controller"), |
98 |
eAttenuationControllerThreshold("Attenuation controller threshold"), |
99 |
eChannelOffset("Channel offset", 0, 9), |
100 |
eSustainDefeat("Sustain defeat"), |
101 |
eMSDecode("MS decode"), |
102 |
eSampleStartOffset("Sample start offset", 0, 2000), |
103 |
eUnityNote("Unity note"), |
104 |
eFineTune("Fine tune", -49, 50), |
105 |
eGain("Gain", -96, 0, 2, -655360), |
106 |
eGainPlus6("Gain +6dB", eGain, 6 * -655360), |
107 |
eSampleLoopEnabled("Enabled"), |
108 |
eSampleLoopStart("Loop start positon"), |
109 |
eSampleLoopLength("Loop size"), |
110 |
eSampleLoopType("Loop type"), |
111 |
eSampleLoopInfinite("Infinite loop"), |
112 |
eSampleLoopPlayCount("Playback count", 1), |
113 |
update_model(0) |
114 |
{ |
115 |
connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack); |
116 |
connect(eEG1Attack, &gig::DimensionRegion::EG1Attack); |
117 |
connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1); |
118 |
connect(eEG1Decay2, &gig::DimensionRegion::EG1Decay2); |
119 |
connect(eEG1InfiniteSustain, &gig::DimensionRegion::EG1InfiniteSustain); |
120 |
connect(eEG1Sustain, &gig::DimensionRegion::EG1Sustain); |
121 |
connect(eEG1Release, &gig::DimensionRegion::EG1Release); |
122 |
connect(eEG1Hold, &gig::DimensionRegion::EG1Hold); |
123 |
connect(eEG1Controller, &gig::DimensionRegion::EG1Controller); |
124 |
connect(eEG1ControllerInvert, &gig::DimensionRegion::EG1ControllerInvert); |
125 |
connect(eEG1ControllerAttackInfluence, |
126 |
&gig::DimensionRegion::EG1ControllerAttackInfluence); |
127 |
connect(eEG1ControllerDecayInfluence, |
128 |
&gig::DimensionRegion::EG1ControllerDecayInfluence); |
129 |
connect(eEG1ControllerReleaseInfluence, |
130 |
&gig::DimensionRegion::EG1ControllerReleaseInfluence); |
131 |
connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency); |
132 |
connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth); |
133 |
connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth); |
134 |
connect(eLFO1Controller, &gig::DimensionRegion::LFO1Controller); |
135 |
connect(eLFO1FlipPhase, &gig::DimensionRegion::LFO1FlipPhase); |
136 |
connect(eLFO1Sync, &gig::DimensionRegion::LFO1Sync); |
137 |
connect(eEG2PreAttack, &gig::DimensionRegion::EG2PreAttack); |
138 |
connect(eEG2Attack, &gig::DimensionRegion::EG2Attack); |
139 |
connect(eEG2Decay1, &gig::DimensionRegion::EG2Decay1); |
140 |
connect(eEG2Decay2, &gig::DimensionRegion::EG2Decay2); |
141 |
connect(eEG2InfiniteSustain, &gig::DimensionRegion::EG2InfiniteSustain); |
142 |
connect(eEG2Sustain, &gig::DimensionRegion::EG2Sustain); |
143 |
connect(eEG2Release, &gig::DimensionRegion::EG2Release); |
144 |
connect(eEG2Controller, &gig::DimensionRegion::EG2Controller); |
145 |
connect(eEG2ControllerInvert, &gig::DimensionRegion::EG2ControllerInvert); |
146 |
connect(eEG2ControllerAttackInfluence, |
147 |
&gig::DimensionRegion::EG2ControllerAttackInfluence); |
148 |
connect(eEG2ControllerDecayInfluence, |
149 |
&gig::DimensionRegion::EG2ControllerDecayInfluence); |
150 |
connect(eEG2ControllerReleaseInfluence, |
151 |
&gig::DimensionRegion::EG2ControllerReleaseInfluence); |
152 |
connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency); |
153 |
connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth); |
154 |
connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth); |
155 |
connect(eLFO2Controller, &gig::DimensionRegion::LFO2Controller); |
156 |
connect(eLFO2FlipPhase, &gig::DimensionRegion::LFO2FlipPhase); |
157 |
connect(eLFO2Sync, &gig::DimensionRegion::LFO2Sync); |
158 |
connect(eEG3Attack, &gig::DimensionRegion::EG3Attack); |
159 |
connect(eEG3Depth, &gig::DimensionRegion::EG3Depth); |
160 |
connect(eLFO3Frequency, &gig::DimensionRegion::LFO3Frequency); |
161 |
connect(eLFO3InternalDepth, &gig::DimensionRegion::LFO3InternalDepth); |
162 |
connect(eLFO3ControlDepth, &gig::DimensionRegion::LFO3ControlDepth); |
163 |
connect(eLFO3Controller, &gig::DimensionRegion::LFO3Controller); |
164 |
connect(eLFO3Sync, &gig::DimensionRegion::LFO3Sync); |
165 |
connect(eVCFEnabled, &gig::DimensionRegion::VCFEnabled); |
166 |
connect(eVCFType, &gig::DimensionRegion::VCFType); |
167 |
connect(eVCFCutoffController, |
168 |
&gig::DimensionRegion::SetVCFCutoffController); |
169 |
connect(eVCFCutoffControllerInvert, |
170 |
&gig::DimensionRegion::VCFCutoffControllerInvert); |
171 |
connect(eVCFCutoff, &gig::DimensionRegion::VCFCutoff); |
172 |
connect(eVCFVelocityCurve, &gig::DimensionRegion::SetVCFVelocityCurve); |
173 |
connect(eVCFVelocityScale, &gig::DimensionRegion::SetVCFVelocityScale); |
174 |
connect(eVCFVelocityDynamicRange, |
175 |
&gig::DimensionRegion::SetVCFVelocityDynamicRange); |
176 |
connect(eVCFResonance, &gig::DimensionRegion::VCFResonance); |
177 |
connect(eVCFResonanceDynamic, &gig::DimensionRegion::VCFResonanceDynamic); |
178 |
connect(eVCFResonanceController, |
179 |
&gig::DimensionRegion::VCFResonanceController); |
180 |
connect(eVCFKeyboardTracking, &gig::DimensionRegion::VCFKeyboardTracking); |
181 |
connect(eVCFKeyboardTrackingBreakpoint, |
182 |
&gig::DimensionRegion::VCFKeyboardTrackingBreakpoint); |
183 |
connect(eVelocityResponseCurve, |
184 |
&gig::DimensionRegion::SetVelocityResponseCurve); |
185 |
connect(eVelocityResponseDepth, |
186 |
&gig::DimensionRegion::SetVelocityResponseDepth); |
187 |
connect(eVelocityResponseCurveScaling, |
188 |
&gig::DimensionRegion::SetVelocityResponseCurveScaling); |
189 |
connect(eReleaseVelocityResponseCurve, |
190 |
&gig::DimensionRegion::SetReleaseVelocityResponseCurve); |
191 |
connect(eReleaseVelocityResponseDepth, |
192 |
&gig::DimensionRegion::SetReleaseVelocityResponseDepth); |
193 |
connect(eReleaseTriggerDecay, &gig::DimensionRegion::ReleaseTriggerDecay); |
194 |
connect(eCrossfade_in_start, &DimRegionEdit::set_Crossfade_in_start); |
195 |
connect(eCrossfade_in_end, &DimRegionEdit::set_Crossfade_in_end); |
196 |
connect(eCrossfade_out_start, &DimRegionEdit::set_Crossfade_out_start); |
197 |
connect(eCrossfade_out_end, &DimRegionEdit::set_Crossfade_out_end); |
198 |
connect(ePitchTrack, &gig::DimensionRegion::PitchTrack); |
199 |
connect(eDimensionBypass, &gig::DimensionRegion::DimensionBypass); |
200 |
connect(ePan, &gig::DimensionRegion::Pan); |
201 |
connect(eSelfMask, &gig::DimensionRegion::SelfMask); |
202 |
connect(eAttenuationController, |
203 |
&gig::DimensionRegion::AttenuationController); |
204 |
connect(eInvertAttenuationController, |
205 |
&gig::DimensionRegion::InvertAttenuationController); |
206 |
connect(eAttenuationControllerThreshold, |
207 |
&gig::DimensionRegion::AttenuationControllerThreshold); |
208 |
connect(eChannelOffset, &gig::DimensionRegion::ChannelOffset); |
209 |
connect(eSustainDefeat, &gig::DimensionRegion::SustainDefeat); |
210 |
connect(eMSDecode, &gig::DimensionRegion::MSDecode); |
211 |
connect(eSampleStartOffset, &gig::DimensionRegion::SampleStartOffset); |
212 |
connect(eUnityNote, &DimRegionEdit::set_UnityNote); |
213 |
connect(eFineTune, &DimRegionEdit::set_FineTune); |
214 |
connect(eGain, &DimRegionEdit::set_Gain); |
215 |
connect(eGainPlus6, &DimRegionEdit::set_Gain); |
216 |
connect(eSampleLoopEnabled, &DimRegionEdit::set_LoopEnabled); |
217 |
connect(eSampleLoopType, &DimRegionEdit::set_LoopType); |
218 |
connect(eSampleLoopStart, &DimRegionEdit::set_LoopStart); |
219 |
connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength); |
220 |
connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite); |
221 |
connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount); |
222 |
|
223 |
for (int i = 0 ; i < 7 ; i++) { |
224 |
table[i] = new Gtk::Table(3, 1); |
225 |
table[i]->set_col_spacings(7); |
226 |
} |
227 |
|
228 |
// set tooltips |
229 |
eUnityNote.set_tip( |
230 |
_("Note this sample is associated with (a.k.a. 'root note')") |
231 |
); |
232 |
eSampleStartOffset.set_tip(_("Sample position at which playback should be started")); |
233 |
ePan.set_tip(_("Stereo balance (left/right)")); |
234 |
eChannelOffset.set_tip( |
235 |
_("Output channel where the audio signal should be routed to (0 - 9)") |
236 |
); |
237 |
ePitchTrack.set_tip( |
238 |
_("If true: sample will be pitched according to the key position " |
239 |
"(this would be disabled for drums for example)") |
240 |
); |
241 |
eSampleLoopEnabled.set_tip(_("If enabled: repeats to playback the sample")); |
242 |
eSampleLoopStart.set_tip( |
243 |
_("Start position within the sample (in sample points) of the area to " |
244 |
"be looped") |
245 |
); |
246 |
eSampleLoopLength.set_tip( |
247 |
_("Duration (in sample points) of the area to be looped") |
248 |
); |
249 |
eSampleLoopType.set_tip( |
250 |
_("Direction in which the loop area in the sample should be played back") |
251 |
); |
252 |
eSampleLoopInfinite.set_tip( |
253 |
_("Whether the loop area should be played back forever\n" |
254 |
"Caution: this setting is stored on Sample side, thus is shared " |
255 |
"among all dimension regions that use this sample!") |
256 |
); |
257 |
eSampleLoopPlayCount.set_tip( |
258 |
_("How many times the loop area should be played back\n" |
259 |
"Caution: this setting is stored on Sample side, thus is shared " |
260 |
"among all dimension regions that use this sample!") |
261 |
); |
262 |
|
263 |
pageno = 0; |
264 |
rowno = 0; |
265 |
firstRowInBlock = 0; |
266 |
|
267 |
addHeader(_("Mandatory Settings")); |
268 |
addString("Sample", lSample, wSample); |
269 |
//TODO: the following would break drag&drop: wSample->property_editable().set_value(false); or this: wSample->set_editable(false); |
270 |
tooltips.set_tip(*wSample, _("Drop a sample here")); |
271 |
addProp(eUnityNote); |
272 |
addHeader(_("Optional Settings")); |
273 |
addProp(eSampleStartOffset); |
274 |
addProp(eChannelOffset); |
275 |
addHeader("Loops"); |
276 |
addProp(eSampleLoopEnabled); |
277 |
addProp(eSampleLoopStart); |
278 |
addProp(eSampleLoopLength); |
279 |
{ |
280 |
const char* choices[] = { "normal", "bidirectional", "backward", 0 }; |
281 |
static const uint32_t values[] = { |
282 |
gig::loop_type_normal, |
283 |
gig::loop_type_bidirectional, |
284 |
gig::loop_type_backward |
285 |
}; |
286 |
eSampleLoopType.set_choices(choices, values); |
287 |
} |
288 |
addProp(eSampleLoopType); |
289 |
addProp(eSampleLoopInfinite); |
290 |
addProp(eSampleLoopPlayCount); |
291 |
|
292 |
nextPage(); |
293 |
|
294 |
addHeader(_("General Amplitude Settings")); |
295 |
addProp(eGain); |
296 |
addProp(eGainPlus6); |
297 |
addProp(ePan); |
298 |
addHeader(_("Amplitude Envelope (EG1)")); |
299 |
addProp(eEG1PreAttack); |
300 |
addProp(eEG1Attack); |
301 |
addProp(eEG1Decay1); |
302 |
addProp(eEG1Decay2); |
303 |
addProp(eEG1InfiniteSustain); |
304 |
addProp(eEG1Sustain); |
305 |
addProp(eEG1Release); |
306 |
addProp(eEG1Hold); |
307 |
addProp(eEG1Controller); |
308 |
addProp(eEG1ControllerInvert); |
309 |
addProp(eEG1ControllerAttackInfluence); |
310 |
addProp(eEG1ControllerDecayInfluence); |
311 |
addProp(eEG1ControllerReleaseInfluence); |
312 |
|
313 |
nextPage(); |
314 |
|
315 |
addHeader(_("Amplitude Oscillator (LFO1)")); |
316 |
addProp(eLFO1Frequency); |
317 |
addProp(eLFO1InternalDepth); |
318 |
addProp(eLFO1ControlDepth); |
319 |
{ |
320 |
const char* choices[] = { "internal", "modwheel", "breath", |
321 |
"internal+modwheel", "internal+breath", 0 }; |
322 |
static const gig::lfo1_ctrl_t values[] = { |
323 |
gig::lfo1_ctrl_internal, |
324 |
gig::lfo1_ctrl_modwheel, |
325 |
gig::lfo1_ctrl_breath, |
326 |
gig::lfo1_ctrl_internal_modwheel, |
327 |
gig::lfo1_ctrl_internal_breath |
328 |
}; |
329 |
eLFO1Controller.set_choices(choices, values); |
330 |
} |
331 |
addProp(eLFO1Controller); |
332 |
addProp(eLFO1FlipPhase); |
333 |
addProp(eLFO1Sync); |
334 |
addHeader("Crossfade"); |
335 |
addProp(eAttenuationController); |
336 |
addProp(eInvertAttenuationController); |
337 |
addProp(eAttenuationControllerThreshold); |
338 |
addProp(eCrossfade_in_start); |
339 |
addProp(eCrossfade_in_end); |
340 |
addProp(eCrossfade_out_start); |
341 |
addProp(eCrossfade_out_end); |
342 |
|
343 |
nextPage(); |
344 |
|
345 |
addHeader(_("General Filter Settings")); |
346 |
addProp(eVCFEnabled); |
347 |
{ |
348 |
const char* choices[] = { "lowpass", "lowpassturbo", "bandpass", |
349 |
"highpass", "bandreject", 0 }; |
350 |
static const gig::vcf_type_t values[] = { |
351 |
gig::vcf_type_lowpass, |
352 |
gig::vcf_type_lowpassturbo, |
353 |
gig::vcf_type_bandpass, |
354 |
gig::vcf_type_highpass, |
355 |
gig::vcf_type_bandreject |
356 |
}; |
357 |
eVCFType.set_choices(choices, values); |
358 |
} |
359 |
addProp(eVCFType); |
360 |
{ |
361 |
const char* choices[] = { "none", "none2", "modwheel", "effect1", "effect2", |
362 |
"breath", "foot", "sustainpedal", "softpedal", |
363 |
"genpurpose7", "genpurpose8", "aftertouch", 0 }; |
364 |
static const gig::vcf_cutoff_ctrl_t values[] = { |
365 |
gig::vcf_cutoff_ctrl_none, |
366 |
gig::vcf_cutoff_ctrl_none2, |
367 |
gig::vcf_cutoff_ctrl_modwheel, |
368 |
gig::vcf_cutoff_ctrl_effect1, |
369 |
gig::vcf_cutoff_ctrl_effect2, |
370 |
gig::vcf_cutoff_ctrl_breath, |
371 |
gig::vcf_cutoff_ctrl_foot, |
372 |
gig::vcf_cutoff_ctrl_sustainpedal, |
373 |
gig::vcf_cutoff_ctrl_softpedal, |
374 |
gig::vcf_cutoff_ctrl_genpurpose7, |
375 |
gig::vcf_cutoff_ctrl_genpurpose8, |
376 |
gig::vcf_cutoff_ctrl_aftertouch |
377 |
}; |
378 |
eVCFCutoffController.set_choices(choices, values); |
379 |
} |
380 |
addProp(eVCFCutoffController); |
381 |
addProp(eVCFCutoffControllerInvert); |
382 |
addProp(eVCFCutoff); |
383 |
const char* curve_type_texts[] = { "nonlinear", "linear", "special", 0 }; |
384 |
static const gig::curve_type_t curve_type_values[] = { |
385 |
gig::curve_type_nonlinear, |
386 |
gig::curve_type_linear, |
387 |
gig::curve_type_special |
388 |
}; |
389 |
eVCFVelocityCurve.set_choices(curve_type_texts, curve_type_values); |
390 |
addProp(eVCFVelocityCurve); |
391 |
addProp(eVCFVelocityScale); |
392 |
addProp(eVCFVelocityDynamicRange); |
393 |
addProp(eVCFResonance); |
394 |
addProp(eVCFResonanceDynamic); |
395 |
{ |
396 |
const char* choices[] = { "none", "genpurpose3", "genpurpose4", |
397 |
"genpurpose5", "genpurpose6", 0 }; |
398 |
static const gig::vcf_res_ctrl_t values[] = { |
399 |
gig::vcf_res_ctrl_none, |
400 |
gig::vcf_res_ctrl_genpurpose3, |
401 |
gig::vcf_res_ctrl_genpurpose4, |
402 |
gig::vcf_res_ctrl_genpurpose5, |
403 |
gig::vcf_res_ctrl_genpurpose6 |
404 |
}; |
405 |
eVCFResonanceController.set_choices(choices, values); |
406 |
} |
407 |
addProp(eVCFResonanceController); |
408 |
addProp(eVCFKeyboardTracking); |
409 |
addProp(eVCFKeyboardTrackingBreakpoint); |
410 |
|
411 |
nextPage(); |
412 |
|
413 |
addHeader(_("Filter Cutoff Envelope (EG2)")); |
414 |
addProp(eEG2PreAttack); |
415 |
addProp(eEG2Attack); |
416 |
addProp(eEG2Decay1); |
417 |
addProp(eEG2Decay2); |
418 |
addProp(eEG2InfiniteSustain); |
419 |
addProp(eEG2Sustain); |
420 |
addProp(eEG2Release); |
421 |
addProp(eEG2Controller); |
422 |
addProp(eEG2ControllerInvert); |
423 |
addProp(eEG2ControllerAttackInfluence); |
424 |
addProp(eEG2ControllerDecayInfluence); |
425 |
addProp(eEG2ControllerReleaseInfluence); |
426 |
addHeader(_("Filter Cutoff Oscillator (LFO2)")); |
427 |
addProp(eLFO2Frequency); |
428 |
addProp(eLFO2InternalDepth); |
429 |
addProp(eLFO2ControlDepth); |
430 |
{ |
431 |
const char* choices[] = { "internal", "modwheel", "foot", |
432 |
"internal+modwheel", "internal+foot", 0 }; |
433 |
static const gig::lfo2_ctrl_t values[] = { |
434 |
gig::lfo2_ctrl_internal, |
435 |
gig::lfo2_ctrl_modwheel, |
436 |
gig::lfo2_ctrl_foot, |
437 |
gig::lfo2_ctrl_internal_modwheel, |
438 |
gig::lfo2_ctrl_internal_foot |
439 |
}; |
440 |
eLFO2Controller.set_choices(choices, values); |
441 |
} |
442 |
addProp(eLFO2Controller); |
443 |
addProp(eLFO2FlipPhase); |
444 |
addProp(eLFO2Sync); |
445 |
|
446 |
nextPage(); |
447 |
|
448 |
addHeader(_("General Pitch Settings")); |
449 |
addProp(eFineTune); |
450 |
addProp(ePitchTrack); |
451 |
addHeader(_("Pitch Envelope (EG3)")); |
452 |
addProp(eEG3Attack); |
453 |
addProp(eEG3Depth); |
454 |
addHeader(_("Pitch Oscillator (LFO3)")); |
455 |
addProp(eLFO3Frequency); |
456 |
addProp(eLFO3InternalDepth); |
457 |
addProp(eLFO3ControlDepth); |
458 |
{ |
459 |
const char* choices[] = { "internal", "modwheel", "aftertouch", |
460 |
"internal+modwheel", "internal+aftertouch", 0 }; |
461 |
static const gig::lfo3_ctrl_t values[] = { |
462 |
gig::lfo3_ctrl_internal, |
463 |
gig::lfo3_ctrl_modwheel, |
464 |
gig::lfo3_ctrl_aftertouch, |
465 |
gig::lfo3_ctrl_internal_modwheel, |
466 |
gig::lfo3_ctrl_internal_aftertouch |
467 |
}; |
468 |
eLFO3Controller.set_choices(choices, values); |
469 |
} |
470 |
addProp(eLFO3Controller); |
471 |
addProp(eLFO3Sync); |
472 |
|
473 |
nextPage(); |
474 |
|
475 |
eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values); |
476 |
addProp(eVelocityResponseCurve); |
477 |
addProp(eVelocityResponseDepth); |
478 |
addProp(eVelocityResponseCurveScaling); |
479 |
eReleaseVelocityResponseCurve.set_choices(curve_type_texts, |
480 |
curve_type_values); |
481 |
addProp(eReleaseVelocityResponseCurve); |
482 |
addProp(eReleaseVelocityResponseDepth); |
483 |
addProp(eReleaseTriggerDecay); |
484 |
{ |
485 |
const char* choices[] = { "none", "effect4depth", "effect5depth", 0 }; |
486 |
static const gig::dim_bypass_ctrl_t values[] = { |
487 |
gig::dim_bypass_ctrl_none, |
488 |
gig::dim_bypass_ctrl_94, |
489 |
gig::dim_bypass_ctrl_95 |
490 |
}; |
491 |
eDimensionBypass.set_choices(choices, values); |
492 |
} |
493 |
addProp(eDimensionBypass); |
494 |
addProp(eSelfMask); |
495 |
addProp(eSustainDefeat); |
496 |
addProp(eMSDecode); |
497 |
|
498 |
nextPage(); |
499 |
|
500 |
|
501 |
eEG1InfiniteSustain.signal_value_changed().connect( |
502 |
sigc::mem_fun(*this, &DimRegionEdit::EG1InfiniteSustain_toggled)); |
503 |
eEG2InfiniteSustain.signal_value_changed().connect( |
504 |
sigc::mem_fun(*this, &DimRegionEdit::EG2InfiniteSustain_toggled)); |
505 |
eEG1Controller.signal_value_changed().connect( |
506 |
sigc::mem_fun(*this, &DimRegionEdit::EG1Controller_changed)); |
507 |
eEG2Controller.signal_value_changed().connect( |
508 |
sigc::mem_fun(*this, &DimRegionEdit::EG2Controller_changed)); |
509 |
eLFO1Controller.signal_value_changed().connect( |
510 |
sigc::mem_fun(*this, &DimRegionEdit::LFO1Controller_changed)); |
511 |
eLFO2Controller.signal_value_changed().connect( |
512 |
sigc::mem_fun(*this, &DimRegionEdit::LFO2Controller_changed)); |
513 |
eLFO3Controller.signal_value_changed().connect( |
514 |
sigc::mem_fun(*this, &DimRegionEdit::LFO3Controller_changed)); |
515 |
eAttenuationController.signal_value_changed().connect( |
516 |
sigc::mem_fun(*this, &DimRegionEdit::AttenuationController_changed)); |
517 |
eVCFEnabled.signal_value_changed().connect( |
518 |
sigc::mem_fun(*this, &DimRegionEdit::VCFEnabled_toggled)); |
519 |
eVCFCutoffController.signal_value_changed().connect( |
520 |
sigc::mem_fun(*this, &DimRegionEdit::VCFCutoffController_changed)); |
521 |
eVCFResonanceController.signal_value_changed().connect( |
522 |
sigc::mem_fun(*this, &DimRegionEdit::VCFResonanceController_changed)); |
523 |
|
524 |
eCrossfade_in_start.signal_value_changed().connect( |
525 |
sigc::mem_fun(*this, &DimRegionEdit::crossfade1_changed)); |
526 |
eCrossfade_in_end.signal_value_changed().connect( |
527 |
sigc::mem_fun(*this, &DimRegionEdit::crossfade2_changed)); |
528 |
eCrossfade_out_start.signal_value_changed().connect( |
529 |
sigc::mem_fun(*this, &DimRegionEdit::crossfade3_changed)); |
530 |
eCrossfade_out_end.signal_value_changed().connect( |
531 |
sigc::mem_fun(*this, &DimRegionEdit::crossfade4_changed)); |
532 |
|
533 |
eSampleLoopEnabled.signal_value_changed().connect( |
534 |
sigc::mem_fun(*this, &DimRegionEdit::update_loop_elements)); |
535 |
eSampleLoopStart.signal_value_changed().connect( |
536 |
sigc::mem_fun(*this, &DimRegionEdit::loop_start_changed)); |
537 |
eSampleLoopLength.signal_value_changed().connect( |
538 |
sigc::mem_fun(*this, &DimRegionEdit::loop_length_changed)); |
539 |
eSampleLoopInfinite.signal_value_changed().connect( |
540 |
sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled)); |
541 |
|
542 |
append_page(*table[0], "Sample"); |
543 |
append_page(*table[1], "Amplitude (1)"); |
544 |
append_page(*table[2], "Amplitude (2)"); |
545 |
append_page(*table[3], "Filter (1)"); |
546 |
append_page(*table[4], "Filter (2)"); |
547 |
append_page(*table[5], "Pitch"); |
548 |
append_page(*table[6], "Misc"); |
549 |
} |
550 |
|
551 |
DimRegionEdit::~DimRegionEdit() |
552 |
{ |
553 |
} |
554 |
|
555 |
void DimRegionEdit::addString(const char* labelText, Gtk::Label*& label, |
556 |
Gtk::Entry*& widget) |
557 |
{ |
558 |
label = new Gtk::Label(Glib::ustring(labelText) + ":"); |
559 |
label->set_alignment(Gtk::ALIGN_LEFT); |
560 |
|
561 |
table[pageno]->attach(*label, 1, 2, rowno, rowno + 1, |
562 |
Gtk::FILL, Gtk::SHRINK); |
563 |
|
564 |
widget = new Gtk::Entry(); |
565 |
|
566 |
table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1, |
567 |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
568 |
|
569 |
rowno++; |
570 |
} |
571 |
|
572 |
void DimRegionEdit::addHeader(const char* text) |
573 |
{ |
574 |
if (firstRowInBlock < rowno - 1) |
575 |
{ |
576 |
Gtk::Label* filler = new Gtk::Label(" "); |
577 |
table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno, |
578 |
Gtk::FILL, Gtk::SHRINK); |
579 |
} |
580 |
Glib::ustring str = "<b>"; |
581 |
str += text; |
582 |
str += "</b>"; |
583 |
Gtk::Label* label = new Gtk::Label(str); |
584 |
label->set_use_markup(); |
585 |
label->set_alignment(Gtk::ALIGN_LEFT); |
586 |
table[pageno]->attach(*label, 0, 3, rowno, rowno + 1, |
587 |
Gtk::FILL, Gtk::SHRINK); |
588 |
rowno++; |
589 |
firstRowInBlock = rowno; |
590 |
} |
591 |
|
592 |
void DimRegionEdit::nextPage() |
593 |
{ |
594 |
if (firstRowInBlock < rowno - 1) |
595 |
{ |
596 |
Gtk::Label* filler = new Gtk::Label(" "); |
597 |
table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno, |
598 |
Gtk::FILL, Gtk::SHRINK); |
599 |
} |
600 |
pageno++; |
601 |
rowno = 0; |
602 |
firstRowInBlock = 0; |
603 |
} |
604 |
|
605 |
void DimRegionEdit::addProp(BoolEntry& boolentry) |
606 |
{ |
607 |
table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1, |
608 |
Gtk::FILL, Gtk::SHRINK); |
609 |
rowno++; |
610 |
} |
611 |
|
612 |
void DimRegionEdit::addProp(BoolEntryPlus6& boolentry) |
613 |
{ |
614 |
table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1, |
615 |
Gtk::FILL, Gtk::SHRINK); |
616 |
rowno++; |
617 |
} |
618 |
|
619 |
void DimRegionEdit::addProp(LabelWidget& prop) |
620 |
{ |
621 |
table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1, |
622 |
Gtk::FILL, Gtk::SHRINK); |
623 |
table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1, |
624 |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
625 |
rowno++; |
626 |
} |
627 |
|
628 |
|
629 |
void DimRegionEdit::set_dim_region(gig::DimensionRegion* d) |
630 |
{ |
631 |
dimregion = d; |
632 |
|
633 |
set_sensitive(d); |
634 |
if (!d) return; |
635 |
|
636 |
// TODO: Here is where we decide which dimregions that are going |
637 |
// to be modified when the user changes a parameter. For now, just |
638 |
// choose the shown dimregion. |
639 |
dimregs.clear(); |
640 |
dimregs.insert(d); |
641 |
|
642 |
update_model++; |
643 |
eEG1PreAttack.set_value(d->EG1PreAttack); |
644 |
eEG1Attack.set_value(d->EG1Attack); |
645 |
eEG1Decay1.set_value(d->EG1Decay1); |
646 |
eEG1Decay2.set_value(d->EG1Decay2); |
647 |
eEG1InfiniteSustain.set_value(d->EG1InfiniteSustain); |
648 |
eEG1Sustain.set_value(d->EG1Sustain); |
649 |
eEG1Release.set_value(d->EG1Release); |
650 |
eEG1Hold.set_value(d->EG1Hold); |
651 |
eEG1Controller.set_value(d->EG1Controller); |
652 |
eEG1ControllerInvert.set_value(d->EG1ControllerInvert); |
653 |
eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence); |
654 |
eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence); |
655 |
eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence); |
656 |
eLFO1Frequency.set_value(d->LFO1Frequency); |
657 |
eLFO1InternalDepth.set_value(d->LFO1InternalDepth); |
658 |
eLFO1ControlDepth.set_value(d->LFO1ControlDepth); |
659 |
eLFO1Controller.set_value(d->LFO1Controller); |
660 |
eLFO1FlipPhase.set_value(d->LFO1FlipPhase); |
661 |
eLFO1Sync.set_value(d->LFO1Sync); |
662 |
eEG2PreAttack.set_value(d->EG2PreAttack); |
663 |
eEG2Attack.set_value(d->EG2Attack); |
664 |
eEG2Decay1.set_value(d->EG2Decay1); |
665 |
eEG2Decay2.set_value(d->EG2Decay2); |
666 |
eEG2InfiniteSustain.set_value(d->EG2InfiniteSustain); |
667 |
eEG2Sustain.set_value(d->EG2Sustain); |
668 |
eEG2Release.set_value(d->EG2Release); |
669 |
eEG2Controller.set_value(d->EG2Controller); |
670 |
eEG2ControllerInvert.set_value(d->EG2ControllerInvert); |
671 |
eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence); |
672 |
eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence); |
673 |
eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence); |
674 |
eLFO2Frequency.set_value(d->LFO2Frequency); |
675 |
eLFO2InternalDepth.set_value(d->LFO2InternalDepth); |
676 |
eLFO2ControlDepth.set_value(d->LFO2ControlDepth); |
677 |
eLFO2Controller.set_value(d->LFO2Controller); |
678 |
eLFO2FlipPhase.set_value(d->LFO2FlipPhase); |
679 |
eLFO2Sync.set_value(d->LFO2Sync); |
680 |
eEG3Attack.set_value(d->EG3Attack); |
681 |
eEG3Depth.set_value(d->EG3Depth); |
682 |
eLFO3Frequency.set_value(d->LFO3Frequency); |
683 |
eLFO3InternalDepth.set_value(d->LFO3InternalDepth); |
684 |
eLFO3ControlDepth.set_value(d->LFO3ControlDepth); |
685 |
eLFO3Controller.set_value(d->LFO3Controller); |
686 |
eLFO3Sync.set_value(d->LFO3Sync); |
687 |
eVCFEnabled.set_value(d->VCFEnabled); |
688 |
eVCFType.set_value(d->VCFType); |
689 |
eVCFCutoffController.set_value(d->VCFCutoffController); |
690 |
eVCFCutoffControllerInvert.set_value(d->VCFCutoffControllerInvert); |
691 |
eVCFCutoff.set_value(d->VCFCutoff); |
692 |
eVCFVelocityCurve.set_value(d->VCFVelocityCurve); |
693 |
eVCFVelocityScale.set_value(d->VCFVelocityScale); |
694 |
eVCFVelocityDynamicRange.set_value(d->VCFVelocityDynamicRange); |
695 |
eVCFResonance.set_value(d->VCFResonance); |
696 |
eVCFResonanceDynamic.set_value(d->VCFResonanceDynamic); |
697 |
eVCFResonanceController.set_value(d->VCFResonanceController); |
698 |
eVCFKeyboardTracking.set_value(d->VCFKeyboardTracking); |
699 |
eVCFKeyboardTrackingBreakpoint.set_value(d->VCFKeyboardTrackingBreakpoint); |
700 |
eVelocityResponseCurve.set_value(d->VelocityResponseCurve); |
701 |
eVelocityResponseDepth.set_value(d->VelocityResponseDepth); |
702 |
eVelocityResponseCurveScaling.set_value(d->VelocityResponseCurveScaling); |
703 |
eReleaseVelocityResponseCurve.set_value(d->ReleaseVelocityResponseCurve); |
704 |
eReleaseVelocityResponseDepth.set_value(d->ReleaseVelocityResponseDepth); |
705 |
eReleaseTriggerDecay.set_value(d->ReleaseTriggerDecay); |
706 |
eCrossfade_in_start.set_value(d->Crossfade.in_start); |
707 |
eCrossfade_in_end.set_value(d->Crossfade.in_end); |
708 |
eCrossfade_out_start.set_value(d->Crossfade.out_start); |
709 |
eCrossfade_out_end.set_value(d->Crossfade.out_end); |
710 |
ePitchTrack.set_value(d->PitchTrack); |
711 |
eDimensionBypass.set_value(d->DimensionBypass); |
712 |
ePan.set_value(d->Pan); |
713 |
eSelfMask.set_value(d->SelfMask); |
714 |
eAttenuationController.set_value(d->AttenuationController); |
715 |
eInvertAttenuationController.set_value(d->InvertAttenuationController); |
716 |
eAttenuationControllerThreshold.set_value(d->AttenuationControllerThreshold); |
717 |
eChannelOffset.set_value(d->ChannelOffset); |
718 |
eSustainDefeat.set_value(d->SustainDefeat); |
719 |
eMSDecode.set_value(d->MSDecode); |
720 |
eSampleStartOffset.set_value(d->SampleStartOffset); |
721 |
eUnityNote.set_value(d->UnityNote); |
722 |
eFineTune.set_value(d->FineTune); |
723 |
eGain.set_value(d->Gain); |
724 |
eGainPlus6.set_value(d->Gain); |
725 |
eSampleLoopEnabled.set_value(d->SampleLoops); |
726 |
eSampleLoopType.set_value( |
727 |
d->SampleLoops ? d->pSampleLoops[0].LoopType : 0); |
728 |
eSampleLoopStart.set_value( |
729 |
d->SampleLoops ? d->pSampleLoops[0].LoopStart : 0); |
730 |
eSampleLoopLength.set_value( |
731 |
d->SampleLoops ? d->pSampleLoops[0].LoopLength : 0); |
732 |
eSampleLoopInfinite.set_value( |
733 |
d->pSample && d->pSample->LoopPlayCount == 0); |
734 |
eSampleLoopPlayCount.set_value( |
735 |
d->pSample ? d->pSample->LoopPlayCount : 0); |
736 |
update_model--; |
737 |
|
738 |
wSample->set_text(d->pSample ? d->pSample->pInfo->Name.c_str() : "NULL"); |
739 |
|
740 |
update_loop_elements(); |
741 |
VCFEnabled_toggled(); |
742 |
} |
743 |
|
744 |
|
745 |
void DimRegionEdit::VCFEnabled_toggled() |
746 |
{ |
747 |
bool sensitive = eVCFEnabled.get_value(); |
748 |
eVCFType.set_sensitive(sensitive); |
749 |
eVCFCutoffController.set_sensitive(sensitive); |
750 |
eVCFVelocityCurve.set_sensitive(sensitive); |
751 |
eVCFVelocityScale.set_sensitive(sensitive); |
752 |
eVCFVelocityDynamicRange.set_sensitive(sensitive); |
753 |
eVCFResonance.set_sensitive(sensitive); |
754 |
eVCFResonanceController.set_sensitive(sensitive); |
755 |
eVCFKeyboardTracking.set_sensitive(sensitive); |
756 |
eVCFKeyboardTrackingBreakpoint.set_sensitive(sensitive); |
757 |
eEG2PreAttack.set_sensitive(sensitive); |
758 |
eEG2Attack.set_sensitive(sensitive); |
759 |
eEG2Decay1.set_sensitive(sensitive); |
760 |
eEG2InfiniteSustain.set_sensitive(sensitive); |
761 |
eEG2Sustain.set_sensitive(sensitive); |
762 |
eEG2Release.set_sensitive(sensitive); |
763 |
eEG2Controller.set_sensitive(sensitive); |
764 |
eEG2ControllerAttackInfluence.set_sensitive(sensitive); |
765 |
eEG2ControllerDecayInfluence.set_sensitive(sensitive); |
766 |
eEG2ControllerReleaseInfluence.set_sensitive(sensitive); |
767 |
eLFO2Frequency.set_sensitive(sensitive); |
768 |
eLFO2InternalDepth.set_sensitive(sensitive); |
769 |
eLFO2ControlDepth.set_sensitive(sensitive); |
770 |
eLFO2Controller.set_sensitive(sensitive); |
771 |
eLFO2FlipPhase.set_sensitive(sensitive); |
772 |
eLFO2Sync.set_sensitive(sensitive); |
773 |
if (sensitive) { |
774 |
VCFCutoffController_changed(); |
775 |
VCFResonanceController_changed(); |
776 |
EG2InfiniteSustain_toggled(); |
777 |
EG2Controller_changed(); |
778 |
LFO2Controller_changed(); |
779 |
} else { |
780 |
eVCFCutoffControllerInvert.set_sensitive(false); |
781 |
eVCFCutoff.set_sensitive(false); |
782 |
eVCFResonanceDynamic.set_sensitive(false); |
783 |
eVCFResonance.set_sensitive(false); |
784 |
eEG2Decay2.set_sensitive(false); |
785 |
eEG2ControllerInvert.set_sensitive(false); |
786 |
eLFO2InternalDepth.set_sensitive(false); |
787 |
eLFO2ControlDepth.set_sensitive(false); |
788 |
} |
789 |
} |
790 |
|
791 |
void DimRegionEdit::VCFCutoffController_changed() |
792 |
{ |
793 |
gig::vcf_cutoff_ctrl_t ctrl = eVCFCutoffController.get_value(); |
794 |
bool hasController = ctrl != gig::vcf_cutoff_ctrl_none && ctrl != gig::vcf_cutoff_ctrl_none2; |
795 |
|
796 |
eVCFCutoffControllerInvert.set_sensitive(hasController); |
797 |
eVCFCutoff.set_sensitive(!hasController); |
798 |
eVCFResonanceDynamic.set_sensitive(!hasController); |
799 |
eVCFVelocityScale.label.set_text(hasController ? "Minimum cutoff:" : |
800 |
"Velocity scale:"); |
801 |
} |
802 |
|
803 |
void DimRegionEdit::VCFResonanceController_changed() |
804 |
{ |
805 |
bool hasController = eVCFResonanceController.get_value() != gig::vcf_res_ctrl_none; |
806 |
eVCFResonance.set_sensitive(!hasController); |
807 |
} |
808 |
|
809 |
void DimRegionEdit::EG1InfiniteSustain_toggled() |
810 |
{ |
811 |
bool infSus = eEG1InfiniteSustain.get_value(); |
812 |
eEG1Decay2.set_sensitive(!infSus); |
813 |
} |
814 |
|
815 |
void DimRegionEdit::EG2InfiniteSustain_toggled() |
816 |
{ |
817 |
bool infSus = eEG2InfiniteSustain.get_value(); |
818 |
eEG2Decay2.set_sensitive(!infSus); |
819 |
} |
820 |
|
821 |
void DimRegionEdit::EG1Controller_changed() |
822 |
{ |
823 |
bool hasController = eEG1Controller.get_value().type != gig::leverage_ctrl_t::type_none; |
824 |
eEG1ControllerInvert.set_sensitive(hasController); |
825 |
} |
826 |
|
827 |
void DimRegionEdit::EG2Controller_changed() |
828 |
{ |
829 |
bool hasController = eEG2Controller.get_value().type != gig::leverage_ctrl_t::type_none; |
830 |
eEG2ControllerInvert.set_sensitive(hasController); |
831 |
} |
832 |
|
833 |
void DimRegionEdit::AttenuationController_changed() |
834 |
{ |
835 |
bool hasController = |
836 |
eAttenuationController.get_value().type != gig::leverage_ctrl_t::type_none; |
837 |
eInvertAttenuationController.set_sensitive(hasController); |
838 |
eAttenuationControllerThreshold.set_sensitive(hasController); |
839 |
eCrossfade_in_start.set_sensitive(hasController); |
840 |
eCrossfade_in_end.set_sensitive(hasController); |
841 |
eCrossfade_out_start.set_sensitive(hasController); |
842 |
eCrossfade_out_end.set_sensitive(hasController); |
843 |
} |
844 |
|
845 |
void DimRegionEdit::LFO1Controller_changed() |
846 |
{ |
847 |
gig::lfo1_ctrl_t ctrl = eLFO1Controller.get_value(); |
848 |
eLFO1ControlDepth.set_sensitive(ctrl != gig::lfo1_ctrl_internal); |
849 |
eLFO1InternalDepth.set_sensitive(ctrl != gig::lfo1_ctrl_modwheel && |
850 |
ctrl != gig::lfo1_ctrl_breath); |
851 |
} |
852 |
|
853 |
void DimRegionEdit::LFO2Controller_changed() |
854 |
{ |
855 |
gig::lfo2_ctrl_t ctrl = eLFO2Controller.get_value(); |
856 |
eLFO2ControlDepth.set_sensitive(ctrl != gig::lfo2_ctrl_internal); |
857 |
eLFO2InternalDepth.set_sensitive(ctrl != gig::lfo2_ctrl_modwheel && |
858 |
ctrl != gig::lfo2_ctrl_foot); |
859 |
} |
860 |
|
861 |
void DimRegionEdit::LFO3Controller_changed() |
862 |
{ |
863 |
gig::lfo3_ctrl_t ctrl = eLFO3Controller.get_value(); |
864 |
eLFO3ControlDepth.set_sensitive(ctrl != gig::lfo3_ctrl_internal); |
865 |
eLFO3InternalDepth.set_sensitive(ctrl != gig::lfo3_ctrl_modwheel && |
866 |
ctrl != gig::lfo3_ctrl_aftertouch); |
867 |
} |
868 |
|
869 |
void DimRegionEdit::crossfade1_changed() |
870 |
{ |
871 |
update_model++; |
872 |
eCrossfade_in_end.set_value(dimregion->Crossfade.in_end); |
873 |
eCrossfade_out_start.set_value(dimregion->Crossfade.out_start); |
874 |
eCrossfade_out_end.set_value(dimregion->Crossfade.out_end); |
875 |
update_model--; |
876 |
} |
877 |
|
878 |
void DimRegionEdit::crossfade2_changed() |
879 |
{ |
880 |
update_model++; |
881 |
eCrossfade_in_start.set_value(dimregion->Crossfade.in_start); |
882 |
eCrossfade_out_start.set_value(dimregion->Crossfade.out_start); |
883 |
eCrossfade_out_end.set_value(dimregion->Crossfade.out_end); |
884 |
update_model--; |
885 |
} |
886 |
|
887 |
void DimRegionEdit::crossfade3_changed() |
888 |
{ |
889 |
update_model++; |
890 |
eCrossfade_in_start.set_value(dimregion->Crossfade.in_start); |
891 |
eCrossfade_in_end.set_value(dimregion->Crossfade.in_end); |
892 |
eCrossfade_out_end.set_value(dimregion->Crossfade.out_end); |
893 |
update_model--; |
894 |
} |
895 |
|
896 |
void DimRegionEdit::crossfade4_changed() |
897 |
{ |
898 |
update_model++; |
899 |
eCrossfade_in_start.set_value(dimregion->Crossfade.in_start); |
900 |
eCrossfade_in_end.set_value(dimregion->Crossfade.in_end); |
901 |
eCrossfade_out_start.set_value(dimregion->Crossfade.out_start); |
902 |
update_model--; |
903 |
} |
904 |
|
905 |
void DimRegionEdit::update_loop_elements() |
906 |
{ |
907 |
update_model++; |
908 |
const bool active = eSampleLoopEnabled.get_value(); |
909 |
eSampleLoopStart.set_sensitive(active); |
910 |
eSampleLoopLength.set_sensitive(active); |
911 |
eSampleLoopType.set_sensitive(active); |
912 |
eSampleLoopInfinite.set_sensitive(active && dimregion && dimregion->pSample); |
913 |
// sample loop shall never be longer than the actual sample size |
914 |
loop_start_changed(); |
915 |
loop_length_changed(); |
916 |
eSampleLoopStart.set_value( |
917 |
dimregion->SampleLoops ? dimregion->pSampleLoops[0].LoopStart : 0); |
918 |
eSampleLoopLength.set_value( |
919 |
dimregion->SampleLoops ? dimregion->pSampleLoops[0].LoopLength : 0); |
920 |
|
921 |
eSampleLoopInfinite.set_value( |
922 |
dimregion->pSample && dimregion->pSample->LoopPlayCount == 0); |
923 |
|
924 |
loop_infinite_toggled(); |
925 |
update_model--; |
926 |
} |
927 |
|
928 |
void DimRegionEdit::loop_start_changed() { |
929 |
if (dimregion && dimregion->SampleLoops) { |
930 |
eSampleLoopLength.set_upper(dimregion->pSample ? |
931 |
dimregion->pSample->SamplesTotal - |
932 |
dimregion->pSampleLoops[0].LoopStart : 0); |
933 |
} |
934 |
} |
935 |
|
936 |
void DimRegionEdit::loop_length_changed() { |
937 |
if (dimregion && dimregion->SampleLoops) { |
938 |
eSampleLoopStart.set_upper(dimregion->pSample ? |
939 |
dimregion->pSample->SamplesTotal - |
940 |
dimregion->pSampleLoops[0].LoopLength : 0); |
941 |
} |
942 |
} |
943 |
|
944 |
void DimRegionEdit::loop_infinite_toggled() { |
945 |
eSampleLoopPlayCount.set_sensitive( |
946 |
dimregion && dimregion->pSample && |
947 |
!eSampleLoopInfinite.get_value() && |
948 |
eSampleLoopEnabled.get_value() |
949 |
); |
950 |
update_model++; |
951 |
eSampleLoopPlayCount.set_value( |
952 |
dimregion->pSample ? dimregion->pSample->LoopPlayCount : 0); |
953 |
update_model--; |
954 |
} |
955 |
|
956 |
bool DimRegionEdit::set_sample(gig::Sample* sample) |
957 |
{ |
958 |
if (dimregion) { |
959 |
//TODO: we should better move the code from MainWindow::on_sample_label_drop_drag_data_received() here |
960 |
|
961 |
// currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received() |
962 |
//dimreg_to_be_changed_signal.emit(dimregion); |
963 |
|
964 |
gig::Sample* oldref = dimregion->pSample; |
965 |
dimregion->pSample = sample; |
966 |
|
967 |
// copy sample information from Sample to DimensionRegion |
968 |
|
969 |
dimregion->UnityNote = sample->MIDIUnityNote; |
970 |
dimregion->FineTune = sample->FineTune; |
971 |
|
972 |
int loops = sample->Loops ? 1 : 0; |
973 |
while (dimregion->SampleLoops > loops) { |
974 |
dimregion->DeleteSampleLoop(&dimregion->pSampleLoops[0]); |
975 |
} |
976 |
while (dimregion->SampleLoops < sample->Loops) { |
977 |
DLS::sample_loop_t loop; |
978 |
dimregion->AddSampleLoop(&loop); |
979 |
} |
980 |
if (loops) { |
981 |
dimregion->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t); |
982 |
dimregion->pSampleLoops[0].LoopType = sample->LoopType; |
983 |
dimregion->pSampleLoops[0].LoopStart = sample->LoopStart; |
984 |
dimregion->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1; |
985 |
} |
986 |
|
987 |
// update ui |
988 |
update_model++; |
989 |
wSample->set_text(dimregion->pSample->pInfo->Name); |
990 |
eUnityNote.set_value(dimregion->UnityNote); |
991 |
eFineTune.set_value(dimregion->FineTune); |
992 |
eSampleLoopEnabled.set_value(dimregion->SampleLoops); |
993 |
update_loop_elements(); |
994 |
update_model--; |
995 |
|
996 |
sample_ref_changed_signal.emit(oldref, sample); |
997 |
// currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received() |
998 |
//dimreg_changed_signal.emit(dimregion); |
999 |
return true; |
1000 |
} |
1001 |
return false; |
1002 |
} |
1003 |
|
1004 |
sigc::signal<void, gig::DimensionRegion*>& DimRegionEdit::signal_dimreg_to_be_changed() { |
1005 |
return dimreg_to_be_changed_signal; |
1006 |
} |
1007 |
|
1008 |
sigc::signal<void, gig::DimensionRegion*>& DimRegionEdit::signal_dimreg_changed() { |
1009 |
return dimreg_changed_signal; |
1010 |
} |
1011 |
|
1012 |
sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& DimRegionEdit::signal_sample_ref_changed() { |
1013 |
return sample_ref_changed_signal; |
1014 |
} |
1015 |
|
1016 |
|
1017 |
void DimRegionEdit::set_UnityNote(gig::DimensionRegion* d, uint8_t value) |
1018 |
{ |
1019 |
d->UnityNote = value; |
1020 |
} |
1021 |
|
1022 |
void DimRegionEdit::set_FineTune(gig::DimensionRegion* d, int16_t value) |
1023 |
{ |
1024 |
d->FineTune = value; |
1025 |
} |
1026 |
|
1027 |
void DimRegionEdit::set_Crossfade_in_start(gig::DimensionRegion* d, |
1028 |
uint8_t value) |
1029 |
{ |
1030 |
d->Crossfade.in_start = value; |
1031 |
if (d->Crossfade.in_end < value) set_Crossfade_in_end(d, value); |
1032 |
} |
1033 |
|
1034 |
void DimRegionEdit::set_Crossfade_in_end(gig::DimensionRegion* d, |
1035 |
uint8_t value) |
1036 |
{ |
1037 |
d->Crossfade.in_end = value; |
1038 |
if (value < d->Crossfade.in_start) set_Crossfade_in_start(d, value); |
1039 |
if (value > d->Crossfade.out_start) set_Crossfade_out_start(d, value); |
1040 |
} |
1041 |
|
1042 |
void DimRegionEdit::set_Crossfade_out_start(gig::DimensionRegion* d, |
1043 |
uint8_t value) |
1044 |
{ |
1045 |
d->Crossfade.out_start = value; |
1046 |
if (value < d->Crossfade.in_end) set_Crossfade_in_end(d, value); |
1047 |
if (value > d->Crossfade.out_end) set_Crossfade_out_end(d, value); |
1048 |
} |
1049 |
|
1050 |
void DimRegionEdit::set_Crossfade_out_end(gig::DimensionRegion* d, |
1051 |
uint8_t value) |
1052 |
{ |
1053 |
d->Crossfade.out_end = value; |
1054 |
if (value < d->Crossfade.out_start) set_Crossfade_out_start(d, value); |
1055 |
} |
1056 |
|
1057 |
void DimRegionEdit::set_Gain(gig::DimensionRegion* d, int32_t value) |
1058 |
{ |
1059 |
d->SetGain(value); |
1060 |
} |
1061 |
|
1062 |
void DimRegionEdit::set_LoopEnabled(gig::DimensionRegion* d, bool value) |
1063 |
{ |
1064 |
if (value) { |
1065 |
// create a new sample loop in case there is none yet |
1066 |
if (!d->SampleLoops) { |
1067 |
DLS::sample_loop_t loop; |
1068 |
loop.LoopType = gig::loop_type_normal; |
1069 |
// loop the whole sample by default |
1070 |
loop.LoopStart = 0; |
1071 |
loop.LoopLength = |
1072 |
(d->pSample) ? d->pSample->SamplesTotal : 0; |
1073 |
dimreg_to_be_changed_signal.emit(d); |
1074 |
d->AddSampleLoop(&loop); |
1075 |
dimreg_changed_signal.emit(d); |
1076 |
} |
1077 |
} else { |
1078 |
if (d->SampleLoops) { |
1079 |
dimreg_to_be_changed_signal.emit(d); |
1080 |
// delete ALL existing sample loops |
1081 |
while (d->SampleLoops) { |
1082 |
d->DeleteSampleLoop(&d->pSampleLoops[0]); |
1083 |
} |
1084 |
dimreg_changed_signal.emit(d); |
1085 |
} |
1086 |
} |
1087 |
} |
1088 |
|
1089 |
void DimRegionEdit::set_LoopType(gig::DimensionRegion* d, uint32_t value) |
1090 |
{ |
1091 |
if (d->SampleLoops) d->pSampleLoops[0].LoopType = value; |
1092 |
} |
1093 |
|
1094 |
void DimRegionEdit::set_LoopStart(gig::DimensionRegion* d, uint32_t value) |
1095 |
{ |
1096 |
if (d->SampleLoops) { |
1097 |
d->pSampleLoops[0].LoopStart = |
1098 |
d->pSample ? |
1099 |
std::min(value, uint32_t(d->pSample->SamplesTotal - |
1100 |
d->pSampleLoops[0].LoopLength)) : |
1101 |
0; |
1102 |
} |
1103 |
} |
1104 |
|
1105 |
void DimRegionEdit::set_LoopLength(gig::DimensionRegion* d, uint32_t value) |
1106 |
{ |
1107 |
if (d->SampleLoops) { |
1108 |
d->pSampleLoops[0].LoopLength = |
1109 |
d->pSample ? |
1110 |
std::min(value, uint32_t(d->pSample->SamplesTotal - |
1111 |
d->pSampleLoops[0].LoopStart)) : |
1112 |
0; |
1113 |
} |
1114 |
} |
1115 |
|
1116 |
void DimRegionEdit::set_LoopInfinite(gig::DimensionRegion* d, bool value) |
1117 |
{ |
1118 |
if (d->pSample) { |
1119 |
if (value) d->pSample->LoopPlayCount = 0; |
1120 |
else if (d->pSample->LoopPlayCount == 0) d->pSample->LoopPlayCount = 1; |
1121 |
} |
1122 |
} |
1123 |
|
1124 |
void DimRegionEdit::set_LoopPlayCount(gig::DimensionRegion* d, uint32_t value) |
1125 |
{ |
1126 |
if (d->pSample) d->pSample->LoopPlayCount = value; |
1127 |
} |