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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1156 - (hide annotations) (download)
Wed Apr 11 21:36:30 2007 UTC (17 years ago) by schoenebeck
File size: 30934 byte(s)
* implemented sample loop editing

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

  ViewVC Help
Powered by ViewVC