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

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

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

revision 1533 by persson, Sat Dec 1 10:21:07 2007 UTC revision 3738 by schoenebeck, Mon Feb 3 18:47:02 2020 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006, 2007 Andreas Persson   * Copyright (C) 2006-2019 Andreas Persson
3   *   *
4   * This program is free software; you can redistribute it and/or   * This program is free software; you can redistribute it and/or
5   * modify it under the terms of the GNU General Public License as   * modify it under the terms of the GNU General Public License as
# Line 17  Line 17 
17   * 02110-1301 USA.   * 02110-1301 USA.
18   */   */
19    
20    #include "global.h"
21  #include "dimregionedit.h"  #include "dimregionedit.h"
22    
23  #include "global.h"  #include "compat.h"
24    
25    #if USE_GTKMM_GRID
26    # include <gtkmm/grid.h>
27    #else
28    # include <gtkmm/table.h>
29    #endif
30    
31    #include "Settings.h"
32    
33    VelocityCurve::VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t)) :
34        getter(getter), dimreg(0) {
35        set_size_request(80, 80);
36    }
37    
38    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
39    bool VelocityCurve::on_expose_event(GdkEventExpose* e) {
40        const Cairo::RefPtr<Cairo::Context>& cr =
41            get_window()->create_cairo_context();
42    #else
43    bool VelocityCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) {
44    #endif
45        if (dimreg) {
46            int w = get_width();
47            int h = get_height();
48    
49            for (int pass = 0 ; pass < 2 ; pass++) {
50                for (double x = 0 ; x <= w ; x++) {
51                    int vel = int(x * (127 - 1e-10) / w + 1);
52                    double y = (1 - (dimreg->*getter)(vel)) * (h - 3) + 1.5;
53    
54                    if (x < 1e-10) {
55                        cr->move_to(x, y);
56                    } else {
57                        cr->line_to(x, y);
58                    }
59                }
60                if (pass == 0) {
61                    cr->line_to(w, h);
62                    cr->line_to(0, h);
63                    cr->set_source_rgba(0.5, 0.44, 1.0, is_sensitive() ? 0.2 : 0.1);
64                    cr->fill();
65                } else {
66                    cr->set_line_width(3);
67                    cr->set_source_rgba(0.5, 0.44, 1.0, is_sensitive() ? 1.0 : 0.3);
68                    cr->stroke();
69                }
70            }
71        }
72        return true;
73    }
74    
75    
76    CrossfadeCurve::CrossfadeCurve() : dimreg(0) {
77        set_size_request(500, 100);
78    }
79    
80    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
81    bool CrossfadeCurve::on_expose_event(GdkEventExpose* e) {
82        const Cairo::RefPtr<Cairo::Context>& cr =
83            get_window()->create_cairo_context();
84    #else
85    bool CrossfadeCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) {
86    #endif
87        if (dimreg) {
88            cr->translate(1.5, 0);
89    
90            // first, draw curves for the other layers
91            gig::Region* region = dimreg->GetParent();
92            int dimregno;
93            for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) {
94                if (region->pDimensionRegions[dimregno] == dimreg) {
95                    break;
96                }
97            }
98            int bitcount = 0;
99            for (int dim = 0 ; dim < region->Dimensions ; dim++) {
100                if (region->pDimensionDefinitions[dim].dimension ==
101                    gig::dimension_layer) {
102                    int mask =
103                        ~(((1 << region->pDimensionDefinitions[dim].bits) - 1) <<
104                          bitcount);
105                    int c = dimregno & mask; // mask away the layer dimension
106    
107                    for (int i = 0 ; i < region->pDimensionDefinitions[dim].zones ;
108                         i++) {
109                        gig::DimensionRegion* d =
110                            region->pDimensionRegions[c + (i << bitcount)];
111                        if (d != dimreg) {
112                            draw_one_curve(cr, d, false);
113                        }
114                    }
115                    break;
116                }
117                bitcount += region->pDimensionDefinitions[dim].bits;
118            }
119    
120            // then, draw the currently selected layer
121            draw_one_curve(cr, dimreg, is_sensitive());
122        }
123        return true;
124    }
125    
126    void CrossfadeCurve::draw_one_curve(const Cairo::RefPtr<Cairo::Context>& cr,
127                                        const gig::DimensionRegion* d,
128                                        bool sensitive) {
129        int w = get_width();
130        int h = get_height();
131    
132        if (d->Crossfade.out_end) {
133            for (int pass = 0 ; pass < 2 ; pass++) {
134                cr->move_to(d->Crossfade.in_start / 127.0 * (w - 3), h);
135                cr->line_to(d->Crossfade.in_end / 127.0 * (w - 3), 1.5);
136                cr->line_to(d->Crossfade.out_start / 127.0 * (w - 3), 1.5);
137                cr->line_to(d->Crossfade.out_end / 127.0 * (w - 3), h);
138    
139                if (pass == 0) {
140                    cr->set_source_rgba(0.5, 0.44, 1.0, sensitive ? 0.2 : 0.1);
141                    cr->fill();
142                } else {
143                    cr->set_line_width(3);
144                    cr->set_source_rgba(0.5, 0.44, 1.0, sensitive ? 1.0 : 0.3);
145                    cr->stroke();
146                }
147            }
148        }
149    }
150    
151    
152    LFOGraph::LFOGraph() : dimreg(0) {
153        set_size_request(500, 100);
154    }
155    
156    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
157    bool LFOGraph::on_expose_event(GdkEventExpose* e) {
158        const Cairo::RefPtr<Cairo::Context>& cr =
159            get_window()->create_cairo_context();
160    #else
161    bool LFOGraph::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) {
162    #endif
163        if (dimreg) {
164            const int w = get_width();
165            const int h = get_height();
166            const bool sensitive = is_sensitive();
167            const bool signedRange = this->signedRange();
168            const float visiblePeriods = 5.f; // such that minimum LFO frequency 0.1 Hz draws exactly a half period
169    
170            // short-hand functions for setting colors
171            auto setGrayColor = [&] {
172                cr->set_source_rgba(0.88, 0.88, 0.88, sensitive ? 1.0 : 0.3);
173            };
174            auto setBlackColor = [&] {
175                cr->set_source_rgba(0, 0, 0, sensitive ? 1.0 : 0.3);
176            };
177            auto setGreenColor = [&] {
178                cr->set_source_rgba(94/255.f, 219/255.f, 80/255.f, sensitive ? 1.0 : 0.3);
179            };
180            auto setRedColor = [&] {
181                cr->set_source_rgba(255.f, 44/255.f, 44/255.f, sensitive ? 1.0 : 0.3);
182            };
183            /*auto setBlueColor = [&] {
184                cr->set_source_rgba(53/255.f, 167/255.f, 255.f, sensitive ? 1.0 : 0.3);
185            };*/
186            auto setOrangeColor = [&] {
187                cr->set_source_rgba(255.f, 177/255.f, 82/255.f, sensitive ? 1.0 : 0.3);
188            };
189            auto setWhiteColor = [&] {
190                cr->set_source_rgba(255.f, 255.f, 255.f, sensitive ? 1.0 : 0.3);
191            };
192    
193            // fill background white
194            cr->rectangle(0, 0, w, h);
195            setWhiteColor();
196            cr->fill();
197    
198            // draw horizontal center line (dashed gray) if LFO range is signed
199            if (signedRange) {
200                cr->move_to(0, h/2);
201                cr->line_to(w, h/2);
202                cr->set_line_width(2);
203                setGrayColor();
204                cr->set_dash(std::vector<double>{ 7, 5 }, 0 /*offset*/);
205                cr->stroke();
206            }
207    
208            // draw a vertical line for each second
209            for (int period = 1; period < visiblePeriods; ++period) {
210                int x = float(w) / float(visiblePeriods) * period;
211                cr->move_to(x, 0);
212                cr->line_to(x, h);
213                cr->set_line_width(2);
214                setGrayColor();
215                cr->set_dash(std::vector<double>{ 5, 3 }, 0 /*offset*/);
216                cr->stroke();
217            }
218    
219            // how many curves shall we draw, two or one?
220            const int runs = (hasControllerAssigned()) ? 2 : 1;
221            // only draw the two curves in dashed style if they're very close to each other
222            const bool dashedCurves = (runs == 2 && controllerDepth() < 63);
223            // draw the required amount of curves
224            for (int run = 0; run < runs; ++run) {
225                // setup the LFO generator with the relevant parameters
226                lfo.setup({
227                    .waveType = waveType(),
228                    .rangeType = (signedRange) ? LinuxSampler::LFO::range_signed : LinuxSampler::LFO::range_unsigned,
229                    .frequency = frequency(),
230                    .phase = phase(),
231                    .startLevel = startLevel(),
232                    .internalDepth = internalDepth(),
233                    .midiControllerDepth = controllerDepth(),
234                    .flipPolarity = flipPolarity(),
235                    .samplerate = w / visiblePeriods,
236                    .maxValue = (signedRange) ? h/2 : h,
237                });
238                // 1st curve reflects min. CC value, 2nd curve max. CC value
239                lfo.setMIDICtrlValue( (run == 0) ? 0 : 127 );
240    
241                // the actual render/draw loop
242                for (int x = 0; x < w ; ++x) {
243                    const float y =
244                        (signedRange) ?
245                            h/2 - lfo.render() :
246                            h   - lfo.render();
247                    if (x == 0)
248                        cr->move_to(x, y);
249                    else
250                        cr->line_to(x, y);
251                }
252                cr->set_line_width( (frequency() <= 4.f) ? 2 : 1 );
253                if (runs == 1)
254                    setOrangeColor();
255                else if (run == 0)
256                    setGreenColor();
257                else
258                    setRedColor();
259                if (dashedCurves)
260                    cr->set_dash(std::vector<double>{ 3, 3 }, (run == 0) ? 0 : 3 /*offset*/);
261                else
262                    cr->set_dash(std::vector<double>(), 0 /*offset*/);
263                cr->stroke();
264            }
265    
266            // draw text legend
267            if (runs == 2) {
268                setRedColor();
269                cr->move_to(2, 10);
270                cr->show_text("CC Max.");
271    
272                setGreenColor();
273                cr->move_to(2, 23);
274                cr->show_text("CC Min.");
275            } else { // no controller assigned, internal depth only ...
276                setOrangeColor();
277                cr->move_to(2, 10);
278                cr->show_text("Const. Depth");
279            }
280            // draw text legend for each second ("1s", "2s", ...)
281            for (int period = 1; period < visiblePeriods; ++period) {
282                int x = float(w) / float(visiblePeriods) * period;
283                setBlackColor();
284                cr->move_to(x - 13, h - 3);
285                cr->show_text(ToString(period) + "s");
286            }
287        }
288        return true;
289    }
290    
291    
292    EGStateOptions::EGStateOptions() : HBox(),
293        label(_("May be cancelled: ")),
294        checkBoxAttack(_("Attack")),
295        checkBoxAttackHold(_("Attack Hold")),
296        checkBoxDecay1(_("Decay 1")),
297        checkBoxDecay2(_("Decay 2")),
298        checkBoxRelease(_("Release"))
299    {
300        set_spacing(6);
301    
302        pack_start(label);
303        pack_start(checkBoxAttack, Gtk::PACK_SHRINK);
304        pack_start(checkBoxAttackHold, Gtk::PACK_SHRINK);
305        pack_start(checkBoxDecay1, Gtk::PACK_SHRINK);
306        pack_start(checkBoxDecay2, Gtk::PACK_SHRINK);
307        pack_start(checkBoxRelease, Gtk::PACK_SHRINK);
308    
309        checkBoxAttack.set_tooltip_text(_(
310            "If checked: a note-off aborts the 'attack' stage."
311        ));
312        checkBoxAttackHold.set_tooltip_text(_(
313            "If checked: a note-off aborts the 'attack hold' stage."
314        ));
315        checkBoxDecay1.set_tooltip_text(_(
316            "If checked: a note-off aborts the 'decay 1' stage."
317        ));
318        checkBoxDecay2.set_tooltip_text(_(
319            "If checked: a note-off aborts the 'decay 2' stage."
320        ));
321        checkBoxRelease.set_tooltip_text(_(
322            "If checked: a note-on reverts back from the 'release' stage."
323        ));
324    }
325    
326    void EGStateOptions::on_show_tooltips_changed() {
327        const bool b = Settings::singleton()->showTooltips;
328    
329        checkBoxAttack.set_has_tooltip(b);
330        checkBoxAttackHold.set_has_tooltip(b);
331        checkBoxDecay1.set_has_tooltip(b);
332        checkBoxDecay2.set_has_tooltip(b);
333        checkBoxRelease.set_has_tooltip(b);
334    }
335    
336    
337  DimRegionEdit::DimRegionEdit() :  DimRegionEdit::DimRegionEdit() :
338      eEG1PreAttack("Pre-attack", 0, 100, 2),      velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation),
339      eEG1Attack("Attack", 0, 60, 3),      release_curve(&gig::DimensionRegion::GetVelocityRelease),
340      eEG1Decay1("Decay 1", 0.005, 60, 3),      cutoff_curve(&gig::DimensionRegion::GetVelocityCutoff),
341      eEG1Decay2("Decay 2", 0, 60, 3),      eEG1PreAttack(_("Pre-attack Level (%)"), 0, 100, 2),
342      eEG1InfiniteSustain("Infinite sustain"),      eEG1Attack(_("Attack Time (seconds)"), 0, 60, 3),
343      eEG1Sustain("Sustain", 0, 100, 2),      eEG1Decay1(_("Decay 1 Time (seconds)"), 0.005, 60, 3),
344      eEG1Release("Release", 0, 60, 3),      eEG1Decay2(_("Decay 2 Time (seconds)"), 0, 60, 3),
345      eEG1Hold("Hold"),      eEG1InfiniteSustain(_("Infinite sustain")),
346      eEG1Controller("Controller"),      eEG1Sustain(_("Sustain Level (%)"), 0, 100, 2),
347      eEG1ControllerInvert("Controller invert"),      eEG1Release(_("Release Time (seconds)"), 0, 60, 3),
348      eEG1ControllerAttackInfluence("Controller attack influence", 0, 3),      eEG1Hold(_("Hold Attack Stage until Loop End")),
349      eEG1ControllerDecayInfluence("Controller decay influence", 0, 3),      eEG1Controller(_("Controller")),
350      eEG1ControllerReleaseInfluence("Controller release influence", 0, 3),      eEG1ControllerInvert(_("Controller invert")),
351      eLFO1Frequency("Frequency", 0.1, 10, 2),      eEG1ControllerAttackInfluence(_("Controller attack influence"), 0, 3),
352      eLFO1InternalDepth("Internal depth", 0, 1200),      eEG1ControllerDecayInfluence(_("Controller decay influence"), 0, 3),
353      eLFO1ControlDepth("Control depth", 0, 1200),      eEG1ControllerReleaseInfluence(_("Controller release influence"), 0, 3),
354      eLFO1Controller("Controller"),      eLFO1Wave(_("Wave Form")),
355      eLFO1FlipPhase("Flip phase"),      eLFO1Frequency(_("Frequency"), 0.1, 10, 2),
356      eLFO1Sync("Sync"),      eLFO1Phase(_("Phase"), 0.0, 360.0, 2),
357      eEG2PreAttack("Pre-attack", 0, 100, 2),      eLFO1InternalDepth(_("Internal depth"), 0, 1200),
358      eEG2Attack("Attack", 0, 60, 3),      eLFO1ControlDepth(_("Control depth"), 0, 1200),
359      eEG2Decay1("Decay 1", 0.005, 60, 3),      eLFO1Controller(_("Controller")),
360      eEG2Decay2("Decay 2", 0, 60, 3),      eLFO1FlipPhase(_("Flip phase")),
361      eEG2InfiniteSustain("Infinite sustain"),      eLFO1Sync(_("Sync")),
362      eEG2Sustain("Sustain", 0, 100, 2),      eEG2PreAttack(_("Pre-attack Level (%)"), 0, 100, 2),
363      eEG2Release("Release", 0, 60, 3),      eEG2Attack(_("Attack Time (seconds)"), 0, 60, 3),
364      eEG2Controller("Controller"),      eEG2Decay1(_("Decay 1 Time (seconds)"), 0.005, 60, 3),
365      eEG2ControllerInvert("Controller invert"),      eEG2Decay2(_("Decay 2 Time (seconds)"), 0, 60, 3),
366      eEG2ControllerAttackInfluence("Controller attack influence", 0, 3),      eEG2InfiniteSustain(_("Infinite sustain")),
367      eEG2ControllerDecayInfluence("Controller decay influence", 0, 3),      eEG2Sustain(_("Sustain Level (%)"), 0, 100, 2),
368      eEG2ControllerReleaseInfluence("Controller release influence", 0, 3),      eEG2Release(_("Release Time (seconds)"), 0, 60, 3),
369      eLFO2Frequency("Frequency", 0.1, 10, 2),      eEG2Controller(_("Controller")),
370      eLFO2InternalDepth("Internal depth", 0, 1200),      eEG2ControllerInvert(_("Controller invert")),
371      eLFO2ControlDepth("Control depth", 0, 1200),      eEG2ControllerAttackInfluence(_("Controller attack influence"), 0, 3),
372      eLFO2Controller("Controller"),      eEG2ControllerDecayInfluence(_("Controller decay influence"), 0, 3),
373      eLFO2FlipPhase("Flip phase"),      eEG2ControllerReleaseInfluence(_("Controller release influence"), 0, 3),
374      eLFO2Sync("Sync"),      eLFO2Wave(_("Wave Form")),
375      eEG3Attack("Attack", 0, 10, 3),      eLFO2Frequency(_("Frequency"), 0.1, 10, 2),
376      eEG3Depth("Depth", -1200, 1200),      eLFO2Phase(_("Phase"), 0.0, 360.0, 2),
377      eLFO3Frequency("Frequency", 0.1, 10, 2),      eLFO2InternalDepth(_("Internal depth"), 0, 1200),
378      eLFO3InternalDepth("Internal depth", 0, 1200),      eLFO2ControlDepth(_("Control depth"), 0, 1200),
379      eLFO3ControlDepth("Control depth", 0, 1200),      eLFO2Controller(_("Controller")),
380      eLFO3Controller("Controller"),      eLFO2FlipPhase(_("Flip phase")),
381      eLFO3Sync("Sync"),      eLFO2Sync(_("Sync")),
382      eVCFEnabled("Enabled"),      eEG3Attack(_("Attack"), 0, 10, 3),
383      eVCFType("Type"),      eEG3Depth(_("Depth"), -1200, 1200),
384      eVCFCutoffController("Cutoff controller"),      eLFO3Wave(_("Wave Form")),
385      eVCFCutoffControllerInvert("Cutoff controller invert"),      eLFO3Frequency(_("Frequency"), 0.1, 10, 2),
386      eVCFCutoff("Cutoff"),      eLFO3Phase(_("Phase"), 0.0, 360.0, 2),
387      eVCFVelocityCurve("Velocity curve"),      eLFO3InternalDepth(_("Internal depth"), 0, 1200),
388      eVCFVelocityScale("Velocity scale"),      eLFO3ControlDepth(_("Control depth"), 0, 1200),
389      eVCFVelocityDynamicRange("Velocity dynamic range", 0, 4),      eLFO3Controller(_("Controller")),
390      eVCFResonance("Resonance"),      eLFO3FlipPhase(_("Flip phase")),
391      eVCFResonanceDynamic("Resonance dynamic"),      eLFO3Sync(_("Sync")),
392      eVCFResonanceController("Resonance controller"),      eVCFEnabled(_("Enabled")),
393      eVCFKeyboardTracking("Keyboard tracking"),      eVCFType(_("Type")),
394      eVCFKeyboardTrackingBreakpoint("Keyboard tracking breakpoint"),      eVCFCutoffController(_("Cutoff controller")),
395      eVelocityResponseCurve("Velocity response curve"),      eVCFCutoffControllerInvert(_("Cutoff controller invert")),
396      eVelocityResponseDepth("Velocity response depth", 0, 4),      eVCFCutoff(_("Cutoff")),
397      eVelocityResponseCurveScaling("Velocity response curve scaling"),      eVCFVelocityCurve(_("Velocity curve")),
398      eReleaseVelocityResponseCurve("Release velocity response curve"),      eVCFVelocityScale(_("Velocity scale")),
399      eReleaseVelocityResponseDepth("Release velocity response depth", 0, 4),      eVCFVelocityDynamicRange(_("Velocity dynamic range"), 0, 4),
400      eReleaseTriggerDecay("Release trigger decay", 0, 8),      eVCFResonance(_("Resonance")),
401      eCrossfade_in_start("Crossfade-in start"),      eVCFResonanceDynamic(_("Resonance dynamic")),
402      eCrossfade_in_end("Crossfade-in end"),      eVCFResonanceController(_("Resonance controller")),
403      eCrossfade_out_start("Crossfade-out start"),      eVCFKeyboardTracking(_("Keyboard tracking")),
404      eCrossfade_out_end("Crossfade-out end"),      eVCFKeyboardTrackingBreakpoint(_("Keyboard tracking breakpoint")),
405      ePitchTrack("Pitch track"),      eVelocityResponseCurve(_("Velocity response curve")),
406      eDimensionBypass("Dimension bypass"),      eVelocityResponseDepth(_("Velocity response depth"), 0, 4),
407      ePan("Pan", -64, 63),      eVelocityResponseCurveScaling(_("Velocity response curve scaling")),
408      eSelfMask("Self mask"),      eReleaseVelocityResponseCurve(_("Release velocity response curve")),
409      eAttenuationController("Attenuation controller"),      eReleaseVelocityResponseDepth(_("Release velocity response depth"), 0, 4),
410      eInvertAttenuationController("Invert attenuation controller"),      eReleaseTriggerDecay(_("Release trigger decay"), 0, 8),
411      eAttenuationControllerThreshold("Attenuation controller threshold"),      eCrossfade_in_start(_("Crossfade-in start")),
412      eChannelOffset("Channel offset", 0, 9),      eCrossfade_in_end(_("Crossfade-in end")),
413      eSustainDefeat("Sustain defeat"),      eCrossfade_out_start(_("Crossfade-out start")),
414      eMSDecode("MS decode"),      eCrossfade_out_end(_("Crossfade-out end")),
415      eSampleStartOffset("Sample start offset", 0, 2000),      ePitchTrack(_("Pitch track")),
416      eUnityNote("Unity note"),      eSustainReleaseTrigger(_("Sustain Release Trigger")),
417      eFineTune("Fine tune", -49, 50),      eNoNoteOffReleaseTrigger(_("No note-off release trigger")),
418      eGain("Gain", -96, 0, 2, -655360),      eDimensionBypass(_("Dimension bypass")),
419      eGainPlus6("Gain +6dB", eGain, 6 * -655360),      ePan(_("Pan"), -64, 63),
420      eSampleLoopEnabled("Enabled"),      eSelfMask(_("Kill lower velocity voices (a.k.a \"Self mask\")")),
421      eSampleLoopStart("Loop start positon"),      eAttenuationController(_("Attenuation controller")),
422      eSampleLoopLength("Loop size"),      eInvertAttenuationController(_("Invert attenuation controller")),
423      eSampleLoopType("Loop type"),      eAttenuationControllerThreshold(_("Attenuation controller threshold")),
424      eSampleLoopInfinite("Infinite loop"),      eChannelOffset(_("Channel offset"), 0, 9),
425      eSampleLoopPlayCount("Playback count", 1),      eSustainDefeat(_("Ignore Hold Pedal (a.k.a. \"Sustain defeat\")")),
426        eMSDecode(_("Decode Mid/Side Recordings")),
427        eSampleStartOffset(_("Sample start offset"), 0, 2000),
428        eUnityNote(_("Unity note")),
429        eSampleGroup(_("Sample Group")),
430        eSampleFormatInfo(_("Sample Format")),
431        eSampleID("Sample ID"),
432        eChecksum("Wave Data CRC-32"),
433        eFineTune(_("Fine tune"), -49, 50),
434        eGain(_("Gain (dB)"), -96, +96, 2, -655360),
435        eSampleLoopEnabled(_("Enabled")),
436        eSampleLoopStart(_("Loop start position")),
437        eSampleLoopLength(_("Loop size")),
438        eSampleLoopType(_("Loop type")),
439        eSampleLoopInfinite(_("Infinite loop")),
440        eSampleLoopPlayCount(_("Playback count"), 1),
441        buttonSelectSample(UNICODE_LEFT_ARROW + "  " + _("Select Sample")),
442        editScriptSlotsButton(_("Edit Slots ...")),
443      update_model(0)      update_model(0)
444  {  {
445        // make synthesis parameter page tabs scrollable
446        // (workaround for GTK3: default theme uses huge tabs which breaks layout)
447        set_scrollable();
448    
449        // use more appropriate increment/decrement steps for these spinboxes
450        eEG1PreAttack.set_increments(0.1, 5.0);
451        eEG2PreAttack.set_increments(0.1, 5.0);
452        eEG1Sustain.set_increments(0.1, 5.0);
453        eEG2Sustain.set_increments(0.1, 5.0);
454        eLFO1Frequency.set_increments(0.02, 0.2);
455        eLFO2Frequency.set_increments(0.02, 0.2);
456        eLFO3Frequency.set_increments(0.02, 0.2);
457        eLFO1Phase.set_increments(1.0, 10.0);
458        eLFO2Phase.set_increments(1.0, 10.0);
459        eLFO3Phase.set_increments(1.0, 10.0);
460    
461      connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack);      connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack);
462      connect(eEG1Attack, &gig::DimensionRegion::EG1Attack);      connect(eEG1Attack, &gig::DimensionRegion::EG1Attack);
463      connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1);      connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1);
# Line 128  DimRegionEdit::DimRegionEdit() : Line 474  DimRegionEdit::DimRegionEdit() :
474              &gig::DimensionRegion::EG1ControllerDecayInfluence);              &gig::DimensionRegion::EG1ControllerDecayInfluence);
475      connect(eEG1ControllerReleaseInfluence,      connect(eEG1ControllerReleaseInfluence,
476              &gig::DimensionRegion::EG1ControllerReleaseInfluence);              &gig::DimensionRegion::EG1ControllerReleaseInfluence);
477        connect(eEG1StateOptions.checkBoxAttack, &gig::DimensionRegion::EG1Options,
478                &gig::eg_opt_t::AttackCancel);
479        connect(eEG1StateOptions.checkBoxAttackHold, &gig::DimensionRegion::EG1Options,
480                &gig::eg_opt_t::AttackHoldCancel);
481        connect(eEG1StateOptions.checkBoxDecay1, &gig::DimensionRegion::EG1Options,
482                &gig::eg_opt_t::Decay1Cancel);
483        connect(eEG1StateOptions.checkBoxDecay2, &gig::DimensionRegion::EG1Options,
484                &gig::eg_opt_t::Decay2Cancel);
485        connect(eEG1StateOptions.checkBoxRelease, &gig::DimensionRegion::EG1Options,
486                &gig::eg_opt_t::ReleaseCancel);
487        connect(eLFO1Wave, &gig::DimensionRegion::LFO1WaveForm);
488      connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency);      connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency);
489        connect(eLFO1Phase, &gig::DimensionRegion::LFO1Phase);
490      connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth);      connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth);
491      connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth);      connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth);
492      connect(eLFO1Controller, &gig::DimensionRegion::LFO1Controller);      connect(eLFO1Controller, &gig::DimensionRegion::LFO1Controller);
# Line 149  DimRegionEdit::DimRegionEdit() : Line 507  DimRegionEdit::DimRegionEdit() :
507              &gig::DimensionRegion::EG2ControllerDecayInfluence);              &gig::DimensionRegion::EG2ControllerDecayInfluence);
508      connect(eEG2ControllerReleaseInfluence,      connect(eEG2ControllerReleaseInfluence,
509              &gig::DimensionRegion::EG2ControllerReleaseInfluence);              &gig::DimensionRegion::EG2ControllerReleaseInfluence);
510        connect(eEG2StateOptions.checkBoxAttack, &gig::DimensionRegion::EG2Options,
511                &gig::eg_opt_t::AttackCancel);
512        connect(eEG2StateOptions.checkBoxAttackHold, &gig::DimensionRegion::EG2Options,
513                &gig::eg_opt_t::AttackHoldCancel);
514        connect(eEG2StateOptions.checkBoxDecay1, &gig::DimensionRegion::EG2Options,
515                &gig::eg_opt_t::Decay1Cancel);
516        connect(eEG2StateOptions.checkBoxDecay2, &gig::DimensionRegion::EG2Options,
517                &gig::eg_opt_t::Decay2Cancel);
518        connect(eEG2StateOptions.checkBoxRelease, &gig::DimensionRegion::EG2Options,
519                &gig::eg_opt_t::ReleaseCancel);
520        connect(eLFO2Wave, &gig::DimensionRegion::LFO2WaveForm);
521      connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency);      connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency);
522        connect(eLFO2Phase, &gig::DimensionRegion::LFO2Phase);
523      connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth);      connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth);
524      connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth);      connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth);
525      connect(eLFO2Controller, &gig::DimensionRegion::LFO2Controller);      connect(eLFO2Controller, &gig::DimensionRegion::LFO2Controller);
# Line 157  DimRegionEdit::DimRegionEdit() : Line 527  DimRegionEdit::DimRegionEdit() :
527      connect(eLFO2Sync, &gig::DimensionRegion::LFO2Sync);      connect(eLFO2Sync, &gig::DimensionRegion::LFO2Sync);
528      connect(eEG3Attack, &gig::DimensionRegion::EG3Attack);      connect(eEG3Attack, &gig::DimensionRegion::EG3Attack);
529      connect(eEG3Depth, &gig::DimensionRegion::EG3Depth);      connect(eEG3Depth, &gig::DimensionRegion::EG3Depth);
530        connect(eLFO3Wave, &gig::DimensionRegion::LFO3WaveForm);
531      connect(eLFO3Frequency, &gig::DimensionRegion::LFO3Frequency);      connect(eLFO3Frequency, &gig::DimensionRegion::LFO3Frequency);
532        connect(eLFO3Phase, &gig::DimensionRegion::LFO3Phase);
533      connect(eLFO3InternalDepth, &gig::DimensionRegion::LFO3InternalDepth);      connect(eLFO3InternalDepth, &gig::DimensionRegion::LFO3InternalDepth);
534      connect(eLFO3ControlDepth, &gig::DimensionRegion::LFO3ControlDepth);      connect(eLFO3ControlDepth, &gig::DimensionRegion::LFO3ControlDepth);
535      connect(eLFO3Controller, &gig::DimensionRegion::LFO3Controller);      connect(eLFO3Controller, &gig::DimensionRegion::LFO3Controller);
536        connect(eLFO3FlipPhase, &gig::DimensionRegion::LFO3FlipPhase);
537      connect(eLFO3Sync, &gig::DimensionRegion::LFO3Sync);      connect(eLFO3Sync, &gig::DimensionRegion::LFO3Sync);
538      connect(eVCFEnabled, &gig::DimensionRegion::VCFEnabled);      connect(eVCFEnabled, &gig::DimensionRegion::VCFEnabled);
539      connect(eVCFType, &gig::DimensionRegion::VCFType);      connect(eVCFType, &gig::DimensionRegion::VCFType);
# Line 196  DimRegionEdit::DimRegionEdit() : Line 569  DimRegionEdit::DimRegionEdit() :
569      connect(eCrossfade_out_start, &DimRegionEdit::set_Crossfade_out_start);      connect(eCrossfade_out_start, &DimRegionEdit::set_Crossfade_out_start);
570      connect(eCrossfade_out_end, &DimRegionEdit::set_Crossfade_out_end);      connect(eCrossfade_out_end, &DimRegionEdit::set_Crossfade_out_end);
571      connect(ePitchTrack, &gig::DimensionRegion::PitchTrack);      connect(ePitchTrack, &gig::DimensionRegion::PitchTrack);
572        connect(eSustainReleaseTrigger, &gig::DimensionRegion::SustainReleaseTrigger);
573        connect(eNoNoteOffReleaseTrigger, &gig::DimensionRegion::NoNoteOffReleaseTrigger);
574      connect(eDimensionBypass, &gig::DimensionRegion::DimensionBypass);      connect(eDimensionBypass, &gig::DimensionRegion::DimensionBypass);
575      connect(ePan, &gig::DimensionRegion::Pan);      connect(ePan, &gig::DimensionRegion::Pan);
576      connect(eSelfMask, &gig::DimensionRegion::SelfMask);      connect(eSelfMask, &gig::DimensionRegion::SelfMask);
# Line 212  DimRegionEdit::DimRegionEdit() : Line 587  DimRegionEdit::DimRegionEdit() :
587      connect(eUnityNote, &DimRegionEdit::set_UnityNote);      connect(eUnityNote, &DimRegionEdit::set_UnityNote);
588      connect(eFineTune, &DimRegionEdit::set_FineTune);      connect(eFineTune, &DimRegionEdit::set_FineTune);
589      connect(eGain, &DimRegionEdit::set_Gain);      connect(eGain, &DimRegionEdit::set_Gain);
     connect(eGainPlus6, &DimRegionEdit::set_Gain);  
590      connect(eSampleLoopEnabled, &DimRegionEdit::set_LoopEnabled);      connect(eSampleLoopEnabled, &DimRegionEdit::set_LoopEnabled);
591      connect(eSampleLoopType, &DimRegionEdit::set_LoopType);      connect(eSampleLoopType, &DimRegionEdit::set_LoopType);
592      connect(eSampleLoopStart, &DimRegionEdit::set_LoopStart);      connect(eSampleLoopStart, &DimRegionEdit::set_LoopStart);
593      connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength);      connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength);
594      connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite);      connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite);
595      connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount);      connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount);
596        buttonSelectSample.signal_clicked().connect(
597            sigc::mem_fun(*this, &DimRegionEdit::onButtonSelectSamplePressed)
598        );
599    
600      for (int i = 0 ; i < 7 ; i++) {      for (int i = 0; i < tableSize; i++) {
601    #if USE_GTKMM_GRID
602            table[i] = new Gtk::Grid;
603            table[i]->set_column_spacing(7);
604    #else
605          table[i] = new Gtk::Table(3, 1);          table[i] = new Gtk::Table(3, 1);
606          table[i]->set_col_spacings(7);          table[i]->set_col_spacings(7);
607    #endif
608    
609    // on Gtk 3 there is absolutely no margin by default
610    #if GTKMM_MAJOR_VERSION >= 3
611    # if GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION < 12
612            table[i]->set_margin_left(12);
613            table[i]->set_margin_right(12);
614    # else
615            table[i]->set_margin_start(12);
616            table[i]->set_margin_end(12);
617    # endif
618    #endif
619      }      }
620    
621      // set tooltips      // set tooltips
622      eUnityNote.set_tip(      eUnityNote.set_tip(
623          _("Note this sample is associated with (a.k.a. 'root note')")          _("Note this sample is associated with (a.k.a. 'root note')")
624      );      );
625        buttonSelectSample.set_tooltip_text(
626            _("Selects the sample of this dimension region on the left hand side's sample tree view.")
627        );
628      eSampleStartOffset.set_tip(_("Sample position at which playback should be started"));      eSampleStartOffset.set_tip(_("Sample position at which playback should be started"));
629      ePan.set_tip(_("Stereo balance (left/right)"));      ePan.set_tip(_("Stereo balance (left/right)"));
630      eChannelOffset.set_tip(      eChannelOffset.set_tip(
# Line 259  DimRegionEdit::DimRegionEdit() : Line 655  DimRegionEdit::DimRegionEdit() :
655            "Caution: this setting is stored on Sample side, thus is shared "            "Caution: this setting is stored on Sample side, thus is shared "
656            "among all dimension regions that use this sample!")            "among all dimension regions that use this sample!")
657      );      );
658        
659        eEG1PreAttack.set_tip(
660            "Very first level this EG starts with. It rises then in Attack Time "
661            "seconds from this initial level to 100%."
662        );
663        eEG1Attack.set_tip(
664            "Duration of the EG's Attack stage, which raises its level from "
665            "Pre-Attack Level to 100%."
666        );
667        eEG1Hold.set_tip(
668           "On looped sounds, enabling this will cause the Decay 1 stage not to "
669           "enter before the loop has been passed one time."
670        );
671        eAttenuationController.set_tip(_(
672            "If you are not using the 'Layer' dimension, then this controller "
673            "simply alters the volume. If you are using the 'Layer' dimension, "
674            "then this controller is controlling the crossfade between Layers in "
675            "real-time."
676        ));
677    
678        eLFO1Sync.set_tip(
679            "If not checked, every voice will use its own LFO instance, which "
680            "causes voices triggered at different points in time to have different "
681            "LFO levels. By enabling 'Sync' here the voices will instead use and "
682            "share one single LFO, causing all voices to have the same LFO level, "
683            "no matter when the individual notes have been triggered."
684        );
685        eLFO2Sync.set_tip(
686            "If not checked, every voice will use its own LFO instance, which "
687            "causes voices triggered at different points in time to have different "
688            "LFO levels. By enabling 'Sync' here the voices will instead use and "
689            "share one single LFO, causing all voices to have the same LFO level, "
690            "no matter when the individual notes have been triggered."
691        );
692        eLFO3Sync.set_tip(
693            "If not checked, every voice will use its own LFO instance, which "
694            "causes voices triggered at different points in time to have different "
695            "LFO levels. By enabling 'Sync' here the voices will instead use and "
696            "share one single LFO, causing all voices to have the same LFO level, "
697            "no matter when the individual notes have been triggered."
698        );
699        eLFO1FlipPhase.set_tip(
700           "Inverts the LFO's generated wave vertically."
701        );
702        eLFO2FlipPhase.set_tip(
703           "Inverts the LFO's generated wave vertically."
704        );
705        eLFO3FlipPhase.set_tip(
706           "Inverts the LFO's generated wave vertically."
707        );
708    
709      pageno = 0;      pageno = 0;
710      rowno = 0;      rowno = 0;
711      firstRowInBlock = 0;      firstRowInBlock = 0;
712    
713      addHeader(_("Mandatory Settings"));      addHeader(_("Mandatory Settings"));
714      addString("Sample", lSample, wSample);      addString(_("Sample"), lSample, wSample, buttonNullSampleReference);
715        buttonNullSampleReference->set_label("X");
716        buttonNullSampleReference->set_tooltip_text(_("Remove current sample reference (NULL reference). This can be used to define a \"silent\" case where no sample shall be played."));
717        buttonNullSampleReference->signal_clicked().connect(
718            sigc::mem_fun(*this, &DimRegionEdit::nullOutSampleReference)
719        );
720      //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);
721      tooltips.set_tip(*wSample, _("Drop a sample here"));  #ifdef OLD_TOOLTIPS
722        tooltips.set_tip(*wSample, _("Drag & drop a sample here"));
723    #else
724        wSample->set_tooltip_text(_("Drag & drop a sample here"));
725    #endif
726      addProp(eUnityNote);      addProp(eUnityNote);
727        addProp(eSampleGroup);
728        addProp(eSampleFormatInfo);
729        addProp(eSampleID);
730        addProp(eChecksum);
731        addRightHandSide(buttonSelectSample);
732      addHeader(_("Optional Settings"));      addHeader(_("Optional Settings"));
733      addProp(eSampleStartOffset);      addProp(eSampleStartOffset);
734      addProp(eChannelOffset);      addProp(eChannelOffset);
735      addHeader("Loops");      addHeader(_("Loops"));
736      addProp(eSampleLoopEnabled);      addProp(eSampleLoopEnabled);
737      addProp(eSampleLoopStart);      addProp(eSampleLoopStart);
738      addProp(eSampleLoopLength);      addProp(eSampleLoopLength);
739      {      {
740          const char* choices[] = { "normal", "bidirectional", "backward", 0 };          const char* choices[] = { _("normal"), _("bidirectional"), _("backward"), 0 };
741          static const uint32_t values[] = {          static const uint32_t values[] = {
742              gig::loop_type_normal,              gig::loop_type_normal,
743              gig::loop_type_bidirectional,              gig::loop_type_bidirectional,
# Line 293  DimRegionEdit::DimRegionEdit() : Line 753  DimRegionEdit::DimRegionEdit() :
753    
754      addHeader(_("General Amplitude Settings"));      addHeader(_("General Amplitude Settings"));
755      addProp(eGain);      addProp(eGain);
     addProp(eGainPlus6);  
756      addProp(ePan);      addProp(ePan);
757      addHeader(_("Amplitude Envelope (EG1)"));      addHeader(_("Amplitude Envelope (EG1)"));
758      addProp(eEG1PreAttack);      addProp(eEG1PreAttack);
759      addProp(eEG1Attack);      addProp(eEG1Attack);
760        addProp(eEG1Hold);
761      addProp(eEG1Decay1);      addProp(eEG1Decay1);
762      addProp(eEG1Decay2);      addProp(eEG1Decay2);
763      addProp(eEG1InfiniteSustain);      addProp(eEG1InfiniteSustain);
764      addProp(eEG1Sustain);      addProp(eEG1Sustain);
765      addProp(eEG1Release);      addProp(eEG1Release);
     addProp(eEG1Hold);  
766      addProp(eEG1Controller);      addProp(eEG1Controller);
767      addProp(eEG1ControllerInvert);      addProp(eEG1ControllerInvert);
768      addProp(eEG1ControllerAttackInfluence);      addProp(eEG1ControllerAttackInfluence);
769      addProp(eEG1ControllerDecayInfluence);      addProp(eEG1ControllerDecayInfluence);
770      addProp(eEG1ControllerReleaseInfluence);      addProp(eEG1ControllerReleaseInfluence);
771        addLine(eEG1StateOptions);
772    
773      nextPage();      nextPage();
774    
775      addHeader(_("Amplitude Oscillator (LFO1)"));      addHeader(_("Amplitude Oscillator (LFO1)"));
776        addProp(eLFO1Wave);
777      addProp(eLFO1Frequency);      addProp(eLFO1Frequency);
778        addProp(eLFO1Phase);
779      addProp(eLFO1InternalDepth);      addProp(eLFO1InternalDepth);
780      addProp(eLFO1ControlDepth);      addProp(eLFO1ControlDepth);
781      {      {
782          const char* choices[] = { "internal", "modwheel", "breath",          const char* choices[] = { _("internal"), _("modwheel"), _("breath"),
783                                    "internal+modwheel", "internal+breath", 0 };                                    _("internal+modwheel"), _("internal+breath"), 0 };
784          static const gig::lfo1_ctrl_t values[] = {          static const gig::lfo1_ctrl_t values[] = {
785              gig::lfo1_ctrl_internal,              gig::lfo1_ctrl_internal,
786              gig::lfo1_ctrl_modwheel,              gig::lfo1_ctrl_modwheel,
# Line 331  DimRegionEdit::DimRegionEdit() : Line 793  DimRegionEdit::DimRegionEdit() :
793      addProp(eLFO1Controller);      addProp(eLFO1Controller);
794      addProp(eLFO1FlipPhase);      addProp(eLFO1FlipPhase);
795      addProp(eLFO1Sync);      addProp(eLFO1Sync);
796      addHeader("Crossfade");      {
797            Gtk::Frame* frame = new Gtk::Frame;
798            frame->add(lfo1Graph);
799            // on Gtk 3 there is no margin at all by default
800    #if GTKMM_MAJOR_VERSION >= 3
801            frame->set_margin_top(12);
802            frame->set_margin_bottom(12);
803    #endif
804    #if USE_GTKMM_GRID
805            table[pageno]->attach(*frame, 1, rowno, 2);
806    #else
807            table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
808                                  Gtk::SHRINK, Gtk::SHRINK);
809    #endif
810            rowno++;
811        }
812        eLFO1Wave.signal_value_changed().connect(
813            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
814        );
815        eLFO1Frequency.signal_value_changed().connect(
816            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
817        );
818        eLFO1Phase.signal_value_changed().connect(
819            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
820        );
821        eLFO1InternalDepth.signal_value_changed().connect(
822            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
823        );
824        eLFO1ControlDepth.signal_value_changed().connect(
825            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
826        );
827        eLFO1Controller.signal_value_changed().connect(
828            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
829        );
830        eLFO1FlipPhase.signal_value_changed().connect(
831            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
832        );
833        eLFO1Sync.signal_value_changed().connect(
834            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
835        );
836    
837        nextPage();
838    
839        addHeader(_("Crossfade"));
840      addProp(eAttenuationController);      addProp(eAttenuationController);
841      addProp(eInvertAttenuationController);      addProp(eInvertAttenuationController);
842      addProp(eAttenuationControllerThreshold);      addProp(eAttenuationControllerThreshold);
# Line 340  DimRegionEdit::DimRegionEdit() : Line 845  DimRegionEdit::DimRegionEdit() :
845      addProp(eCrossfade_out_start);      addProp(eCrossfade_out_start);
846      addProp(eCrossfade_out_end);      addProp(eCrossfade_out_end);
847    
848        Gtk::Frame* frame = new Gtk::Frame;
849        frame->add(crossfade_curve);
850        // on Gtk 3 there is no margin at all by default
851    #if GTKMM_MAJOR_VERSION >= 3
852        frame->set_margin_top(12);
853        frame->set_margin_bottom(12);
854    #endif
855    #if USE_GTKMM_GRID
856        table[pageno]->attach(*frame, 1, rowno, 2);
857    #else
858        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
859                              Gtk::SHRINK, Gtk::SHRINK);
860    #endif
861        rowno++;
862    
863        eCrossfade_in_start.signal_value_changed().connect(
864            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
865        eCrossfade_in_end.signal_value_changed().connect(
866            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
867        eCrossfade_out_start.signal_value_changed().connect(
868            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
869        eCrossfade_out_end.signal_value_changed().connect(
870            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
871    
872      nextPage();      nextPage();
873    
874      addHeader(_("General Filter Settings"));      addHeader(_("General Filter Settings"));
875      addProp(eVCFEnabled);      addProp(eVCFEnabled);
876      {      {
877          const char* choices[] = { "lowpass", "lowpassturbo", "bandpass",          const char* choices[] = {
878                                    "highpass", "bandreject", 0 };              _("lowpass"), _("lowpassturbo"), _("bandpass"), _("highpass"),
879                _("bandreject"),
880                _("lowpass 1-pole [EXT]"),
881                _("lowpass 2-pole [EXT]"),
882                _("lowpass 4-pole [EXT]"),
883                _("lowpass 6-pole [EXT]"),
884                _("highpass 1-pole [EXT]"),
885                _("highpass 2-pole [EXT]"),
886                _("highpass 4-pole [EXT]"),
887                _("highpass 6-pole [EXT]"),
888                _("bandpass 2-pole [EXT]"),
889                _("bandreject 2-pole [EXT]"),
890                NULL
891            };
892          static const gig::vcf_type_t values[] = {          static const gig::vcf_type_t values[] = {
893                // GigaStudio original filter types
894              gig::vcf_type_lowpass,              gig::vcf_type_lowpass,
895              gig::vcf_type_lowpassturbo,              gig::vcf_type_lowpassturbo,
896              gig::vcf_type_bandpass,              gig::vcf_type_bandpass,
897              gig::vcf_type_highpass,              gig::vcf_type_highpass,
898              gig::vcf_type_bandreject              gig::vcf_type_bandreject,
899                // LinuxSampler filter types (as gig format extension)
900                gig::vcf_type_lowpass_1p,
901                gig::vcf_type_lowpass_2p,
902                gig::vcf_type_lowpass_4p,
903                gig::vcf_type_lowpass_6p,
904                gig::vcf_type_highpass_1p,
905                gig::vcf_type_highpass_2p,
906                gig::vcf_type_highpass_4p,
907                gig::vcf_type_highpass_6p,
908                gig::vcf_type_bandpass_2p,
909                gig::vcf_type_bandreject_2p,
910          };          };
911          eVCFType.set_choices(choices, values);          eVCFType.set_choices(choices, values);
912      }      }
913      addProp(eVCFType);      addProp(eVCFType);
914      {      {
915          const char* choices[] = { "none", "none2", "modwheel", "effect1", "effect2",          const char* choices[] = { _("none"), _("none2"), _("modwheel"), _("effect1"), _("effect2"),
916                                    "breath", "foot", "sustainpedal", "softpedal",                                    _("breath"), _("foot"), _("sustainpedal"), _("softpedal"),
917                                    "genpurpose7", "genpurpose8", "aftertouch", 0 };                                    _("genpurpose7"), _("genpurpose8"), _("aftertouch"), 0 };
918          static const gig::vcf_cutoff_ctrl_t values[] = {          static const gig::vcf_cutoff_ctrl_t values[] = {
919              gig::vcf_cutoff_ctrl_none,              gig::vcf_cutoff_ctrl_none,
920              gig::vcf_cutoff_ctrl_none2,              gig::vcf_cutoff_ctrl_none2,
# Line 380  DimRegionEdit::DimRegionEdit() : Line 934  DimRegionEdit::DimRegionEdit() :
934      addProp(eVCFCutoffController);      addProp(eVCFCutoffController);
935      addProp(eVCFCutoffControllerInvert);      addProp(eVCFCutoffControllerInvert);
936      addProp(eVCFCutoff);      addProp(eVCFCutoff);
937      const char* curve_type_texts[] = { "nonlinear", "linear", "special", 0 };      const char* curve_type_texts[] = { _("nonlinear"), _("linear"), _("special"), 0 };
938      static const gig::curve_type_t curve_type_values[] = {      static const gig::curve_type_t curve_type_values[] = {
939          gig::curve_type_nonlinear,          gig::curve_type_nonlinear,
940          gig::curve_type_linear,          gig::curve_type_linear,
# Line 390  DimRegionEdit::DimRegionEdit() : Line 944  DimRegionEdit::DimRegionEdit() :
944      addProp(eVCFVelocityCurve);      addProp(eVCFVelocityCurve);
945      addProp(eVCFVelocityScale);      addProp(eVCFVelocityScale);
946      addProp(eVCFVelocityDynamicRange);      addProp(eVCFVelocityDynamicRange);
947    
948        eVCFCutoffController.signal_value_changed().connect(
949            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
950        eVCFVelocityCurve.signal_value_changed().connect(
951            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
952        eVCFVelocityScale.signal_value_changed().connect(
953            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
954        eVCFVelocityDynamicRange.signal_value_changed().connect(
955            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
956    
957        frame = new Gtk::Frame;
958        frame->add(cutoff_curve);
959        // on Gtk 3 there is no margin at all by default
960    #if GTKMM_MAJOR_VERSION >= 3
961        frame->set_margin_top(12);
962        frame->set_margin_bottom(12);
963    #endif
964    #if USE_GTKMM_GRID
965        table[pageno]->attach(*frame, 1, rowno, 2);
966    #else
967        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
968                              Gtk::SHRINK, Gtk::SHRINK);
969    #endif
970        rowno++;
971    
972      addProp(eVCFResonance);      addProp(eVCFResonance);
973      addProp(eVCFResonanceDynamic);      addProp(eVCFResonanceDynamic);
974      {      {
975          const char* choices[] = { "none", "genpurpose3", "genpurpose4",          const char* choices[] = { _("none"), _("genpurpose3"), _("genpurpose4"),
976                                    "genpurpose5", "genpurpose6", 0 };                                    _("genpurpose5"), _("genpurpose6"), 0 };
977          static const gig::vcf_res_ctrl_t values[] = {          static const gig::vcf_res_ctrl_t values[] = {
978              gig::vcf_res_ctrl_none,              gig::vcf_res_ctrl_none,
979              gig::vcf_res_ctrl_genpurpose3,              gig::vcf_res_ctrl_genpurpose3,
# Line 410  DimRegionEdit::DimRegionEdit() : Line 989  DimRegionEdit::DimRegionEdit() :
989    
990      nextPage();      nextPage();
991    
992      addHeader(_("Filter Cutoff Envelope (EG2)"));      lEG2 = addHeader(_("Filter Cutoff Envelope (EG2)"));
993      addProp(eEG2PreAttack);      addProp(eEG2PreAttack);
994      addProp(eEG2Attack);      addProp(eEG2Attack);
995      addProp(eEG2Decay1);      addProp(eEG2Decay1);
# Line 423  DimRegionEdit::DimRegionEdit() : Line 1002  DimRegionEdit::DimRegionEdit() :
1002      addProp(eEG2ControllerAttackInfluence);      addProp(eEG2ControllerAttackInfluence);
1003      addProp(eEG2ControllerDecayInfluence);      addProp(eEG2ControllerDecayInfluence);
1004      addProp(eEG2ControllerReleaseInfluence);      addProp(eEG2ControllerReleaseInfluence);
1005      addHeader(_("Filter Cutoff Oscillator (LFO2)"));      addLine(eEG2StateOptions);
1006    
1007        nextPage();
1008    
1009        lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)"));
1010        addProp(eLFO2Wave);
1011      addProp(eLFO2Frequency);      addProp(eLFO2Frequency);
1012        addProp(eLFO2Phase);
1013      addProp(eLFO2InternalDepth);      addProp(eLFO2InternalDepth);
1014      addProp(eLFO2ControlDepth);      addProp(eLFO2ControlDepth);
1015      {      {
1016          const char* choices[] = { "internal", "modwheel", "foot",          const char* choices[] = { _("internal"), _("modwheel"), _("foot"),
1017                                    "internal+modwheel", "internal+foot", 0 };                                    _("internal+modwheel"), _("internal+foot"), 0 };
1018          static const gig::lfo2_ctrl_t values[] = {          static const gig::lfo2_ctrl_t values[] = {
1019              gig::lfo2_ctrl_internal,              gig::lfo2_ctrl_internal,
1020              gig::lfo2_ctrl_modwheel,              gig::lfo2_ctrl_modwheel,
# Line 442  DimRegionEdit::DimRegionEdit() : Line 1027  DimRegionEdit::DimRegionEdit() :
1027      addProp(eLFO2Controller);      addProp(eLFO2Controller);
1028      addProp(eLFO2FlipPhase);      addProp(eLFO2FlipPhase);
1029      addProp(eLFO2Sync);      addProp(eLFO2Sync);
1030        {
1031            Gtk::Frame* frame = new Gtk::Frame;
1032            frame->add(lfo2Graph);
1033            // on Gtk 3 there is no margin at all by default
1034    #if GTKMM_MAJOR_VERSION >= 3
1035            frame->set_margin_top(12);
1036            frame->set_margin_bottom(12);
1037    #endif
1038    #if USE_GTKMM_GRID
1039            table[pageno]->attach(*frame, 1, rowno, 2);
1040    #else
1041            table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
1042                                  Gtk::SHRINK, Gtk::SHRINK);
1043    #endif
1044            rowno++;
1045        }
1046        eLFO2Wave.signal_value_changed().connect(
1047            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1048        );
1049        eLFO2Frequency.signal_value_changed().connect(
1050            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1051        );
1052        eLFO2Phase.signal_value_changed().connect(
1053            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1054        );
1055        eLFO2InternalDepth.signal_value_changed().connect(
1056            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1057        );
1058        eLFO2ControlDepth.signal_value_changed().connect(
1059            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1060        );
1061        eLFO2Controller.signal_value_changed().connect(
1062            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1063        );
1064        eLFO2FlipPhase.signal_value_changed().connect(
1065            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1066        );
1067        eLFO2Sync.signal_value_changed().connect(
1068            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1069        );
1070    
1071      nextPage();      nextPage();
1072    
# Line 452  DimRegionEdit::DimRegionEdit() : Line 1077  DimRegionEdit::DimRegionEdit() :
1077      addProp(eEG3Attack);      addProp(eEG3Attack);
1078      addProp(eEG3Depth);      addProp(eEG3Depth);
1079      addHeader(_("Pitch Oscillator (LFO3)"));      addHeader(_("Pitch Oscillator (LFO3)"));
1080        addProp(eLFO3Wave);
1081      addProp(eLFO3Frequency);      addProp(eLFO3Frequency);
1082        addProp(eLFO3Phase);
1083      addProp(eLFO3InternalDepth);      addProp(eLFO3InternalDepth);
1084      addProp(eLFO3ControlDepth);      addProp(eLFO3ControlDepth);
1085      {      {
1086          const char* choices[] = { "internal", "modwheel", "aftertouch",          const char* choices[] = { _("internal"), _("modwheel"), _("aftertouch"),
1087                                    "internal+modwheel", "internal+aftertouch", 0 };                                    _("internal+modwheel"), _("internal+aftertouch"), 0 };
1088          static const gig::lfo3_ctrl_t values[] = {          static const gig::lfo3_ctrl_t values[] = {
1089              gig::lfo3_ctrl_internal,              gig::lfo3_ctrl_internal,
1090              gig::lfo3_ctrl_modwheel,              gig::lfo3_ctrl_modwheel,
# Line 468  DimRegionEdit::DimRegionEdit() : Line 1095  DimRegionEdit::DimRegionEdit() :
1095          eLFO3Controller.set_choices(choices, values);          eLFO3Controller.set_choices(choices, values);
1096      }      }
1097      addProp(eLFO3Controller);      addProp(eLFO3Controller);
1098        addProp(eLFO3FlipPhase);
1099      addProp(eLFO3Sync);      addProp(eLFO3Sync);
1100        {
1101            Gtk::Frame* frame = new Gtk::Frame;
1102            frame->add(lfo3Graph);
1103            // on Gtk 3 there is no margin at all by default
1104    #if GTKMM_MAJOR_VERSION >= 3
1105            frame->set_margin_top(12);
1106            frame->set_margin_bottom(12);
1107    #endif
1108    #if USE_GTKMM_GRID
1109            table[pageno]->attach(*frame, 1, rowno, 2);
1110    #else
1111            table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
1112                                  Gtk::SHRINK, Gtk::SHRINK);
1113    #endif
1114            rowno++;
1115        }
1116        eLFO3Wave.signal_value_changed().connect(
1117            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1118        );
1119        eLFO3Frequency.signal_value_changed().connect(
1120            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1121        );
1122        eLFO3Phase.signal_value_changed().connect(
1123            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1124        );
1125        eLFO3InternalDepth.signal_value_changed().connect(
1126            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1127        );
1128        eLFO3ControlDepth.signal_value_changed().connect(
1129            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1130        );
1131        eLFO3Controller.signal_value_changed().connect(
1132            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1133        );
1134        eLFO3FlipPhase.signal_value_changed().connect(
1135            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1136        );
1137        eLFO3Sync.signal_value_changed().connect(
1138            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1139        );
1140    
1141      nextPage();      nextPage();
1142    
1143        addHeader(_("Velocity Response"));
1144      eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values);      eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values);
1145      addProp(eVelocityResponseCurve);      addProp(eVelocityResponseCurve);
1146      addProp(eVelocityResponseDepth);      addProp(eVelocityResponseDepth);
1147      addProp(eVelocityResponseCurveScaling);      addProp(eVelocityResponseCurveScaling);
1148    
1149        eVelocityResponseCurve.signal_value_changed().connect(
1150            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
1151        eVelocityResponseDepth.signal_value_changed().connect(
1152            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
1153        eVelocityResponseCurveScaling.signal_value_changed().connect(
1154            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
1155    
1156        frame = new Gtk::Frame;
1157        frame->add(velocity_curve);
1158        // on Gtk 3 there is no margin at all by default
1159    #if GTKMM_MAJOR_VERSION >= 3
1160        frame->set_margin_top(12);
1161        frame->set_margin_bottom(12);
1162    #endif
1163    #if USE_GTKMM_GRID
1164        table[pageno]->attach(*frame, 1, rowno, 2);
1165    #else
1166        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
1167                              Gtk::SHRINK, Gtk::SHRINK);
1168    #endif
1169        rowno++;
1170    
1171        addHeader(_("Release Velocity Response"));
1172      eReleaseVelocityResponseCurve.set_choices(curve_type_texts,      eReleaseVelocityResponseCurve.set_choices(curve_type_texts,
1173                                                curve_type_values);                                                curve_type_values);
1174      addProp(eReleaseVelocityResponseCurve);      addProp(eReleaseVelocityResponseCurve);
1175      addProp(eReleaseVelocityResponseDepth);      addProp(eReleaseVelocityResponseDepth);
1176    
1177        eReleaseVelocityResponseCurve.signal_value_changed().connect(
1178            sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));
1179        eReleaseVelocityResponseDepth.signal_value_changed().connect(
1180            sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));
1181        frame = new Gtk::Frame;
1182        frame->add(release_curve);
1183        // on Gtk 3 there is no margin at all by default
1184    #if GTKMM_MAJOR_VERSION >= 3
1185        frame->set_margin_top(12);
1186        frame->set_margin_bottom(12);
1187    #endif
1188    #if USE_GTKMM_GRID
1189        table[pageno]->attach(*frame, 1, rowno, 2);
1190    #else
1191        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
1192                              Gtk::SHRINK, Gtk::SHRINK);
1193    #endif
1194        rowno++;
1195    
1196      addProp(eReleaseTriggerDecay);      addProp(eReleaseTriggerDecay);
1197      {      {
1198          const char* choices[] = { "none", "effect4depth", "effect5depth", 0 };          const char* choices[] = { _("off"), _("on (max. velocity)"), _("on (key velocity)"), 0 };
1199            static const gig::sust_rel_trg_t values[] = {
1200                gig::sust_rel_trg_none,
1201                gig::sust_rel_trg_maxvelocity,
1202                gig::sust_rel_trg_keyvelocity
1203            };
1204            eSustainReleaseTrigger.set_choices(choices, values);
1205        }
1206        eSustainReleaseTrigger.set_tip(_(
1207            "By default release trigger samples are played on note-off events only. "
1208            "This option allows to play release trigger sample on sustain pedal up "
1209            "events as well. NOTE: This is a format extension!"
1210        ));
1211        addProp(eSustainReleaseTrigger);
1212        {
1213            const char* choices[] = { _("none"), _("effect4depth"), _("effect5depth"), 0 };
1214          static const gig::dim_bypass_ctrl_t values[] = {          static const gig::dim_bypass_ctrl_t values[] = {
1215              gig::dim_bypass_ctrl_none,              gig::dim_bypass_ctrl_none,
1216              gig::dim_bypass_ctrl_94,              gig::dim_bypass_ctrl_94,
# Line 490  DimRegionEdit::DimRegionEdit() : Line 1218  DimRegionEdit::DimRegionEdit() :
1218          };          };
1219          eDimensionBypass.set_choices(choices, values);          eDimensionBypass.set_choices(choices, values);
1220      }      }
1221        eNoNoteOffReleaseTrigger.set_tip(_(
1222            "By default release trigger samples are played on note-off events only. "
1223            "If this option is checked, then no release trigger sample is played "
1224            "when releasing a note. NOTE: This is a format extension!"
1225        ));
1226        addProp(eNoNoteOffReleaseTrigger);
1227      addProp(eDimensionBypass);      addProp(eDimensionBypass);
1228        eSelfMask.widget.set_tooltip_text(_(
1229            "If enabled: new notes with higher velocity value will stop older "
1230            "notes with lower velocity values, that way you can save voices that "
1231            "would barely be audible. This is also useful for certain drum sounds."
1232        ));
1233      addProp(eSelfMask);      addProp(eSelfMask);
1234        eSustainDefeat.widget.set_tooltip_text(_(
1235            "If enabled: sustain pedal will not hold a note. This way you can use "
1236            "the sustain pedal for other purposes, for example to switch among "
1237            "dimension regions."
1238        ));
1239      addProp(eSustainDefeat);      addProp(eSustainDefeat);
1240        eMSDecode.widget.set_tooltip_text(_(
1241            "Defines if Mid/Side Recordings should be decoded. Mid/Side Recordings "
1242            "are an alternative way to record sounds in stereo. The sampler needs "
1243            "to decode such samples to actually make use of them. Note: this "
1244            "feature is currently not supported by LinuxSampler."
1245        ));
1246      addProp(eMSDecode);      addProp(eMSDecode);
1247    
1248      nextPage();      nextPage();
# Line 539  DimRegionEdit::DimRegionEdit() : Line 1289  DimRegionEdit::DimRegionEdit() :
1289      eSampleLoopInfinite.signal_value_changed().connect(      eSampleLoopInfinite.signal_value_changed().connect(
1290          sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled));          sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled));
1291    
1292      append_page(*table[0], "Sample");  
1293      append_page(*table[1], "Amplitude (1)");      addHeader(_("Script Patch Variables"));
1294      append_page(*table[2], "Amplitude (2)");  
1295      append_page(*table[3], "Filter (1)");      m_labelPatchVarsDescr.set_markup(
1296      append_page(*table[4], "Filter (2)");          _("These are variables declared in scripts with keyword "
1297      append_page(*table[5], "Pitch");            "<span color='#FF4FF3'><b>patch</b></span>. "
1298      append_page(*table[6], "Misc");            "A 'patch' variable allows to override its default value on a per "
1299              "instrument basis. That way a script may be shared by instruments "
1300              "while being able to fine tune certain script parameters for each "
1301              "instrument individually if necessary. Overridden default values "
1302              "are displayed in bold. To revert back to the script's default "
1303              "value, select the variable(s) and hit <b>&#x232b;</b> or "
1304              "<b>&#x2326;</b> key.")
1305        );
1306        scriptVarsDescrBox.set_spacing(13);
1307        scriptVarsDescrBox.pack_start(m_labelPatchVarsDescr, true, true);
1308        scriptVarsDescrBox.pack_start(editScriptSlotsButton, false, false);
1309    #if USE_GTKMM_GRID
1310        table[pageno]->attach(scriptVarsDescrBox, 1, rowno, 2);
1311    #else
1312        table[pageno]->attach(scriptVarsDescrBox, 1, 3, rowno, rowno + 1,
1313                              Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1314    #endif
1315        rowno++;
1316    
1317    #if GTKMM_MAJOR_VERSION >= 3
1318        scriptVars.set_margin_top(20);
1319    #endif
1320    #if USE_GTKMM_GRID
1321        table[pageno]->attach(scriptVars, 1, rowno, 2);
1322    #else
1323    
1324        table[pageno]->attach(scriptVars, 1, 3, rowno, rowno + 1,
1325                              Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL);
1326    #endif
1327        rowno++;
1328    
1329    
1330        append_page(*table[0], _("Sample"));
1331        append_page(*table[1], _("Amp (1)"));
1332        append_page(*table[2], _("Amp (2)"));
1333        append_page(*table[3], _("Amp (3)"));
1334        append_page(*table[4], _("Filter (1)"));
1335        append_page(*table[5], _("Filter (2)"));
1336        append_page(*table[6], _("Filter (3)"));
1337        append_page(*table[7], _("Pitch"));
1338        append_page(*table[8], _("Misc"));
1339        append_page(*table[9], _("Script"));
1340    
1341        Settings::singleton()->showTooltips.get_proxy().signal_changed().connect(
1342            sigc::mem_fun(*this, &DimRegionEdit::on_show_tooltips_changed)
1343        );
1344    
1345        on_show_tooltips_changed();
1346  }  }
1347    
1348  DimRegionEdit::~DimRegionEdit()  DimRegionEdit::~DimRegionEdit()
# Line 556  void DimRegionEdit::addString(const char Line 1353  void DimRegionEdit::addString(const char
1353                                Gtk::Entry*& widget)                                Gtk::Entry*& widget)
1354  {  {
1355      label = new Gtk::Label(Glib::ustring(labelText) + ":");      label = new Gtk::Label(Glib::ustring(labelText) + ":");
1356      label->set_alignment(Gtk::ALIGN_LEFT);  #if HAS_GTKMM_ALIGNMENT
1357        label->set_alignment(Gtk::ALIGN_START);
1358    #else
1359        label->set_halign(Gtk::Align::START);
1360    #endif
1361    
1362    #if USE_GTKMM_GRID
1363        table[pageno]->attach(*label, 1, rowno);
1364    #else
1365      table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,      table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,
1366                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1367    #endif
1368    
1369      widget = new Gtk::Entry();      widget = new Gtk::Entry();
1370    
1371    #if USE_GTKMM_GRID
1372        table[pageno]->attach(*widget, 2, rowno);
1373    #else
1374      table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1,      table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1,
1375                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1376    #endif
1377    
1378      rowno++;      rowno++;
1379  }  }
1380    
1381  void DimRegionEdit::addHeader(const char* text)  void DimRegionEdit::addString(const char* labelText, Gtk::Label*& label,
1382                                  Gtk::Entry*& widget, Gtk::Button*& button)
1383    {
1384        label = new Gtk::Label(Glib::ustring(labelText) + ":");
1385    #if HAS_GTKMM_ALIGNMENT
1386        label->set_alignment(Gtk::ALIGN_START);
1387    #else
1388        label->set_halign(Gtk::Align::START);
1389    #endif
1390    
1391    #if USE_GTKMM_GRID
1392        table[pageno]->attach(*label, 1, rowno);
1393    #else
1394        table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,
1395                              Gtk::FILL, Gtk::SHRINK);
1396    #endif
1397    
1398        widget = new Gtk::Entry();
1399        button = new Gtk::Button();
1400    
1401        HBox* hbox = new HBox;
1402        hbox->pack_start(*widget);
1403        hbox->pack_start(*button, Gtk::PACK_SHRINK);
1404    
1405    #if USE_GTKMM_GRID
1406        table[pageno]->attach(*hbox, 2, rowno);
1407    #else
1408        table[pageno]->attach(*hbox, 2, 3, rowno, rowno + 1,
1409                              Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1410    #endif
1411    
1412        rowno++;
1413    }
1414    
1415    Gtk::Label* DimRegionEdit::addHeader(const char* text)
1416  {  {
1417      if (firstRowInBlock < rowno - 1)      if (firstRowInBlock < rowno - 1)
1418      {      {
1419          Gtk::Label* filler = new Gtk::Label("    ");          Gtk::Label* filler = new Gtk::Label("    ");
1420    #if USE_GTKMM_GRID
1421            table[pageno]->attach(*filler, 0, firstRowInBlock);
1422    #else
1423          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,
1424                                Gtk::FILL, Gtk::SHRINK);                                Gtk::FILL, Gtk::SHRINK);
1425    #endif
1426      }      }
1427      Glib::ustring str = "<b>";      Glib::ustring str = "<b>";
1428      str += text;      str += text;
1429      str += "</b>";      str += "</b>";
1430      Gtk::Label* label = new Gtk::Label(str);      Gtk::Label* label = new Gtk::Label(str);
1431      label->set_use_markup();      label->set_use_markup();
1432      label->set_alignment(Gtk::ALIGN_LEFT);  #if HAS_GTKMM_ALIGNMENT
1433        label->set_alignment(Gtk::ALIGN_START);
1434    #else
1435        label->set_halign(Gtk::Align::START);
1436    #endif
1437        // on GTKMM 3 there is absolutely no margin by default
1438    #if GTKMM_MAJOR_VERSION >= 3
1439        label->set_margin_top(18);
1440        label->set_margin_bottom(13);
1441    #endif
1442    #if USE_GTKMM_GRID
1443        table[pageno]->attach(*label, 0, rowno, 3);
1444    #else
1445      table[pageno]->attach(*label, 0, 3, rowno, rowno + 1,      table[pageno]->attach(*label, 0, 3, rowno, rowno + 1,
1446                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1447    #endif
1448      rowno++;      rowno++;
1449      firstRowInBlock = rowno;      firstRowInBlock = rowno;
1450        return label;
1451    }
1452    
1453    void DimRegionEdit::on_show_tooltips_changed() {
1454        const bool b = Settings::singleton()->showTooltips;
1455    
1456        buttonSelectSample.set_has_tooltip(b);
1457        buttonNullSampleReference->set_has_tooltip(b);
1458        wSample->set_has_tooltip(b);
1459    
1460        eEG1StateOptions.on_show_tooltips_changed();
1461        eEG2StateOptions.on_show_tooltips_changed();
1462    
1463        set_has_tooltip(b);
1464  }  }
1465    
1466  void DimRegionEdit::nextPage()  void DimRegionEdit::nextPage()
# Line 594  void DimRegionEdit::nextPage() Line 1468  void DimRegionEdit::nextPage()
1468      if (firstRowInBlock < rowno - 1)      if (firstRowInBlock < rowno - 1)
1469      {      {
1470          Gtk::Label* filler = new Gtk::Label("    ");          Gtk::Label* filler = new Gtk::Label("    ");
1471    #if USE_GTKMM_GRID
1472            table[pageno]->attach(*filler, 0, firstRowInBlock);
1473    #else
1474          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,
1475                                Gtk::FILL, Gtk::SHRINK);                                Gtk::FILL, Gtk::SHRINK);
1476    #endif
1477      }      }
1478      pageno++;      pageno++;
1479      rowno = 0;      rowno = 0;
# Line 604  void DimRegionEdit::nextPage() Line 1482  void DimRegionEdit::nextPage()
1482    
1483  void DimRegionEdit::addProp(BoolEntry& boolentry)  void DimRegionEdit::addProp(BoolEntry& boolentry)
1484  {  {
1485    #if USE_GTKMM_GRID
1486        table[pageno]->attach(boolentry.widget, 1, rowno, 2);
1487    #else
1488      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,
1489                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1490    #endif
1491      rowno++;      rowno++;
1492  }  }
1493    
1494  void DimRegionEdit::addProp(BoolEntryPlus6& boolentry)  void DimRegionEdit::addProp(LabelWidget& prop)
1495  {  {
1496      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,  #if USE_GTKMM_GRID
1497        table[pageno]->attach(prop.label, 1, rowno);
1498        table[pageno]->attach(prop.widget, 2, rowno);
1499    #else
1500        table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1,
1501                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1502        table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1,
1503                              Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1504    #endif
1505      rowno++;      rowno++;
1506  }  }
1507    
1508  void DimRegionEdit::addProp(LabelWidget& prop)  void DimRegionEdit::addLine(HBox& line)
1509  {  {
1510      table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1,  #if USE_GTKMM_GRID
1511        table[pageno]->attach(line, 1, rowno, 2);
1512    #else
1513        table[pageno]->attach(line, 1, 3, rowno, rowno + 1,
1514                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1515      table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1,  #endif
                           Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);  
1516      rowno++;      rowno++;
1517  }  }
1518    
1519    void DimRegionEdit::addRightHandSide(Gtk::Widget& widget)
1520    {
1521    #if USE_GTKMM_GRID
1522        table[pageno]->attach(widget, 2, rowno);
1523    #else
1524        table[pageno]->attach(widget, 2, 3, rowno, rowno + 1,
1525                              Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1526    #endif
1527        rowno++;
1528    }
1529    
1530  void DimRegionEdit::set_dim_region(gig::DimensionRegion* d)  void DimRegionEdit::set_dim_region(gig::DimensionRegion* d)
1531  {  {
1532      dimregion = d;      dimregion = d;
1533        velocity_curve.set_dim_region(d);
1534        release_curve.set_dim_region(d);
1535        cutoff_curve.set_dim_region(d);
1536        crossfade_curve.set_dim_region(d);
1537        lfo1Graph.set_dim_region(d);
1538        lfo2Graph.set_dim_region(d);
1539        lfo3Graph.set_dim_region(d);
1540    
1541      set_sensitive(d);      set_sensitive(d);
1542      if (!d) return;      if (!d) return;
# Line 647  void DimRegionEdit::set_dim_region(gig:: Line 1555  void DimRegionEdit::set_dim_region(gig::
1555      eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence);      eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence);
1556      eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence);      eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence);
1557      eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence);      eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence);
1558        eEG1StateOptions.checkBoxAttack.set_value(d->EG1Options.AttackCancel);
1559        eEG1StateOptions.checkBoxAttackHold.set_value(d->EG1Options.AttackHoldCancel);
1560        eEG1StateOptions.checkBoxDecay1.set_value(d->EG1Options.Decay1Cancel);
1561        eEG1StateOptions.checkBoxDecay2.set_value(d->EG1Options.Decay2Cancel);
1562        eEG1StateOptions.checkBoxRelease.set_value(d->EG1Options.ReleaseCancel);
1563        eLFO1Wave.set_value(d->LFO1WaveForm);
1564      eLFO1Frequency.set_value(d->LFO1Frequency);      eLFO1Frequency.set_value(d->LFO1Frequency);
1565        eLFO1Phase.set_value(d->LFO1Phase);
1566      eLFO1InternalDepth.set_value(d->LFO1InternalDepth);      eLFO1InternalDepth.set_value(d->LFO1InternalDepth);
1567      eLFO1ControlDepth.set_value(d->LFO1ControlDepth);      eLFO1ControlDepth.set_value(d->LFO1ControlDepth);
1568      eLFO1Controller.set_value(d->LFO1Controller);      eLFO1Controller.set_value(d->LFO1Controller);
# Line 665  void DimRegionEdit::set_dim_region(gig:: Line 1580  void DimRegionEdit::set_dim_region(gig::
1580      eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence);      eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence);
1581      eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence);      eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence);
1582      eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence);      eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence);
1583        eEG2StateOptions.checkBoxAttack.set_value(d->EG2Options.AttackCancel);
1584        eEG2StateOptions.checkBoxAttackHold.set_value(d->EG2Options.AttackHoldCancel);
1585        eEG2StateOptions.checkBoxDecay1.set_value(d->EG2Options.Decay1Cancel);
1586        eEG2StateOptions.checkBoxDecay2.set_value(d->EG2Options.Decay2Cancel);
1587        eEG2StateOptions.checkBoxRelease.set_value(d->EG2Options.ReleaseCancel);
1588        eLFO2Wave.set_value(d->LFO2WaveForm);
1589      eLFO2Frequency.set_value(d->LFO2Frequency);      eLFO2Frequency.set_value(d->LFO2Frequency);
1590        eLFO2Phase.set_value(d->LFO2Phase);
1591      eLFO2InternalDepth.set_value(d->LFO2InternalDepth);      eLFO2InternalDepth.set_value(d->LFO2InternalDepth);
1592      eLFO2ControlDepth.set_value(d->LFO2ControlDepth);      eLFO2ControlDepth.set_value(d->LFO2ControlDepth);
1593      eLFO2Controller.set_value(d->LFO2Controller);      eLFO2Controller.set_value(d->LFO2Controller);
# Line 673  void DimRegionEdit::set_dim_region(gig:: Line 1595  void DimRegionEdit::set_dim_region(gig::
1595      eLFO2Sync.set_value(d->LFO2Sync);      eLFO2Sync.set_value(d->LFO2Sync);
1596      eEG3Attack.set_value(d->EG3Attack);      eEG3Attack.set_value(d->EG3Attack);
1597      eEG3Depth.set_value(d->EG3Depth);      eEG3Depth.set_value(d->EG3Depth);
1598        eLFO3Wave.set_value(d->LFO3WaveForm);
1599      eLFO3Frequency.set_value(d->LFO3Frequency);      eLFO3Frequency.set_value(d->LFO3Frequency);
1600        eLFO3Phase.set_value(d->LFO3Phase);
1601      eLFO3InternalDepth.set_value(d->LFO3InternalDepth);      eLFO3InternalDepth.set_value(d->LFO3InternalDepth);
1602      eLFO3ControlDepth.set_value(d->LFO3ControlDepth);      eLFO3ControlDepth.set_value(d->LFO3ControlDepth);
1603      eLFO3Controller.set_value(d->LFO3Controller);      eLFO3Controller.set_value(d->LFO3Controller);
1604        eLFO3FlipPhase.set_value(d->LFO3FlipPhase);
1605      eLFO3Sync.set_value(d->LFO3Sync);      eLFO3Sync.set_value(d->LFO3Sync);
1606      eVCFEnabled.set_value(d->VCFEnabled);      eVCFEnabled.set_value(d->VCFEnabled);
1607      eVCFType.set_value(d->VCFType);      eVCFType.set_value(d->VCFType);
# Line 702  void DimRegionEdit::set_dim_region(gig:: Line 1627  void DimRegionEdit::set_dim_region(gig::
1627      eCrossfade_out_start.set_value(d->Crossfade.out_start);      eCrossfade_out_start.set_value(d->Crossfade.out_start);
1628      eCrossfade_out_end.set_value(d->Crossfade.out_end);      eCrossfade_out_end.set_value(d->Crossfade.out_end);
1629      ePitchTrack.set_value(d->PitchTrack);      ePitchTrack.set_value(d->PitchTrack);
1630        eSustainReleaseTrigger.set_value(d->SustainReleaseTrigger);
1631        eNoNoteOffReleaseTrigger.set_value(d->NoNoteOffReleaseTrigger);
1632      eDimensionBypass.set_value(d->DimensionBypass);      eDimensionBypass.set_value(d->DimensionBypass);
1633      ePan.set_value(d->Pan);      ePan.set_value(d->Pan);
1634      eSelfMask.set_value(d->SelfMask);      eSelfMask.set_value(d->SelfMask);
# Line 713  void DimRegionEdit::set_dim_region(gig:: Line 1640  void DimRegionEdit::set_dim_region(gig::
1640      eMSDecode.set_value(d->MSDecode);      eMSDecode.set_value(d->MSDecode);
1641      eSampleStartOffset.set_value(d->SampleStartOffset);      eSampleStartOffset.set_value(d->SampleStartOffset);
1642      eUnityNote.set_value(d->UnityNote);      eUnityNote.set_value(d->UnityNote);
1643        // show sample group name
1644        {
1645            Glib::ustring s = "---";
1646            if (d->pSample && d->pSample->GetGroup())
1647                s = d->pSample->GetGroup()->Name;
1648            eSampleGroup.text.set_text(s);
1649        }
1650        // assemble sample format info string
1651        {
1652            Glib::ustring s;
1653            if (d->pSample) {
1654                switch (d->pSample->Channels) {
1655                    case 1: s = _("Mono"); break;
1656                    case 2: s = _("Stereo"); break;
1657                    default:
1658                        s = ToString(d->pSample->Channels) + _(" audio channels");
1659                        break;
1660                }
1661                s += " " + ToString(d->pSample->BitDepth) + " Bits";
1662                s += " " + ToString(d->pSample->SamplesPerSecond/1000) + "."
1663                          + ToString((d->pSample->SamplesPerSecond%1000)/100) + " kHz";
1664            } else {
1665                s = _("No sample assigned to this dimension region.");
1666            }
1667            eSampleFormatInfo.text.set_text(s);
1668        }
1669        // generate sample's memory address pointer string
1670        {
1671            Glib::ustring s;
1672            if (d->pSample) {
1673                char buf[64] = {};
1674                snprintf(buf, sizeof(buf), "%p", d->pSample);
1675                s = buf;
1676            } else {
1677                s = "---";
1678            }
1679            eSampleID.text.set_text(s);
1680        }
1681        // generate raw wave form data CRC-32 checksum string
1682        {
1683            Glib::ustring s = "---";
1684            if (d->pSample) {
1685                char buf[64] = {};
1686                snprintf(buf, sizeof(buf), "%x", d->pSample->GetWaveDataCRC32Checksum());
1687                s = buf;
1688            }
1689            eChecksum.text.set_text(s);
1690        }
1691        buttonSelectSample.set_sensitive(d && d->pSample);
1692      eFineTune.set_value(d->FineTune);      eFineTune.set_value(d->FineTune);
1693      eGain.set_value(d->Gain);      eGain.set_value(d->Gain);
     eGainPlus6.set_value(d->Gain);  
1694      eSampleLoopEnabled.set_value(d->SampleLoops);      eSampleLoopEnabled.set_value(d->SampleLoops);
1695      eSampleLoopType.set_value(      eSampleLoopType.set_value(
1696          d->SampleLoops ? d->pSampleLoops[0].LoopType : 0);          d->SampleLoops ? d->pSampleLoops[0].LoopType : 0);
# Line 729  void DimRegionEdit::set_dim_region(gig:: Line 1704  void DimRegionEdit::set_dim_region(gig::
1704          d->pSample ? d->pSample->LoopPlayCount : 0);          d->pSample ? d->pSample->LoopPlayCount : 0);
1705      update_model--;      update_model--;
1706    
1707      wSample->set_text(d->pSample ? d->pSample->pInfo->Name.c_str() : "NULL");      wSample->set_text(d->pSample ? gig_to_utf8(d->pSample->pInfo->Name) :
1708                          _("NULL"));
1709    
1710        scriptVars.setInstrument(
1711            (gig::Instrument*) d->GetParent()->GetParent()
1712        );
1713    
1714      update_loop_elements();      update_loop_elements();
1715      VCFEnabled_toggled();      VCFEnabled_toggled();
# Line 744  void DimRegionEdit::VCFEnabled_toggled() Line 1724  void DimRegionEdit::VCFEnabled_toggled()
1724      eVCFVelocityCurve.set_sensitive(sensitive);      eVCFVelocityCurve.set_sensitive(sensitive);
1725      eVCFVelocityScale.set_sensitive(sensitive);      eVCFVelocityScale.set_sensitive(sensitive);
1726      eVCFVelocityDynamicRange.set_sensitive(sensitive);      eVCFVelocityDynamicRange.set_sensitive(sensitive);
1727        cutoff_curve.set_sensitive(sensitive);
1728      eVCFResonance.set_sensitive(sensitive);      eVCFResonance.set_sensitive(sensitive);
1729      eVCFResonanceController.set_sensitive(sensitive);      eVCFResonanceController.set_sensitive(sensitive);
1730      eVCFKeyboardTracking.set_sensitive(sensitive);      eVCFKeyboardTracking.set_sensitive(sensitive);
1731      eVCFKeyboardTrackingBreakpoint.set_sensitive(sensitive);      eVCFKeyboardTrackingBreakpoint.set_sensitive(sensitive);
1732        lEG2->set_sensitive(sensitive);
1733      eEG2PreAttack.set_sensitive(sensitive);      eEG2PreAttack.set_sensitive(sensitive);
1734      eEG2Attack.set_sensitive(sensitive);      eEG2Attack.set_sensitive(sensitive);
1735      eEG2Decay1.set_sensitive(sensitive);      eEG2Decay1.set_sensitive(sensitive);
# Line 758  void DimRegionEdit::VCFEnabled_toggled() Line 1740  void DimRegionEdit::VCFEnabled_toggled()
1740      eEG2ControllerAttackInfluence.set_sensitive(sensitive);      eEG2ControllerAttackInfluence.set_sensitive(sensitive);
1741      eEG2ControllerDecayInfluence.set_sensitive(sensitive);      eEG2ControllerDecayInfluence.set_sensitive(sensitive);
1742      eEG2ControllerReleaseInfluence.set_sensitive(sensitive);      eEG2ControllerReleaseInfluence.set_sensitive(sensitive);
1743        eEG2StateOptions.set_sensitive(sensitive);
1744        lLFO2->set_sensitive(sensitive);
1745        eLFO2Wave.set_sensitive(sensitive);
1746      eLFO2Frequency.set_sensitive(sensitive);      eLFO2Frequency.set_sensitive(sensitive);
1747        eLFO2Phase.set_sensitive(sensitive);
1748      eLFO2InternalDepth.set_sensitive(sensitive);      eLFO2InternalDepth.set_sensitive(sensitive);
1749      eLFO2ControlDepth.set_sensitive(sensitive);      eLFO2ControlDepth.set_sensitive(sensitive);
1750      eLFO2Controller.set_sensitive(sensitive);      eLFO2Controller.set_sensitive(sensitive);
1751      eLFO2FlipPhase.set_sensitive(sensitive);      eLFO2FlipPhase.set_sensitive(sensitive);
1752      eLFO2Sync.set_sensitive(sensitive);      eLFO2Sync.set_sensitive(sensitive);
1753        lfo2Graph.set_sensitive(sensitive);
1754      if (sensitive) {      if (sensitive) {
1755          VCFCutoffController_changed();          VCFCutoffController_changed();
1756          VCFResonanceController_changed();          VCFResonanceController_changed();
# Line 790  void DimRegionEdit::VCFCutoffController_ Line 1777  void DimRegionEdit::VCFCutoffController_
1777      eVCFCutoffControllerInvert.set_sensitive(hasController);      eVCFCutoffControllerInvert.set_sensitive(hasController);
1778      eVCFCutoff.set_sensitive(!hasController);      eVCFCutoff.set_sensitive(!hasController);
1779      eVCFResonanceDynamic.set_sensitive(!hasController);      eVCFResonanceDynamic.set_sensitive(!hasController);
1780      eVCFVelocityScale.label.set_text(hasController ? "Minimum cutoff:" :      eVCFVelocityScale.label.set_text(hasController ? _("Minimum cutoff:") :
1781                                       "Velocity scale:");                                       _("Velocity scale:"));
1782  }  }
1783    
1784  void DimRegionEdit::VCFResonanceController_changed()  void DimRegionEdit::VCFResonanceController_changed()
# Line 834  void DimRegionEdit::AttenuationControlle Line 1821  void DimRegionEdit::AttenuationControlle
1821      eCrossfade_in_end.set_sensitive(hasController);      eCrossfade_in_end.set_sensitive(hasController);
1822      eCrossfade_out_start.set_sensitive(hasController);      eCrossfade_out_start.set_sensitive(hasController);
1823      eCrossfade_out_end.set_sensitive(hasController);      eCrossfade_out_end.set_sensitive(hasController);
1824        crossfade_curve.set_sensitive(hasController);
1825  }  }
1826    
1827  void DimRegionEdit::LFO1Controller_changed()  void DimRegionEdit::LFO1Controller_changed()
# Line 947  void DimRegionEdit::loop_infinite_toggle Line 1935  void DimRegionEdit::loop_infinite_toggle
1935      update_model--;      update_model--;
1936  }  }
1937    
1938  bool DimRegionEdit::set_sample(gig::Sample* sample)  bool DimRegionEdit::set_sample(gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop)
1939  {  {
1940      if (dimregion) {      bool result = false;
1941        for (std::set<gig::DimensionRegion*>::iterator itDimReg = dimregs.begin();
1942             itDimReg != dimregs.end(); ++itDimReg)
1943        {
1944            result |= set_sample(*itDimReg, sample, copy_sample_unity, copy_sample_tune, copy_sample_loop);
1945        }
1946        return result;
1947    }
1948    
1949    bool DimRegionEdit::set_sample(gig::DimensionRegion* dimreg, gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop)
1950    {
1951        if (dimreg) {
1952          //TODO: we should better move the code from MainWindow::on_sample_label_drop_drag_data_received() here          //TODO: we should better move the code from MainWindow::on_sample_label_drop_drag_data_received() here
1953    
1954          // currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received()          // currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received()
1955          //dimreg_to_be_changed_signal.emit(dimregion);          //DimRegionChangeGuard(this, dimregion);
1956    
1957          gig::Sample* oldref = dimregion->pSample;          // make sure stereo samples always are the same in both
1958          dimregion->pSample = sample;          // dimregs in the samplechannel dimension
1959            int nbDimregs = 1;
1960            gig::DimensionRegion* d[2] = { dimreg, 0 };
1961            if (sample->Channels == 2) {
1962                gig::Region* region = dimreg->GetParent();
1963    
1964                int bitcount = 0;
1965                int stereo_bit = 0;
1966                for (int dim = 0 ; dim < region->Dimensions ; dim++) {
1967                    if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) {
1968                        stereo_bit = 1 << bitcount;
1969                        break;
1970                    }
1971                    bitcount += region->pDimensionDefinitions[dim].bits;
1972                }
1973    
1974          // copy sample information from Sample to DimensionRegion              if (stereo_bit) {
1975                    int dimregno;
1976                    for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) {
1977                        if (region->pDimensionRegions[dimregno] == dimreg) {
1978                            break;
1979                        }
1980                    }
1981                    d[0] = region->pDimensionRegions[dimregno & ~stereo_bit];
1982                    d[1] = region->pDimensionRegions[dimregno | stereo_bit];
1983                    nbDimregs = 2;
1984                }
1985            }
1986    
1987          dimregion->UnityNote = sample->MIDIUnityNote;          gig::Sample* oldref = dimreg->pSample;
         dimregion->FineTune = sample->FineTune;  
1988    
1989          int loops = sample->Loops ? 1 : 0;          for (int i = 0 ; i < nbDimregs ; i++) {
1990          while (dimregion->SampleLoops > loops) {              d[i]->pSample = sample;
1991              dimregion->DeleteSampleLoop(&dimregion->pSampleLoops[0]);  
1992          }              // copy sample information from Sample to DimensionRegion
1993          while (dimregion->SampleLoops < sample->Loops) {              if (copy_sample_unity)
1994              DLS::sample_loop_t loop;                  d[i]->UnityNote = sample->MIDIUnityNote;
1995              dimregion->AddSampleLoop(&loop);              if (copy_sample_tune)
1996          }                  d[i]->FineTune = sample->FineTune;
1997          if (loops) {              if (copy_sample_loop) {
1998              dimregion->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t);                  int loops = sample->Loops ? 1 : 0;
1999              dimregion->pSampleLoops[0].LoopType = sample->LoopType;                  while (d[i]->SampleLoops > loops) {
2000              dimregion->pSampleLoops[0].LoopStart = sample->LoopStart;                      d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]);
2001              dimregion->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1;                  }
2002                    while (d[i]->SampleLoops < sample->Loops) {
2003                        DLS::sample_loop_t loop;
2004                        d[i]->AddSampleLoop(&loop);
2005                    }
2006                    if (loops) {
2007                        d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t);
2008                        d[i]->pSampleLoops[0].LoopType = sample->LoopType;
2009                        d[i]->pSampleLoops[0].LoopStart = sample->LoopStart;
2010                        d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1;
2011                    }
2012                }
2013          }          }
2014    
2015          // update ui          // update ui
2016          update_model++;          update_model++;
2017          wSample->set_text(dimregion->pSample->pInfo->Name);          wSample->set_text(gig_to_utf8(dimreg->pSample->pInfo->Name));
2018          eUnityNote.set_value(dimregion->UnityNote);          eUnityNote.set_value(dimreg->UnityNote);
2019          eFineTune.set_value(dimregion->FineTune);          eFineTune.set_value(dimreg->FineTune);
2020          eSampleLoopEnabled.set_value(dimregion->SampleLoops);          eSampleLoopEnabled.set_value(dimreg->SampleLoops);
2021          update_loop_elements();          update_loop_elements();
2022          update_model--;          update_model--;
2023    
2024          sample_ref_changed_signal.emit(oldref, sample);          sample_ref_changed_signal.emit(oldref, sample);
         // currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received()  
         //dimreg_changed_signal.emit(dimregion);  
2025          return true;          return true;
2026      }      }
2027      return false;      return false;
# Line 1008  sigc::signal<void, gig::Sample*/*old*/, Line 2040  sigc::signal<void, gig::Sample*/*old*/,
2040  }  }
2041    
2042    
2043  void DimRegionEdit::set_UnityNote(gig::DimensionRegion* d, uint8_t value)  void DimRegionEdit::set_UnityNote(gig::DimensionRegion& d, uint8_t value)
2044  {  {
2045      d->UnityNote = value;      d.UnityNote = value;
2046  }  }
2047    
2048  void DimRegionEdit::set_FineTune(gig::DimensionRegion* d, int16_t value)  void DimRegionEdit::set_FineTune(gig::DimensionRegion& d, int16_t value)
2049  {  {
2050      d->FineTune = value;      d.FineTune = value;
2051  }  }
2052    
2053  void DimRegionEdit::set_Crossfade_in_start(gig::DimensionRegion* d,  void DimRegionEdit::set_Crossfade_in_start(gig::DimensionRegion& d,
2054                                             uint8_t value)                                             uint8_t value)
2055  {  {
2056      d->Crossfade.in_start = value;      d.Crossfade.in_start = value;
2057      if (d->Crossfade.in_end < value) set_Crossfade_in_end(d, value);      if (d.Crossfade.in_end < value) set_Crossfade_in_end(d, value);
2058  }  }
2059    
2060  void DimRegionEdit::set_Crossfade_in_end(gig::DimensionRegion* d,  void DimRegionEdit::set_Crossfade_in_end(gig::DimensionRegion& d,
2061                                           uint8_t value)                                           uint8_t value)
2062  {  {
2063      d->Crossfade.in_end = value;      d.Crossfade.in_end = value;
2064      if (value < d->Crossfade.in_start) set_Crossfade_in_start(d, value);      if (value < d.Crossfade.in_start) set_Crossfade_in_start(d, value);
2065      if (value > d->Crossfade.out_start) set_Crossfade_out_start(d, value);      if (value > d.Crossfade.out_start) set_Crossfade_out_start(d, value);
2066  }  }
2067    
2068  void DimRegionEdit::set_Crossfade_out_start(gig::DimensionRegion* d,  void DimRegionEdit::set_Crossfade_out_start(gig::DimensionRegion& d,
2069                                              uint8_t value)                                              uint8_t value)
2070  {  {
2071      d->Crossfade.out_start = value;      d.Crossfade.out_start = value;
2072      if (value < d->Crossfade.in_end) set_Crossfade_in_end(d, value);      if (value < d.Crossfade.in_end) set_Crossfade_in_end(d, value);
2073      if (value > d->Crossfade.out_end) set_Crossfade_out_end(d, value);      if (value > d.Crossfade.out_end) set_Crossfade_out_end(d, value);
2074  }  }
2075    
2076  void DimRegionEdit::set_Crossfade_out_end(gig::DimensionRegion* d,  void DimRegionEdit::set_Crossfade_out_end(gig::DimensionRegion& d,
2077                                            uint8_t value)                                            uint8_t value)
2078  {  {
2079      d->Crossfade.out_end = value;      d.Crossfade.out_end = value;
2080      if (value < d->Crossfade.out_start) set_Crossfade_out_start(d, value);      if (value < d.Crossfade.out_start) set_Crossfade_out_start(d, value);
2081  }  }
2082    
2083  void DimRegionEdit::set_Gain(gig::DimensionRegion* d, int32_t value)  void DimRegionEdit::set_Gain(gig::DimensionRegion& d, int32_t value)
2084  {  {
2085      d->SetGain(value);      d.SetGain(value);
2086  }  }
2087    
2088  void DimRegionEdit::set_LoopEnabled(gig::DimensionRegion* d, bool value)  void DimRegionEdit::set_LoopEnabled(gig::DimensionRegion& d, bool value)
2089  {  {
2090      if (value) {      if (value) {
2091          // create a new sample loop in case there is none yet          // create a new sample loop in case there is none yet
2092          if (!d->SampleLoops) {          if (!d.SampleLoops) {
2093                DimRegionChangeGuard(this, &d);
2094    
2095              DLS::sample_loop_t loop;              DLS::sample_loop_t loop;
2096              loop.LoopType = gig::loop_type_normal;              loop.LoopType = gig::loop_type_normal;
2097              // loop the whole sample by default              // loop the whole sample by default
2098              loop.LoopStart  = 0;              loop.LoopStart  = 0;
2099              loop.LoopLength =              loop.LoopLength =
2100                  (d->pSample) ? d->pSample->SamplesTotal : 0;                  (d.pSample) ? d.pSample->SamplesTotal : 0;
2101              dimreg_to_be_changed_signal.emit(d);              d.AddSampleLoop(&loop);
             d->AddSampleLoop(&loop);  
             dimreg_changed_signal.emit(d);  
2102          }          }
2103      } else {      } else {
2104          if (d->SampleLoops) {          if (d.SampleLoops) {
2105              dimreg_to_be_changed_signal.emit(d);              DimRegionChangeGuard(this, &d);
2106    
2107              // delete ALL existing sample loops              // delete ALL existing sample loops
2108              while (d->SampleLoops) {              while (d.SampleLoops) {
2109                  d->DeleteSampleLoop(&d->pSampleLoops[0]);                  d.DeleteSampleLoop(&d.pSampleLoops[0]);
2110              }              }
             dimreg_changed_signal.emit(d);  
2111          }          }
2112      }      }
2113  }  }
2114    
2115  void DimRegionEdit::set_LoopType(gig::DimensionRegion* d, uint32_t value)  void DimRegionEdit::set_LoopType(gig::DimensionRegion& d, uint32_t value)
2116  {  {
2117      if (d->SampleLoops) d->pSampleLoops[0].LoopType = value;      if (d.SampleLoops) d.pSampleLoops[0].LoopType = value;
2118  }  }
2119    
2120  void DimRegionEdit::set_LoopStart(gig::DimensionRegion* d, uint32_t value)  void DimRegionEdit::set_LoopStart(gig::DimensionRegion& d, uint32_t value)
2121  {  {
2122      if (d->SampleLoops) {      if (d.SampleLoops) {
2123          d->pSampleLoops[0].LoopStart =          d.pSampleLoops[0].LoopStart =
2124              d->pSample ?              d.pSample ?
2125              std::min(value, uint32_t(d->pSample->SamplesTotal -              std::min(value, uint32_t(d.pSample->SamplesTotal -
2126                                       d->pSampleLoops[0].LoopLength)) :                                       d.pSampleLoops[0].LoopLength)) :
2127              0;              0;
2128      }      }
2129  }  }
2130    
2131  void DimRegionEdit::set_LoopLength(gig::DimensionRegion* d, uint32_t value)  void DimRegionEdit::set_LoopLength(gig::DimensionRegion& d, uint32_t value)
2132  {  {
2133      if (d->SampleLoops) {      if (d.SampleLoops) {
2134          d->pSampleLoops[0].LoopLength =          d.pSampleLoops[0].LoopLength =
2135              d->pSample ?              d.pSample ?
2136              std::min(value, uint32_t(d->pSample->SamplesTotal -              std::min(value, uint32_t(d.pSample->SamplesTotal -
2137                                       d->pSampleLoops[0].LoopStart)) :                                       d.pSampleLoops[0].LoopStart)) :
2138              0;              0;
2139      }      }
2140  }  }
2141    
2142  void DimRegionEdit::set_LoopInfinite(gig::DimensionRegion* d, bool value)  void DimRegionEdit::set_LoopInfinite(gig::DimensionRegion& d, bool value)
2143  {  {
2144      if (d->pSample) {      if (d.pSample) {
2145          if (value) d->pSample->LoopPlayCount = 0;          if (value) d.pSample->LoopPlayCount = 0;
2146          else if (d->pSample->LoopPlayCount == 0) d->pSample->LoopPlayCount = 1;          else if (d.pSample->LoopPlayCount == 0) d.pSample->LoopPlayCount = 1;
2147      }      }
2148  }  }
2149    
2150  void DimRegionEdit::set_LoopPlayCount(gig::DimensionRegion* d, uint32_t value)  void DimRegionEdit::set_LoopPlayCount(gig::DimensionRegion& d, uint32_t value)
2151  {  {
2152      if (d->pSample) d->pSample->LoopPlayCount = value;      if (d.pSample) d.pSample->LoopPlayCount = value;
2153    }
2154    
2155    void DimRegionEdit::nullOutSampleReference() {
2156        if (!dimregion) return;
2157        gig::Sample* oldref = dimregion->pSample;
2158        if (!oldref) return;
2159    
2160        DimRegionChangeGuard(this, dimregion);
2161    
2162        // in case currently assigned sample is a stereo one, then remove both
2163        // references (expected to be due to a "stereo dimension")
2164        gig::DimensionRegion* d[2] = { dimregion, NULL };
2165        if (oldref->Channels == 2) {
2166            gig::Region* region = dimregion->GetParent();
2167            {
2168                int stereo_bit = 0;
2169                int bitcount = 0;
2170                for (int dim = 0 ; dim < region->Dimensions ; dim++) {
2171                    if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) {
2172                        stereo_bit = 1 << bitcount;
2173                        break;
2174                    }
2175                    bitcount += region->pDimensionDefinitions[dim].bits;
2176                }
2177    
2178                if (stereo_bit) {
2179                    int dimregno;
2180                    for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) {
2181                        if (region->pDimensionRegions[dimregno] == dimregion) {
2182                            break;
2183                        }
2184                    }
2185                    d[0] = region->pDimensionRegions[dimregno & ~stereo_bit];
2186                    d[1] = region->pDimensionRegions[dimregno | stereo_bit];
2187                }
2188            }
2189        }
2190    
2191        if (d[0]) d[0]->pSample = NULL;
2192        if (d[1]) d[1]->pSample = NULL;
2193    
2194        // update UI elements
2195        set_dim_region(dimregion);
2196    
2197        sample_ref_changed_signal.emit(oldref, NULL);
2198    }
2199    
2200    void DimRegionEdit::onButtonSelectSamplePressed() {
2201        if (!dimregion) return;
2202        if (!dimregion->pSample) return;
2203        select_sample_signal.emit(dimregion->pSample);
2204    }
2205    
2206    sigc::signal<void, gig::Sample*>& DimRegionEdit::signal_select_sample() {
2207        return select_sample_signal;
2208  }  }

Legend:
Removed from v.1533  
changed lines
  Added in v.3738

  ViewVC Help
Powered by ViewVC