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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1196 - (hide annotations) (download)
Fri May 18 10:19:36 2007 UTC (13 years, 1 month ago) by persson
File size: 33088 byte(s)
* more fixes for resizing of new dimension zones

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

  ViewVC Help
Powered by ViewVC