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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1138 by persson, Sat Mar 31 09:33:40 2007 UTC revision 1160 by schoenebeck, Sun Apr 15 20:25:13 2007 UTC
# Line 19  Line 19 
19    
20  #include "dimregionedit.h"  #include "dimregionedit.h"
21    
22    #include <libintl.h>
23    #define _(String) gettext(String)
24    
25  DimRegionEdit::DimRegionEdit() :  DimRegionEdit::DimRegionEdit() :
26      eEG1PreAttack("PreAttack", 0, 100, 2),      eEG1PreAttack("Pre-attack", 0, 100, 2),
27      eEG1Attack("Attack", 0, 60, 3),      eEG1Attack("Attack", 0, 60, 3),
28      eEG1Decay1("Decay1", 0.005, 60, 3),      eEG1Decay1("Decay 1", 0.005, 60, 3),
29      eEG1Decay2("Decay2", 0, 60, 3),      eEG1Decay2("Decay 2", 0, 60, 3),
30      eEG1InfiniteSustain("InfiniteSustain"),      eEG1InfiniteSustain("Infinite sustain"),
31      eEG1Sustain("Sustain", 0, 100, 2),      eEG1Sustain("Sustain", 0, 100, 2),
32      eEG1Release("Release", 0, 60, 3),      eEG1Release("Release", 0, 60, 3),
33      eEG1Hold("Hold"),      eEG1Hold("Hold"),
34      eEG1Controller("Controller"),      eEG1Controller("Controller"),
35      eEG1ControllerInvert("ControllerInvert"),      eEG1ControllerInvert("Controller invert"),
36      eEG1ControllerAttackInfluence("ControllerAttackInfluence", 0, 3),      eEG1ControllerAttackInfluence("Controller attack influence", 0, 3),
37      eEG1ControllerDecayInfluence("ControllerDecayInfluence", 0, 3),      eEG1ControllerDecayInfluence("Controller decay influence", 0, 3),
38      eEG1ControllerReleaseInfluence("ControllerReleaseInfluence", 0, 3),      eEG1ControllerReleaseInfluence("Controller release influence", 0, 3),
39      eLFO1Frequency("Frequency", 0.1, 10, 2),      eLFO1Frequency("Frequency", 0.1, 10, 2),
40      eLFO1InternalDepth("InternalDepth", 0, 1200),      eLFO1InternalDepth("Internal depth", 0, 1200),
41      eLFO1ControlDepth("ControlDepth", 0, 1200),      eLFO1ControlDepth("Control depth", 0, 1200),
42      eLFO1Controller("Controller"),      eLFO1Controller("Controller"),
43      eLFO1FlipPhase("FlipPhase"),      eLFO1FlipPhase("Flip phase"),
44      eLFO1Sync("Sync"),      eLFO1Sync("Sync"),
45      eEG2PreAttack("PreAttack", 0, 100, 2),      eEG2PreAttack("Pre-attack", 0, 100, 2),
46      eEG2Attack("Attack", 0, 60, 3),      eEG2Attack("Attack", 0, 60, 3),
47      eEG2Decay1("Decay1", 0.005, 60, 3),      eEG2Decay1("Decay 1", 0.005, 60, 3),
48      eEG2Decay2("Decay2", 0, 60, 3),      eEG2Decay2("Decay 2", 0, 60, 3),
49      eEG2InfiniteSustain("InfiniteSustain"),      eEG2InfiniteSustain("Infinite sustain"),
50      eEG2Sustain("Sustain", 0, 100, 2),      eEG2Sustain("Sustain", 0, 100, 2),
51      eEG2Release("Release", 0, 60, 3),      eEG2Release("Release", 0, 60, 3),
52      eEG2Controller("Controller"),      eEG2Controller("Controller"),
53      eEG2ControllerInvert("ControllerInvert"),      eEG2ControllerInvert("Controller invert"),
54      eEG2ControllerAttackInfluence("ControllerAttackInfluence", 0, 3),      eEG2ControllerAttackInfluence("Controller attack influence", 0, 3),
55      eEG2ControllerDecayInfluence("ControllerDecayInfluence", 0, 3),      eEG2ControllerDecayInfluence("Controller decay influence", 0, 3),
56      eEG2ControllerReleaseInfluence("ControllerReleaseInfluence", 0, 3),      eEG2ControllerReleaseInfluence("Controller release influence", 0, 3),
57      eLFO2Frequency("Frequency", 0.1, 10, 2),      eLFO2Frequency("Frequency", 0.1, 10, 2),
58      eLFO2InternalDepth("InternalDepth", 0, 1200),      eLFO2InternalDepth("Internal depth", 0, 1200),
59      eLFO2ControlDepth("ControlDepth", 0, 1200),      eLFO2ControlDepth("Control depth", 0, 1200),
60      eLFO2Controller("Controller"),      eLFO2Controller("Controller"),
61      eLFO2FlipPhase("FlipPhase"),      eLFO2FlipPhase("Flip phase"),
62      eLFO2Sync("Sync"),      eLFO2Sync("Sync"),
63      eEG3Attack("Attack", 0, 10, 3),      eEG3Attack("Attack", 0, 10, 3),
64      eEG3Depth("Depth", -1200, 1200),      eEG3Depth("Depth", -1200, 1200),
65      eLFO3Frequency("Frequency", 0.1, 10, 2),      eLFO3Frequency("Frequency", 0.1, 10, 2),
66      eLFO3InternalDepth("InternalDepth", 0, 1200),      eLFO3InternalDepth("Internal depth", 0, 1200),
67      eLFO3ControlDepth("ControlDepth", 0, 1200),      eLFO3ControlDepth("Control depth", 0, 1200),
68      eLFO3Controller("Controller"),      eLFO3Controller("Controller"),
69      eLFO3Sync("Sync"),      eLFO3Sync("Sync"),
70      eVCFEnabled("Enabled"),      eVCFEnabled("Enabled"),
71      eVCFType("Type"),      eVCFType("Type"),
72      eVCFCutoffController("CutoffController"),      eVCFCutoffController("Cutoff controller"),
73      eVCFCutoffControllerInvert("CutoffControllerInvert"),      eVCFCutoffControllerInvert("Cutoff controller invert"),
74      eVCFCutoff("Cutoff"),      eVCFCutoff("Cutoff"),
75      eVCFVelocityCurve("VelocityCurve"),      eVCFVelocityCurve("Velocity curve"),
76      eVCFVelocityScale("VelocityScale"),      eVCFVelocityScale("Velocity scale"),
77      eVCFVelocityDynamicRange("VelocityDynamicRange", 0, 4),      eVCFVelocityDynamicRange("Velocity dynamic range", 0, 4),
78      eVCFResonance("Resonance"),      eVCFResonance("Resonance"),
79      eVCFResonanceDynamic("ResonanceDynamic"),      eVCFResonanceDynamic("Resonance dynamic"),
80      eVCFResonanceController("ResonanceController"),      eVCFResonanceController("Resonance controller"),
81      eVCFKeyboardTracking("KeyboardTracking"),      eVCFKeyboardTracking("Keyboard tracking"),
82      eVCFKeyboardTrackingBreakpoint("KeyboardTrackingBreakpoint"),      eVCFKeyboardTrackingBreakpoint("Keyboard tracking breakpoint"),
83      eVelocityResponseCurve("VelocityResponseCurve"),      eVelocityResponseCurve("Velocity response curve"),
84      eVelocityResponseDepth("VelocityResponseDepth", 0, 4),      eVelocityResponseDepth("Velocity response depth", 0, 4),
85      eVelocityResponseCurveScaling("VelocityResponseCurveScaling"),      eVelocityResponseCurveScaling("Velocity response curve scaling"),
86      eReleaseVelocityResponseCurve("ReleaseVelocityResponseCurve"),      eReleaseVelocityResponseCurve("Release velocity response curve"),
87      eReleaseVelocityResponseDepth("ReleaseVelocityResponseDepth", 0, 4),      eReleaseVelocityResponseDepth("Release velocity response depth", 0, 4),
88      eReleaseTriggerDecay("ReleaseTriggerDecay", 0, 8),      eReleaseTriggerDecay("Release trigger decay", 0, 8),
89      eCrossfade_in_start("Crossfade.in_start"),      eCrossfade_in_start("Crossfade-in start"),
90      eCrossfade_in_end("Crossfade.in_end"),      eCrossfade_in_end("Crossfade-in end"),
91      eCrossfade_out_start("Crossfade.out_start"),      eCrossfade_out_start("Crossfade-out start"),
92      eCrossfade_out_end("Crossfade.out_end"),      eCrossfade_out_end("Crossfade-out end"),
93      ePitchTrack("PitchTrack"),      ePitchTrack("Pitch track"),
94      eDimensionBypass("DimensionBypass"),      eDimensionBypass("Dimension bypass"),
95      ePan("Pan", -64, 63),      ePan("Pan", -64, 63),
96      eSelfMask("SelfMask"),      eSelfMask("Self mask"),
97      eAttenuationController("AttenuationController"),      eAttenuationController("Attenuation controller"),
98      eInvertAttenuationController("InvertAttenuationController"),      eInvertAttenuationController("Invert attenuation controller"),
99      eAttenuationControllerThreshold("AttenuationControllerThreshold"),      eAttenuationControllerThreshold("Attenuation controller threshold"),
100      eChannelOffset("ChannelOffset", 0, 9),      eChannelOffset("Channel offset", 0, 9),
101      eSustainDefeat("SustainDefeat"),      eSustainDefeat("Sustain defeat"),
102      eMSDecode("MSDecode"),      eMSDecode("MS decode"),
103      eSampleStartOffset("SampleStartOffset", 0, 2000),      eSampleStartOffset("Sample start offset", 0, 2000),
104      eUnityNote("UnityNote"),      eUnityNote("Unity note"),
105      eFineTune("FineTune", -49, 50),      eFineTune("Fine tune", -49, 50),
106      eGain("Gain", -96, 0, 2, -655360),      eGain("Gain", -96, 0, 2, -655360),
107      eGainPlus6("Gain +6dB", eGain, 6 * -655360),      eGainPlus6("Gain +6dB", eGain, 6 * -655360),
108      eSampleLoops("SampleLoops", 0, 1)      eSampleLoopEnabled("Enabled"),
109        eSampleLoopStart("Loop start positon"),
110        eSampleLoopLength("Loop size"),
111        eSampleLoopType("Loop type"),
112        eSampleLoopInfinite("Infinite loop"),
113        eSampleLoopPlayCount("Playback count")
114  {  {
115      for (int i = 0 ; i < 5 ; i++) {      for (int i = 0 ; i < 7 ; i++) {
116          table[i] = new Gtk::Table(3, 1);          table[i] = new Gtk::Table(3, 1);
117          table[i]->set_col_spacings(5);          table[i]->set_col_spacings(7);
118      }      }
119    
120        // 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        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    
155      pageno = 0;      pageno = 0;
156      rowno = 0;      rowno = 0;
157      firstRowInBlock = 0;      firstRowInBlock = 0;
158    
159        addHeader(_("Mandatory Settings"));
160      addString("Sample", lSample, wSample);      addString("Sample", lSample, wSample);
161      //TODO: the following would break drag&drop:   wSample->property_editable().set_value(false);  or this:    wSample->set_editable(false);      //TODO: the following would break drag&drop:   wSample->property_editable().set_value(false);  or this:    wSample->set_editable(false);
162      tooltips.set_tip(*wSample, "drop a sample here");      tooltips.set_tip(*wSample, _("Drop a sample here"));
163      addHeader("EG1");      addProp(eUnityNote);
164        addHeader(_("Optional Settings"));
165        addProp(eSampleStartOffset);
166        addProp(ePan);
167        addProp(eChannelOffset);
168        addHeader("Loops");
169        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        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        addHeader(_("General Amplitude Settings"));
193        addProp(eGain);
194        addProp(eGainPlus6);
195        addProp(eAttenuationController);
196        addProp(eInvertAttenuationController);
197        addProp(eAttenuationControllerThreshold);
198        addHeader(_("Amplitude Envelope (EG1)"));
199      addProp(eEG1PreAttack);      addProp(eEG1PreAttack);
200      addProp(eEG1Attack);      addProp(eEG1Attack);
201      addProp(eEG1Decay1);      addProp(eEG1Decay1);
# Line 130  DimRegionEdit::DimRegionEdit() : Line 209  DimRegionEdit::DimRegionEdit() :
209      addProp(eEG1ControllerAttackInfluence);      addProp(eEG1ControllerAttackInfluence);
210      addProp(eEG1ControllerDecayInfluence);      addProp(eEG1ControllerDecayInfluence);
211      addProp(eEG1ControllerReleaseInfluence);      addProp(eEG1ControllerReleaseInfluence);
212      addHeader("LFO1");  
213        nextPage();
214    
215        addHeader(_("Amplitude Oscillator (LFO1)"));
216      addProp(eLFO1Frequency);      addProp(eLFO1Frequency);
217      addProp(eLFO1InternalDepth);      addProp(eLFO1InternalDepth);
218      addProp(eLFO1ControlDepth);      addProp(eLFO1ControlDepth);
# Line 151  DimRegionEdit::DimRegionEdit() : Line 233  DimRegionEdit::DimRegionEdit() :
233      addProp(eLFO1Sync);      addProp(eLFO1Sync);
234    
235      nextPage();      nextPage();
     addHeader("EG2");  
     addProp(eEG2PreAttack);  
     addProp(eEG2Attack);  
     addProp(eEG2Decay1);  
     addProp(eEG2Decay2);  
     addProp(eEG2InfiniteSustain);  
     addProp(eEG2Sustain);  
     addProp(eEG2Release);  
     addProp(eEG2Controller);  
     addProp(eEG2ControllerInvert);  
     addProp(eEG2ControllerAttackInfluence);  
     addProp(eEG2ControllerDecayInfluence);  
     addProp(eEG2ControllerReleaseInfluence);  
     addHeader("LFO2");  
     addProp(eLFO2Frequency);  
     addProp(eLFO2InternalDepth);  
     addProp(eLFO2ControlDepth);  
     {  
         char* choices[] = { "internal", "modwheel", "foot",  
                             "internal+modwheel", "internal+foot", 0 };  
         static const gig::lfo2_ctrl_t values[] = {  
             gig::lfo2_ctrl_internal,  
             gig::lfo2_ctrl_modwheel,  
             gig::lfo2_ctrl_foot,  
             gig::lfo2_ctrl_internal_modwheel,  
             gig::lfo2_ctrl_internal_foot  
         };  
         eLFO2Controller.set_choices(choices, values);  
     }  
     addProp(eLFO2Controller);  
     addProp(eLFO2FlipPhase);  
     addProp(eLFO2Sync);  
   
     nextPage();  
236    
237      addHeader("EG3");      addHeader(_("General Filter Settings"));
     addProp(eEG3Attack);  
     addProp(eEG3Depth);  
     addHeader("LFO3");  
     addProp(eLFO3Frequency);  
     addProp(eLFO3InternalDepth);  
     addProp(eLFO3ControlDepth);  
     {  
         char* choices[] = { "internal", "modwheel", "aftertouch",  
                             "internal+modwheel", "internal+aftertouch", 0 };  
         static const gig::lfo3_ctrl_t values[] = {  
             gig::lfo3_ctrl_internal,  
             gig::lfo3_ctrl_modwheel,  
             gig::lfo3_ctrl_aftertouch,  
             gig::lfo3_ctrl_internal_modwheel,  
             gig::lfo3_ctrl_internal_aftertouch  
         };  
         eLFO3Controller.set_choices(choices, values);  
     }  
     addProp(eLFO3Controller);  
     addProp(eLFO3Sync);  
     addHeader("VCF");  
238      addProp(eVCFEnabled);      addProp(eVCFEnabled);
239      {      {
240          char* choices[] = { "lowpass", "lowpassturbo", "bandpass",          char* choices[] = { "lowpass", "lowpassturbo", "bandpass",
# Line 275  DimRegionEdit::DimRegionEdit() : Line 302  DimRegionEdit::DimRegionEdit() :
302    
303      nextPage();      nextPage();
304    
305        addHeader(_("Filter Cutoff Envelope (EG2)"));
306        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        addHeader(_("Filter Cutoff Oscillator (LFO2)"));
319        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    
338        nextPage();
339    
340        addHeader(_("General Pitch Settings"));
341        addProp(eFineTune);
342        addProp(ePitchTrack);
343        addHeader(_("Pitch Envelope (EG3)"));
344        addProp(eEG3Attack);
345        addProp(eEG3Depth);
346        addHeader(_("Pitch Oscillator (LFO3)"));
347        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      eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values);      eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values);
368      addProp(eVelocityResponseCurve);      addProp(eVelocityResponseCurve);
369      addProp(eVelocityResponseDepth);      addProp(eVelocityResponseDepth);
# Line 284  DimRegionEdit::DimRegionEdit() : Line 373  DimRegionEdit::DimRegionEdit() :
373      addProp(eReleaseVelocityResponseCurve);      addProp(eReleaseVelocityResponseCurve);
374      addProp(eReleaseVelocityResponseDepth);      addProp(eReleaseVelocityResponseDepth);
375      addProp(eReleaseTriggerDecay);      addProp(eReleaseTriggerDecay);
     addProp(eCrossfade_in_start);  
     addProp(eCrossfade_in_end);  
     addProp(eCrossfade_out_start);  
     addProp(eCrossfade_out_end);  
     addProp(ePitchTrack);  
376      {      {
377          char* choices[] = { "none", "effect4depth", "effect5depth", 0 };          char* choices[] = { "none", "effect4depth", "effect5depth", 0 };
378          static const gig::dim_bypass_ctrl_t values[] = {          static const gig::dim_bypass_ctrl_t values[] = {
# Line 299  DimRegionEdit::DimRegionEdit() : Line 383  DimRegionEdit::DimRegionEdit() :
383          eDimensionBypass.set_choices(choices, values);          eDimensionBypass.set_choices(choices, values);
384      }      }
385      addProp(eDimensionBypass);      addProp(eDimensionBypass);
     addProp(ePan);  
386      addProp(eSelfMask);      addProp(eSelfMask);
     addProp(eAttenuationController);  
     addProp(eInvertAttenuationController);  
     addProp(eAttenuationControllerThreshold);  
     addProp(eChannelOffset);  
387      addProp(eSustainDefeat);      addProp(eSustainDefeat);
   
     nextPage();  
388      addProp(eMSDecode);      addProp(eMSDecode);
389      addProp(eSampleStartOffset);  
     addProp(eUnityNote);  
     addProp(eFineTune);  
     addProp(eGain);  
     addProp(eGainPlus6);  
     addProp(eSampleLoops);  
390      nextPage();      nextPage();
391    
392    
393      eEG1InfiniteSustain.signal_toggled().connect(      eEG1InfiniteSustain.signal_toggled().connect(
394          sigc::mem_fun(*this, &DimRegionEdit::EG1InfiniteSustain_toggled) );          sigc::mem_fun(*this, &DimRegionEdit::EG1InfiniteSustain_toggled) );
395      eEG2InfiniteSustain.signal_toggled().connect(      eEG2InfiniteSustain.signal_toggled().connect(
# Line 349  DimRegionEdit::DimRegionEdit() : Line 422  DimRegionEdit::DimRegionEdit() :
422      eCrossfade_out_end.signal_value_changed().connect(      eCrossfade_out_end.signal_value_changed().connect(
423          sigc::mem_fun(*this, &DimRegionEdit::crossfade4_changed));          sigc::mem_fun(*this, &DimRegionEdit::crossfade4_changed));
424    
425      append_page(*table[0], "EG1");      eSampleLoopEnabled.signal_toggled().connect(
426      append_page(*table[1], "EG2");          sigc::mem_fun(*this, &DimRegionEdit::loop_enabled_toggled));
427      append_page(*table[2], "EG3");      eSampleLoopStart.signal_value_changed().connect(
428      append_page(*table[3], "Velocity");          sigc::mem_fun(*this, &DimRegionEdit::updateLoopElements));
429      append_page(*table[4], "Misc");      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        append_page(*table[0], "Sample");
435        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  }  }
442    
443  DimRegionEdit::~DimRegionEdit()  DimRegionEdit::~DimRegionEdit()
# Line 410  void DimRegionEdit::nextPage() Line 494  void DimRegionEdit::nextPage()
494      firstRowInBlock = 0;      firstRowInBlock = 0;
495  }  }
496    
497    void DimRegionEdit::addProp(BoolEntry& boolentry)
498    {
499        table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,
500                              Gtk::FILL, Gtk::SHRINK);
501        rowno++;
502    }
503    
504  void DimRegionEdit::addProp(LabelWidget& prop)  void DimRegionEdit::addProp(LabelWidget& prop)
505  {  {
506      table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1,      table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1,
# Line 422  void DimRegionEdit::addProp(LabelWidget& Line 513  void DimRegionEdit::addProp(LabelWidget&
513    
514  void DimRegionEdit::set_dim_region(gig::DimensionRegion* d)  void DimRegionEdit::set_dim_region(gig::DimensionRegion* d)
515  {  {
516        dimregion = d;
517    
518      set_sensitive(d);      set_sensitive(d);
519      if (!d) return;      if (!d) return;
520    
# Line 509  void DimRegionEdit::set_dim_region(gig:: Line 602  void DimRegionEdit::set_dim_region(gig::
602      eFineTune.set_ptr(&d->FineTune);      eFineTune.set_ptr(&d->FineTune);
603      eGain.set_ptr(&d->Gain);      eGain.set_ptr(&d->Gain);
604      eGainPlus6.set_ptr(&d->Gain);      eGainPlus6.set_ptr(&d->Gain);
605      eSampleLoops.set_ptr(&d->SampleLoops);  
606        eSampleLoopEnabled.set_active(d->SampleLoops);
607        updateLoopElements();
608    
609      VCFEnabled_toggled();      VCFEnabled_toggled();
610    
# Line 570  void DimRegionEdit::VCFCutoffController_ Line 665  void DimRegionEdit::VCFCutoffController_
665      eVCFCutoffControllerInvert.set_sensitive(hasController);      eVCFCutoffControllerInvert.set_sensitive(hasController);
666      eVCFCutoff.set_sensitive(!hasController);      eVCFCutoff.set_sensitive(!hasController);
667      eVCFResonanceDynamic.set_sensitive(!hasController);      eVCFResonanceDynamic.set_sensitive(!hasController);
668      eVCFVelocityScale.label.set_text(hasController ? "MinimumCutoff:" :      eVCFVelocityScale.label.set_text(hasController ? "Minimum cutoff:" :
669                                       "VelocityScale:");                                       "Velocity scale:");
670  }  }
671    
672  void DimRegionEdit::VCFResonanceController_changed()  void DimRegionEdit::VCFResonanceController_changed()
# Line 665  void DimRegionEdit::crossfade4_changed() Line 760  void DimRegionEdit::crossfade4_changed()
760    
761      if (c4 < c3) eCrossfade_out_start.set_value(c4);      if (c4 < c3) eCrossfade_out_start.set_value(c4);
762  }  }
763    
764    void DimRegionEdit::loop_enabled_toggled()
765    {
766        const bool active = eSampleLoopEnabled.get_active();
767        if (active) {
768            // create a new sample loop in case there is none yet
769            if (!dimregion->SampleLoops) {
770                DLS::sample_loop_t loop;
771                loop.LoopType   = gig::loop_type_normal;
772                // loop the whole sample by default
773                loop.LoopStart  = 0;
774                loop.LoopLength =
775                    (dimregion->pSample) ? dimregion->pSample->GetSize() : 0;
776                dimregion->AddSampleLoop(&loop);
777            }
778        } else {
779            // delete ALL existing sample loops
780            while (dimregion->SampleLoops)
781                dimregion->DeleteSampleLoop(&dimregion->pSampleLoops[0]);
782        }
783        updateLoopElements();
784    }
785    
786    void DimRegionEdit::updateLoopElements()
787    {
788        const bool active = eSampleLoopEnabled.get_active();
789        eSampleLoopStart.set_sensitive(active);
790        eSampleLoopLength.set_sensitive(active);
791        eSampleLoopType.set_sensitive(active);
792        eSampleLoopInfinite.set_sensitive(active);
793        if (dimregion && dimregion->SampleLoops) {
794            eSampleLoopStart.set_ptr(&dimregion->pSampleLoops[0].LoopStart);
795            eSampleLoopLength.set_ptr(&dimregion->pSampleLoops[0].LoopLength);
796            eSampleLoopType.set_ptr(&dimregion->pSampleLoops[0].LoopType);
797            eSampleLoopPlayCount.set_ptr(
798                (dimregion->pSample) ? &dimregion->pSample->LoopPlayCount : NULL
799            );
800            eSampleLoopInfinite.set_active(
801                dimregion->pSample && !dimregion->pSample->LoopPlayCount
802            );
803            // sample loop shall never be longer than the actual sample size
804            eSampleLoopStart.set_upper(
805                (dimregion->pSample)
806                    ? dimregion->pSample->GetSize() -
807                      dimregion->pSampleLoops[0].LoopLength
808                    : 0
809            );
810            eSampleLoopLength.set_upper(
811                (dimregion->pSample)
812                    ? dimregion->pSample->GetSize() -
813                      dimregion->pSampleLoops[0].LoopStart
814                    : 0
815            );
816        } else { // no sample loop(s)
817            eSampleLoopStart.set_ptr(NULL);
818            eSampleLoopLength.set_ptr(NULL);
819            eSampleLoopType.set_ptr(NULL);
820            eSampleLoopPlayCount.set_ptr(NULL);
821        }
822        // updated enabled state of loop play count widget
823        loop_infinite_toggled();
824    }
825    
826    void DimRegionEdit::loop_infinite_toggled() {
827        eSampleLoopPlayCount.set_sensitive(
828            !eSampleLoopInfinite.get_active() &&
829             eSampleLoopEnabled.get_active()
830        );
831        if (eSampleLoopInfinite.get_active())
832            eSampleLoopPlayCount.set_value(0);
833        else if (!eSampleLoopPlayCount.get_value())
834            eSampleLoopPlayCount.set_value(1);
835    }

Legend:
Removed from v.1138  
changed lines
  Added in v.1160

  ViewVC Help
Powered by ViewVC