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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1623 - (hide annotations) (download)
Fri Jan 4 19:42:45 2008 UTC (11 years, 10 months ago) by persson
File size: 44702 byte(s)
* gig files where regions are not internally ordered are now handled
* the resize mouse pointer is not shown anymore for regions that can't
  be resized
* the region and dimregion chooser widgets are now resizable
* bugfix: sometimes you could not delete more than one dimension
* filter headers are now also greyed out when the filter is inactive

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

  ViewVC Help
Powered by ViewVC