/[svn]/gigedit/trunk/src/dimregionedit.cpp
ViewVC logotype

Contents of /gigedit/trunk/src/dimregionedit.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1100 - (show annotations) (download)
Sat Mar 17 09:20:19 2007 UTC (13 years, 4 months ago) by persson
File size: 29011 byte(s)
* code refactoring: dimregion editor and parameter editors extracted
  to separate files.
* loading progress dialog now also shown when filename is given as
  argument

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 bool update_gui;
23
24 namespace {
25 uint8_t& access_UnityNote(gig::DimensionRegion* dimreg)
26 {
27 return dimreg->UnityNote;
28 }
29 int16_t& access_FineTune(gig::DimensionRegion* dimreg)
30 {
31 return dimreg->FineTune;
32 }
33 uint32_t& access_SampleLoops(gig::DimensionRegion* dimreg)
34 {
35 return dimreg->SampleLoops;
36 }
37 uint8_t& access_Crossfade_in_start(gig::DimensionRegion* dimreg)
38 {
39 return dimreg->Crossfade.in_start;
40 }
41 uint8_t& access_Crossfade_in_end(gig::DimensionRegion* dimreg)
42 {
43 return dimreg->Crossfade.in_end;
44 }
45 uint8_t& access_Crossfade_out_start(gig::DimensionRegion* dimreg)
46 {
47 return dimreg->Crossfade.out_start;
48 }
49 uint8_t& access_Crossfade_out_end(gig::DimensionRegion* dimreg)
50 {
51 return dimreg->Crossfade.out_end;
52 }
53 }
54
55 DimRegionEdit::DimRegionEdit() :
56 eEG1PreAttack("PreAttack", &gig::DimensionRegion::EG1PreAttack, 0, 100, 2),
57 eEG1Attack("Attack", &gig::DimensionRegion::EG1Attack, 0, 60, 3),
58 eEG1Decay1("Decay1", &gig::DimensionRegion::EG1Decay1, 0.005, 60, 3),
59 eEG1Decay2("Decay2", &gig::DimensionRegion::EG1Decay2, 0, 60, 3),
60 eEG1InfiniteSustain("InfiniteSustain",
61 &gig::DimensionRegion::EG1InfiniteSustain),
62 eEG1Sustain("Sustain", &gig::DimensionRegion::EG1Sustain, 0, 100, 2),
63 eEG1Release("Release", &gig::DimensionRegion::EG1Release, 0, 60, 3),
64 eEG1Hold("Hold", &gig::DimensionRegion::EG1Hold),
65 eEG1Controller("Controller", &gig::DimensionRegion::EG1Controller),
66 eEG1ControllerInvert("ControllerInvert",
67 &gig::DimensionRegion::EG1ControllerInvert),
68 eEG1ControllerAttackInfluence("ControllerAttackInfluence",
69 &gig::DimensionRegion::EG1ControllerAttackInfluence,
70 0, 3),
71 eEG1ControllerDecayInfluence("ControllerDecayInfluence",
72 &gig::DimensionRegion::EG1ControllerDecayInfluence,
73 0, 3),
74 eEG1ControllerReleaseInfluence("ControllerReleaseInfluence",
75 &gig::DimensionRegion::EG1ControllerReleaseInfluence,
76 0, 3),
77 eLFO1Frequency("Frequency", &gig::DimensionRegion::LFO1Frequency,
78 0.1, 10, 2),
79 eLFO1InternalDepth("InternalDepth",
80 &gig::DimensionRegion::LFO1InternalDepth, 0, 1200),
81 eLFO1ControlDepth("ControlDepth", &gig::DimensionRegion::LFO1ControlDepth,
82 0, 1200),
83 eLFO1Controller("Controller", &gig::DimensionRegion::LFO1Controller),
84 eLFO1FlipPhase("FlipPhase", &gig::DimensionRegion::LFO1FlipPhase),
85 eLFO1Sync("Sync", &gig::DimensionRegion::LFO1Sync),
86 eEG2PreAttack("PreAttack", &gig::DimensionRegion::EG2PreAttack, 0, 100, 2),
87 eEG2Attack("Attack", &gig::DimensionRegion::EG2Attack, 0, 60, 3),
88 eEG2Decay1("Decay1", &gig::DimensionRegion::EG2Decay1, 0.005, 60, 3),
89 eEG2Decay2("Decay2", &gig::DimensionRegion::EG2Decay2, 0, 60, 3),
90 eEG2InfiniteSustain("InfiniteSustain",
91 &gig::DimensionRegion::EG2InfiniteSustain),
92 eEG2Sustain("Sustain", &gig::DimensionRegion::EG2Sustain, 0, 100, 2),
93 eEG2Release("Release", &gig::DimensionRegion::EG2Release, 0, 60, 3),
94 eEG2Controller("Controller", &gig::DimensionRegion::EG2Controller),
95 eEG2ControllerInvert("ControllerInvert",
96 &gig::DimensionRegion::EG2ControllerInvert),
97 eEG2ControllerAttackInfluence("ControllerAttackInfluence",
98 &gig::DimensionRegion::EG2ControllerAttackInfluence,
99 0, 3),
100 eEG2ControllerDecayInfluence("ControllerDecayInfluence",
101 &gig::DimensionRegion::EG2ControllerDecayInfluence,
102 0, 3),
103 eEG2ControllerReleaseInfluence("ControllerReleaseInfluence",
104 &gig::DimensionRegion::EG2ControllerReleaseInfluence,
105 0, 3),
106 eLFO2Frequency("Frequency", &gig::DimensionRegion::LFO2Frequency,
107 0.1, 10, 2),
108 eLFO2InternalDepth("InternalDepth",
109 &gig::DimensionRegion::LFO2InternalDepth, 0, 1200),
110 eLFO2ControlDepth("ControlDepth",
111 &gig::DimensionRegion::LFO2ControlDepth, 0, 1200),
112 eLFO2Controller("Controller", &gig::DimensionRegion::LFO2Controller),
113 eLFO2FlipPhase("FlipPhase", &gig::DimensionRegion::LFO2FlipPhase),
114 eLFO2Sync("Sync", &gig::DimensionRegion::LFO2Sync),
115 eEG3Attack("Attack", &gig::DimensionRegion::EG3Attack, 0, 10, 3),
116 eEG3Depth("Depth", &gig::DimensionRegion::EG3Depth, -1200, 1200),
117 eLFO3Frequency("Frequency", &gig::DimensionRegion::LFO3Frequency,
118 0.1, 10, 2),
119 eLFO3InternalDepth("InternalDepth",
120 &gig::DimensionRegion::LFO3InternalDepth, 0, 1200),
121 eLFO3ControlDepth("ControlDepth", &gig::DimensionRegion::LFO3ControlDepth,
122 0, 1200),
123 eLFO3Controller("Controller", &gig::DimensionRegion::LFO3Controller),
124 eLFO3Sync("Sync", &gig::DimensionRegion::LFO3Sync),
125 eVCFEnabled("Enabled", &gig::DimensionRegion::VCFEnabled),
126 eVCFType("Type", &gig::DimensionRegion::VCFType),
127 eVCFCutoffController("CutoffController",
128 &gig::DimensionRegion::VCFCutoffController),
129 eVCFCutoffControllerInvert("CutoffControllerInvert",
130 &gig::DimensionRegion::VCFCutoffControllerInvert),
131 eVCFCutoff("Cutoff", &gig::DimensionRegion::VCFCutoff),
132 eVCFVelocityCurve("VelocityCurve", &gig::DimensionRegion::VCFVelocityCurve),
133 eVCFVelocityScale("VelocityScale", &gig::DimensionRegion::VCFVelocityScale),
134 eVCFVelocityDynamicRange("VelocityDynamicRange",
135 &gig::DimensionRegion::VCFVelocityDynamicRange,
136 0, 4),
137 eVCFResonance("Resonance", &gig::DimensionRegion::VCFResonance),
138 eVCFResonanceDynamic("ResonanceDynamic",
139 &gig::DimensionRegion::VCFResonanceDynamic),
140 eVCFResonanceController("ResonanceController",
141 &gig::DimensionRegion::VCFResonanceController),
142 eVCFKeyboardTracking("KeyboardTracking",
143 &gig::DimensionRegion::VCFKeyboardTracking),
144 eVCFKeyboardTrackingBreakpoint("KeyboardTrackingBreakpoint",
145 &gig::DimensionRegion::VCFKeyboardTrackingBreakpoint),
146 eVelocityResponseCurve("VelocityResponseCurve",
147 &gig::DimensionRegion::VelocityResponseCurve),
148 eVelocityResponseDepth("VelocityResponseDepth",
149 &gig::DimensionRegion::VelocityResponseDepth, 0, 4),
150 eVelocityResponseCurveScaling("VelocityResponseCurveScaling",
151 &gig::DimensionRegion::VelocityResponseCurveScaling),
152 eReleaseVelocityResponseCurve("ReleaseVelocityResponseCurve",
153 &gig::DimensionRegion::ReleaseVelocityResponseCurve),
154 eReleaseVelocityResponseDepth("ReleaseVelocityResponseDepth",
155 &gig::DimensionRegion::ReleaseVelocityResponseDepth,
156 0, 4),
157 eReleaseTriggerDecay("ReleaseTriggerDecay",
158 &gig::DimensionRegion::ReleaseTriggerDecay, 0, 8),
159 eCrossfade_in_start("Crossfade.in_start", &access_Crossfade_in_start),
160 eCrossfade_in_end("Crossfade.in_end", &access_Crossfade_in_end),
161 eCrossfade_out_start("Crossfade.out_start", &access_Crossfade_out_start),
162 eCrossfade_out_end("Crossfade.out_end", &access_Crossfade_out_end),
163 ePitchTrack("PitchTrack", &gig::DimensionRegion::PitchTrack),
164 eDimensionBypass("DimensionBypass", &gig::DimensionRegion::DimensionBypass),
165 ePan("Pan", &gig::DimensionRegion::Pan, -64, 63),
166 eSelfMask("SelfMask", &gig::DimensionRegion::SelfMask),
167 eAttenuationController("AttenuationController",
168 &gig::DimensionRegion::AttenuationController),
169 eInvertAttenuationController("InvertAttenuationController",
170 &gig::DimensionRegion::InvertAttenuationController),
171 eAttenuationControllerThreshold("AttenuationControllerThreshold",
172 &gig::DimensionRegion::AttenuationControllerThreshold),
173 eChannelOffset("ChannelOffset", &gig::DimensionRegion::ChannelOffset, 0, 9),
174 eSustainDefeat("SustainDefeat", &gig::DimensionRegion::SustainDefeat),
175 eMSDecode("MSDecode", &gig::DimensionRegion::MSDecode),
176 eSampleStartOffset("SampleStartOffset",
177 &gig::DimensionRegion::SampleStartOffset, 0, 2000),
178 eUnityNote("UnityNote", &access_UnityNote),
179 eFineTune("FineTune", &access_FineTune, -49, 50),
180 eGain("Gain", -96, 0, 2),
181 eSampleLoops("SampleLoops", &access_SampleLoops, 0, 1)
182 {
183 for (int i = 0 ; i < 5 ; i++) {
184 table[i] = new Gtk::Table(3, 1);
185 table[i]->set_col_spacings(5);
186 }
187
188 pageno = 0;
189 rowno = 0;
190 firstRowInBlock = 0;
191
192 addString("Sample", lSample, wSample);
193 //TODO: the following would break drag&drop: wSample->property_editable().set_value(false); or this: wSample->set_editable(false);
194 addHeader("EG1");
195 addProp(eEG1PreAttack);
196 addProp(eEG1Attack);
197 addProp(eEG1Decay1);
198 addProp(eEG1Decay2);
199 addProp(eEG1InfiniteSustain);
200 addProp(eEG1Sustain);
201 addProp(eEG1Release);
202 addProp(eEG1Hold);
203 addProp(eEG1Controller);
204 addProp(eEG1ControllerInvert);
205 addProp(eEG1ControllerAttackInfluence);
206 addProp(eEG1ControllerDecayInfluence);
207 addProp(eEG1ControllerReleaseInfluence);
208 addHeader("LFO1");
209 addProp(eLFO1Frequency);
210 addProp(eLFO1InternalDepth);
211 addProp(eLFO1ControlDepth);
212 {
213 char* choices[] = { "internal", "modwheel", "breath",
214 "internal+modwheel", "internal+breath", 0 };
215 static const gig::lfo1_ctrl_t values[] = {
216 gig::lfo1_ctrl_internal,
217 gig::lfo1_ctrl_modwheel,
218 gig::lfo1_ctrl_breath,
219 gig::lfo1_ctrl_internal_modwheel,
220 gig::lfo1_ctrl_internal_breath
221 };
222 eLFO1Controller.set_choices(choices, values);
223 }
224 addProp(eLFO1Controller);
225 addProp(eLFO1FlipPhase);
226 addProp(eLFO1Sync);
227
228 nextPage();
229 addHeader("EG2");
230 addProp(eEG2PreAttack);
231 addProp(eEG2Attack);
232 addProp(eEG2Decay1);
233 addProp(eEG2Decay2);
234 addProp(eEG2InfiniteSustain);
235 addProp(eEG2Sustain);
236 addProp(eEG2Release);
237 addProp(eEG2Controller);
238 addProp(eEG2ControllerInvert);
239 addProp(eEG2ControllerAttackInfluence);
240 addProp(eEG2ControllerDecayInfluence);
241 addProp(eEG2ControllerReleaseInfluence);
242 addHeader("LFO2");
243 addProp(eLFO2Frequency);
244 addProp(eLFO2InternalDepth);
245 addProp(eLFO2ControlDepth);
246 {
247 char* choices[] = { "internal", "modwheel", "foot",
248 "internal+modwheel", "internal+foot", 0 };
249 static const gig::lfo2_ctrl_t values[] = {
250 gig::lfo2_ctrl_internal,
251 gig::lfo2_ctrl_modwheel,
252 gig::lfo2_ctrl_foot,
253 gig::lfo2_ctrl_internal_modwheel,
254 gig::lfo2_ctrl_internal_foot
255 };
256 eLFO2Controller.set_choices(choices, values);
257 }
258 addProp(eLFO2Controller);
259 addProp(eLFO2FlipPhase);
260 addProp(eLFO2Sync);
261
262 nextPage();
263
264 addHeader("EG3");
265 addProp(eEG3Attack);
266 addProp(eEG3Depth);
267 addHeader("LFO3");
268 addProp(eLFO3Frequency);
269 addProp(eLFO3InternalDepth);
270 addProp(eLFO3ControlDepth);
271 {
272 char* choices[] = { "internal", "modwheel", "aftertouch",
273 "internal+modwheel", "internal+aftertouch", 0 };
274 static const gig::lfo3_ctrl_t values[] = {
275 gig::lfo3_ctrl_internal,
276 gig::lfo3_ctrl_modwheel,
277 gig::lfo3_ctrl_aftertouch,
278 gig::lfo3_ctrl_internal_modwheel,
279 gig::lfo3_ctrl_internal_aftertouch
280 };
281 eLFO3Controller.set_choices(choices, values);
282 }
283 addProp(eLFO3Controller);
284 addProp(eLFO3Sync);
285 addHeader("VCF");
286 addProp(eVCFEnabled);
287 {
288 char* choices[] = { "lowpass", "lowpassturbo", "bandpass",
289 "highpass", "bandreject", 0 };
290 static const gig::vcf_type_t values[] = {
291 gig::vcf_type_lowpass,
292 gig::vcf_type_lowpassturbo,
293 gig::vcf_type_bandpass,
294 gig::vcf_type_highpass,
295 gig::vcf_type_bandreject
296 };
297 eVCFType.set_choices(choices, values);
298 }
299 addProp(eVCFType);
300 {
301 char* choices[] = { "none", "none2", "modwheel", "effect1", "effect2",
302 "breath", "foot", "sustainpedal", "softpedal",
303 "genpurpose7", "genpurpose8", "aftertouch", 0 };
304 static const gig::vcf_cutoff_ctrl_t values[] = {
305 gig::vcf_cutoff_ctrl_none,
306 gig::vcf_cutoff_ctrl_none2,
307 gig::vcf_cutoff_ctrl_modwheel,
308 gig::vcf_cutoff_ctrl_effect1,
309 gig::vcf_cutoff_ctrl_effect2,
310 gig::vcf_cutoff_ctrl_breath,
311 gig::vcf_cutoff_ctrl_foot,
312 gig::vcf_cutoff_ctrl_sustainpedal,
313 gig::vcf_cutoff_ctrl_softpedal,
314 gig::vcf_cutoff_ctrl_genpurpose7,
315 gig::vcf_cutoff_ctrl_genpurpose8,
316 gig::vcf_cutoff_ctrl_aftertouch
317 };
318 eVCFCutoffController.set_choices(choices, values);
319 }
320 addProp(eVCFCutoffController);
321 addProp(eVCFCutoffControllerInvert);
322 addProp(eVCFCutoff);
323 char* curve_type_texts[] = { "nonlinear", "linear", "special", 0 };
324 static const gig::curve_type_t curve_type_values[] = {
325 gig::curve_type_nonlinear,
326 gig::curve_type_linear,
327 gig::curve_type_special
328 };
329 eVCFVelocityCurve.set_choices(curve_type_texts, curve_type_values);
330 addProp(eVCFVelocityCurve);
331 addProp(eVCFVelocityScale);
332 addProp(eVCFVelocityDynamicRange);
333 addProp(eVCFResonance);
334 addProp(eVCFResonanceDynamic);
335 {
336 char* choices[] = { "none", "genpurpose3", "genpurpose4",
337 "genpurpose5", "genpurpose6", 0 };
338 static const gig::vcf_res_ctrl_t values[] = {
339 gig::vcf_res_ctrl_none,
340 gig::vcf_res_ctrl_genpurpose3,
341 gig::vcf_res_ctrl_genpurpose4,
342 gig::vcf_res_ctrl_genpurpose5,
343 gig::vcf_res_ctrl_genpurpose6
344 };
345 eVCFResonanceController.set_choices(choices, values);
346 }
347 addProp(eVCFResonanceController);
348 addProp(eVCFKeyboardTracking);
349 addProp(eVCFKeyboardTrackingBreakpoint);
350
351 nextPage();
352
353 eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values);
354 addProp(eVelocityResponseCurve);
355 addProp(eVelocityResponseDepth);
356 addProp(eVelocityResponseCurveScaling);
357 eReleaseVelocityResponseCurve.set_choices(curve_type_texts,
358 curve_type_values);
359 addProp(eReleaseVelocityResponseCurve);
360 addProp(eReleaseVelocityResponseDepth);
361 addProp(eReleaseTriggerDecay);
362 addProp(eCrossfade_in_start);
363 addProp(eCrossfade_in_end);
364 addProp(eCrossfade_out_start);
365 addProp(eCrossfade_out_end);
366 addProp(ePitchTrack);
367 {
368 char* choices[] = { "none", "effect4depth", "effect5depth", 0 };
369 static const gig::dim_bypass_ctrl_t values[] = {
370 gig::dim_bypass_ctrl_none,
371 gig::dim_bypass_ctrl_94,
372 gig::dim_bypass_ctrl_95
373 };
374 eDimensionBypass.set_choices(choices, values);
375 }
376 addProp(eDimensionBypass);
377 addProp(ePan);
378 addProp(eSelfMask);
379 addProp(eAttenuationController);
380 addProp(eInvertAttenuationController);
381 addProp(eAttenuationControllerThreshold);
382 addProp(eChannelOffset);
383 addProp(eSustainDefeat);
384
385 nextPage();
386 addProp(eMSDecode);
387 addProp(eSampleStartOffset);
388 addProp(eUnityNote);
389 addProp(eFineTune);
390 addProp(eGain);
391 addProp(eSampleLoops);
392 nextPage();
393
394 eEG1InfiniteSustain.signal_toggled().connect(
395 sigc::mem_fun(*this, &DimRegionEdit::EG1InfiniteSustain_toggled) );
396 eEG2InfiniteSustain.signal_toggled().connect(
397 sigc::mem_fun(*this, &DimRegionEdit::EG2InfiniteSustain_toggled) );
398 eEG1Controller.signal_changed().connect(
399 sigc::mem_fun(*this, &DimRegionEdit::EG1Controller_changed) );
400 eEG2Controller.signal_changed().connect(
401 sigc::mem_fun(*this, &DimRegionEdit::EG2Controller_changed) );
402 eLFO1Controller.signal_changed().connect(
403 sigc::mem_fun(*this, &DimRegionEdit::LFO1Controller_changed) );
404 eLFO2Controller.signal_changed().connect(
405 sigc::mem_fun(*this, &DimRegionEdit::LFO2Controller_changed) );
406 eLFO3Controller.signal_changed().connect(
407 sigc::mem_fun(*this, &DimRegionEdit::LFO3Controller_changed) );
408 eAttenuationController.signal_changed().connect(
409 sigc::mem_fun(*this, &DimRegionEdit::AttenuationController_changed) );
410 eVCFEnabled.signal_toggled().connect(
411 sigc::mem_fun(*this, &DimRegionEdit::VCFEnabled_toggled) );
412 eVCFCutoffController.signal_changed().connect(
413 sigc::mem_fun(*this, &DimRegionEdit::VCFCutoffController_changed) );
414 eVCFResonanceController.signal_changed().connect(
415 sigc::mem_fun(*this, &DimRegionEdit::VCFResonanceController_changed) );
416
417 eCrossfade_in_start.signal_value_changed().connect(
418 sigc::mem_fun(*this, &DimRegionEdit::crossfade1_changed));
419 eCrossfade_in_end.signal_value_changed().connect(
420 sigc::mem_fun(*this, &DimRegionEdit::crossfade2_changed));
421 eCrossfade_out_start.signal_value_changed().connect(
422 sigc::mem_fun(*this, &DimRegionEdit::crossfade3_changed));
423 eCrossfade_out_end.signal_value_changed().connect(
424 sigc::mem_fun(*this, &DimRegionEdit::crossfade4_changed));
425
426 append_page(*table[0], "EG1");
427 append_page(*table[1], "EG2");
428 append_page(*table[2], "EG3");
429 append_page(*table[3], "Velocity");
430 append_page(*table[4], "Misc");
431 }
432
433 DimRegionEdit::~DimRegionEdit()
434 {
435 }
436
437 void DimRegionEdit::addString(char* labelText, Gtk::Label*& label,
438 Gtk::Entry*& widget)
439 {
440 label = new Gtk::Label(Glib::ustring(labelText) + ":");
441 label->set_alignment(Gtk::ALIGN_LEFT);
442
443 table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,
444 Gtk::FILL, Gtk::SHRINK);
445
446 widget = new Gtk::Entry();
447
448 table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1,
449 Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
450
451 rowno++;
452 }
453
454 void DimRegionEdit::addHeader(char* text)
455 {
456 if (firstRowInBlock < rowno - 1)
457 {
458 Gtk::Label* filler = new Gtk::Label(" ");
459 table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,
460 Gtk::FILL, Gtk::SHRINK);
461 }
462 Glib::ustring str = "<b>";
463 str += text;
464 str += "</b>";
465 Gtk::Label* label = new Gtk::Label(str);
466 label->set_use_markup();
467 label->set_alignment(Gtk::ALIGN_LEFT);
468 table[pageno]->attach(*label, 0, 3, rowno, rowno + 1,
469 Gtk::FILL, Gtk::SHRINK);
470 rowno++;
471 firstRowInBlock = rowno;
472 }
473
474 void DimRegionEdit::nextPage()
475 {
476 if (firstRowInBlock < rowno - 1)
477 {
478 Gtk::Label* filler = new Gtk::Label(" ");
479 table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,
480 Gtk::FILL, Gtk::SHRINK);
481 }
482 pageno++;
483 rowno = 0;
484 firstRowInBlock = 0;
485 }
486
487 void DimRegionEdit::addProp(LabelWidget& prop)
488 {
489 table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1,
490 Gtk::FILL, Gtk::SHRINK);
491 table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1,
492 Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
493 rowno++;
494 }
495
496
497 void DimRegionEdit::set_dim_region(gig::DimensionRegion* d)
498 {
499 update_gui = false;
500 wSample->set_text(d->pSample ? d->pSample->pInfo->Name.c_str() : "NULL");
501 eEG1PreAttack.set_dimreg(d);
502 eEG1Attack.set_dimreg(d);
503 eEG1Decay1.set_dimreg(d);
504 eEG1Decay2.set_dimreg(d);
505 eEG1InfiniteSustain.set_dimreg(d);
506 eEG1Sustain.set_dimreg(d);
507 eEG1Release.set_dimreg(d);
508 eEG1Hold.set_dimreg(d);
509 eEG1Controller.set_dimreg(d);
510 eEG1ControllerInvert.set_dimreg(d);
511 eEG1ControllerAttackInfluence.set_dimreg(d);
512 eEG1ControllerDecayInfluence.set_dimreg(d);
513 eEG1ControllerReleaseInfluence.set_dimreg(d);
514 eLFO1Frequency.set_dimreg(d);
515 eLFO1InternalDepth.set_dimreg(d);
516 eLFO1ControlDepth.set_dimreg(d);
517 eLFO1Controller.set_dimreg(d);
518 eLFO1FlipPhase.set_dimreg(d);
519 eLFO1Sync.set_dimreg(d);
520 eEG2PreAttack.set_dimreg(d);
521 eEG2Attack.set_dimreg(d);
522 eEG2Decay1.set_dimreg(d);
523 eEG2Decay2.set_dimreg(d);
524 eEG2InfiniteSustain.set_dimreg(d);
525 eEG2Sustain.set_dimreg(d);
526 eEG2Release.set_dimreg(d);
527 eEG2Controller.set_dimreg(d);
528 eEG2ControllerInvert.set_dimreg(d);
529 eEG2ControllerAttackInfluence.set_dimreg(d);
530 eEG2ControllerDecayInfluence.set_dimreg(d);
531 eEG2ControllerReleaseInfluence.set_dimreg(d);
532 eLFO2Frequency.set_dimreg(d);
533 eLFO2InternalDepth.set_dimreg(d);
534 eLFO2ControlDepth.set_dimreg(d);
535 eLFO2Controller.set_dimreg(d);
536 eLFO2FlipPhase.set_dimreg(d);
537 eLFO2Sync.set_dimreg(d);
538 eEG3Attack.set_dimreg(d);
539 eEG3Depth.set_dimreg(d);
540 eLFO3Frequency.set_dimreg(d);
541 eLFO3InternalDepth.set_dimreg(d);
542 eLFO3ControlDepth.set_dimreg(d);
543 eLFO3Controller.set_dimreg(d);
544 eLFO3Sync.set_dimreg(d);
545 eVCFEnabled.set_dimreg(d);
546 eVCFType.set_dimreg(d);
547 eVCFCutoffController.set_dimreg(d);
548 eVCFCutoffControllerInvert.set_dimreg(d);
549 eVCFCutoff.set_dimreg(d);
550 eVCFVelocityCurve.set_dimreg(d);
551 eVCFVelocityScale.set_dimreg(d);
552 eVCFVelocityDynamicRange.set_dimreg(d);
553 eVCFResonance.set_dimreg(d);
554 eVCFResonanceDynamic.set_dimreg(d);
555 eVCFResonanceController.set_dimreg(d);
556 eVCFKeyboardTracking.set_dimreg(d);
557 eVCFKeyboardTrackingBreakpoint.set_dimreg(d);
558 eVelocityResponseCurve.set_dimreg(d);
559 eVelocityResponseDepth.set_dimreg(d);
560 eVelocityResponseCurveScaling.set_dimreg(d);
561 eReleaseVelocityResponseCurve.set_dimreg(d);
562 eReleaseVelocityResponseDepth.set_dimreg(d);
563 eReleaseTriggerDecay.set_dimreg(d);
564 eCrossfade_in_start.set_dimreg(d);
565 eCrossfade_in_end.set_dimreg(d);
566 eCrossfade_out_start.set_dimreg(d);
567 eCrossfade_out_end.set_dimreg(d);
568 ePitchTrack.set_dimreg(d);
569 eDimensionBypass.set_dimreg(d);
570 ePan.set_dimreg(d);
571 eSelfMask.set_dimreg(d);
572 eAttenuationController.set_dimreg(d);
573 eInvertAttenuationController.set_dimreg(d);
574 eAttenuationControllerThreshold.set_dimreg(d);
575 eChannelOffset.set_dimreg(d);
576 eSustainDefeat.set_dimreg(d);
577 eMSDecode.set_dimreg(d);
578 eSampleStartOffset.set_dimreg(d);
579 eUnityNote.set_dimreg(d);
580 eFineTune.set_dimreg(d);
581 eGain.set_dimreg(d);
582 eSampleLoops.set_dimreg(d);
583
584 VCFEnabled_toggled();
585
586 update_gui = true;
587 }
588
589 void DimRegionEdit::VCFEnabled_toggled()
590 {
591 bool sensitive = eVCFEnabled.get_active();
592 eVCFType.set_sensitive(sensitive);
593 eVCFCutoffController.set_sensitive(sensitive);
594 eVCFVelocityCurve.set_sensitive(sensitive);
595 eVCFVelocityScale.set_sensitive(sensitive);
596 eVCFVelocityDynamicRange.set_sensitive(sensitive);
597 eVCFResonance.set_sensitive(sensitive);
598 eVCFResonanceController.set_sensitive(sensitive);
599 eVCFKeyboardTracking.set_sensitive(sensitive);
600 eVCFKeyboardTrackingBreakpoint.set_sensitive(sensitive);
601 eEG2PreAttack.set_sensitive(sensitive);
602 eEG2Attack.set_sensitive(sensitive);
603 eEG2Decay1.set_sensitive(sensitive);
604 eEG2InfiniteSustain.set_sensitive(sensitive);
605 eEG2Sustain.set_sensitive(sensitive);
606 eEG2Release.set_sensitive(sensitive);
607 eEG2Controller.set_sensitive(sensitive);
608 eEG2ControllerAttackInfluence.set_sensitive(sensitive);
609 eEG2ControllerDecayInfluence.set_sensitive(sensitive);
610 eEG2ControllerReleaseInfluence.set_sensitive(sensitive);
611 eLFO2Frequency.set_sensitive(sensitive);
612 eLFO2InternalDepth.set_sensitive(sensitive);
613 eLFO2ControlDepth.set_sensitive(sensitive);
614 eLFO2Controller.set_sensitive(sensitive);
615 eLFO2FlipPhase.set_sensitive(sensitive);
616 eLFO2Sync.set_sensitive(sensitive);
617 if (sensitive) {
618 VCFCutoffController_changed();
619 VCFResonanceController_changed();
620 EG2InfiniteSustain_toggled();
621 EG2Controller_changed();
622 LFO2Controller_changed();
623 } else {
624 eVCFCutoffControllerInvert.set_sensitive(false);
625 eVCFCutoff.set_sensitive(false);
626 eVCFResonanceDynamic.set_sensitive(false);
627 eVCFResonance.set_sensitive(false);
628 eEG2Decay2.set_sensitive(false);
629 eEG2ControllerInvert.set_sensitive(false);
630 eLFO2InternalDepth.set_sensitive(false);
631 eLFO2ControlDepth.set_sensitive(false);
632 }
633 }
634
635 void DimRegionEdit::VCFCutoffController_changed()
636 {
637 int rowno = eVCFCutoffController.get_active_row_number();
638 bool hasController = rowno != 0 && rowno != 1;
639
640 eVCFCutoffControllerInvert.set_sensitive(hasController);
641 eVCFCutoff.set_sensitive(!hasController);
642 eVCFResonanceDynamic.set_sensitive(!hasController);
643 eVCFVelocityScale.label.set_text(hasController ? "MinimumCutoff:" :
644 "VelocityScale:");
645 }
646
647 void DimRegionEdit::VCFResonanceController_changed()
648 {
649 bool hasController = eVCFResonanceController.get_active_row_number() != 0;
650 eVCFResonance.set_sensitive(!hasController);
651 }
652
653 void DimRegionEdit::EG1InfiniteSustain_toggled()
654 {
655 bool infSus = eEG1InfiniteSustain.get_active();
656 eEG1Decay2.set_sensitive(!infSus);
657 }
658
659 void DimRegionEdit::EG2InfiniteSustain_toggled()
660 {
661 bool infSus = eEG2InfiniteSustain.get_active();
662 eEG2Decay2.set_sensitive(!infSus);
663 }
664
665 void DimRegionEdit::EG1Controller_changed()
666 {
667 bool hasController = eEG1Controller.get_active_row_number() != 0;
668 eEG1ControllerInvert.set_sensitive(hasController);
669 }
670
671 void DimRegionEdit::EG2Controller_changed()
672 {
673 bool hasController = eEG2Controller.get_active_row_number() != 0;
674 eEG2ControllerInvert.set_sensitive(hasController);
675 }
676
677 void DimRegionEdit::AttenuationController_changed()
678 {
679 bool hasController = eAttenuationController.get_active_row_number() != 0;
680 eInvertAttenuationController.set_sensitive(hasController);
681 }
682
683 void DimRegionEdit::LFO1Controller_changed()
684 {
685 int rowno = eLFO1Controller.get_active_row_number();
686 eLFO1ControlDepth.set_sensitive(rowno != 0);
687 eLFO1InternalDepth.set_sensitive(rowno != 1 && rowno != 2);
688 }
689
690 void DimRegionEdit::LFO2Controller_changed()
691 {
692 int rowno = eLFO2Controller.get_active_row_number();
693 eLFO2ControlDepth.set_sensitive(rowno != 0);
694 eLFO2InternalDepth.set_sensitive(rowno != 1 && rowno != 2);
695 }
696
697 void DimRegionEdit::LFO3Controller_changed()
698 {
699 int rowno = eLFO3Controller.get_active_row_number();
700 eLFO3ControlDepth.set_sensitive(rowno != 0);
701 eLFO3InternalDepth.set_sensitive(rowno != 1 && rowno != 2);
702 }
703
704 void DimRegionEdit::crossfade1_changed()
705 {
706 double c1 = eCrossfade_in_start.get_value();
707 double c2 = eCrossfade_in_end.get_value();
708 if (c1 > c2) eCrossfade_in_end.set_value(c1);
709 }
710
711 void DimRegionEdit::crossfade2_changed()
712 {
713 double c1 = eCrossfade_in_start.get_value();
714 double c2 = eCrossfade_in_end.get_value();
715 double c3 = eCrossfade_out_start.get_value();
716
717 if (c2 < c1) eCrossfade_in_start.set_value(c2);
718 if (c2 > c3) eCrossfade_out_start.set_value(c2);
719 }
720
721 void DimRegionEdit::crossfade3_changed()
722 {
723 double c2 = eCrossfade_in_end.get_value();
724 double c3 = eCrossfade_out_start.get_value();
725 double c4 = eCrossfade_out_end.get_value();
726
727 if (c3 < c2) eCrossfade_in_end.set_value(c3);
728 if (c3 > c4) eCrossfade_out_end.set_value(c3);
729 }
730
731 void DimRegionEdit::crossfade4_changed()
732 {
733 double c3 = eCrossfade_out_start.get_value();
734 double c4 = eCrossfade_out_end.get_value();
735
736 if (c4 < c3) eCrossfade_out_start.set_value(c4);
737 }

  ViewVC Help
Powered by ViewVC