/[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 2151 by persson, Sun Nov 21 12:38:41 2010 UTC revision 3643 by schoenebeck, Sat Dec 7 15:04:51 2019 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006-2010 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        eEG1Attack(_("Attack Time (seconds)"), 0, 60, 3),
343        eEG1Decay1(_("Decay 1 Time (seconds)"), 0.005, 60, 3),
344        eEG1Decay2(_("Decay 2 Time (seconds)"), 0, 60, 3),
345      eEG1InfiniteSustain(_("Infinite sustain")),      eEG1InfiniteSustain(_("Infinite sustain")),
346      eEG1Sustain(_("Sustain"), 0, 100, 2),      eEG1Sustain(_("Sustain Level (%)"), 0, 100, 2),
347      eEG1Release(_("Release"), 0, 60, 3),      eEG1Release(_("Release Time (seconds)"), 0, 60, 3),
348      eEG1Hold(_("Hold")),      eEG1Hold(_("Hold Attack Stage until Loop End")),
349      eEG1Controller(_("Controller")),      eEG1Controller(_("Controller")),
350      eEG1ControllerInvert(_("Controller invert")),      eEG1ControllerInvert(_("Controller invert")),
351      eEG1ControllerAttackInfluence(_("Controller attack influence"), 0, 3),      eEG1ControllerAttackInfluence(_("Controller attack influence"), 0, 3),
352      eEG1ControllerDecayInfluence(_("Controller decay influence"), 0, 3),      eEG1ControllerDecayInfluence(_("Controller decay influence"), 0, 3),
353      eEG1ControllerReleaseInfluence(_("Controller release influence"), 0, 3),      eEG1ControllerReleaseInfluence(_("Controller release influence"), 0, 3),
354        eLFO1Wave(_("Wave Form")),
355      eLFO1Frequency(_("Frequency"), 0.1, 10, 2),      eLFO1Frequency(_("Frequency"), 0.1, 10, 2),
356        eLFO1Phase(_("Phase"), 0.0, 360.0, 2),
357      eLFO1InternalDepth(_("Internal depth"), 0, 1200),      eLFO1InternalDepth(_("Internal depth"), 0, 1200),
358      eLFO1ControlDepth(_("Control depth"), 0, 1200),      eLFO1ControlDepth(_("Control depth"), 0, 1200),
359      eLFO1Controller(_("Controller")),      eLFO1Controller(_("Controller")),
360      eLFO1FlipPhase(_("Flip phase")),      eLFO1FlipPhase(_("Flip phase")),
361      eLFO1Sync(_("Sync")),      eLFO1Sync(_("Sync")),
362      eEG2PreAttack(_("Pre-attack"), 0, 100, 2),      eEG2PreAttack(_("Pre-attack Level (%)"), 0, 100, 2),
363      eEG2Attack(_("Attack"), 0, 60, 3),      eEG2Attack(_("Attack Time (seconds)"), 0, 60, 3),
364      eEG2Decay1(_("Decay 1"), 0.005, 60, 3),      eEG2Decay1(_("Decay 1 Time (seconds)"), 0.005, 60, 3),
365      eEG2Decay2(_("Decay 2"), 0, 60, 3),      eEG2Decay2(_("Decay 2 Time (seconds)"), 0, 60, 3),
366      eEG2InfiniteSustain(_("Infinite sustain")),      eEG2InfiniteSustain(_("Infinite sustain")),
367      eEG2Sustain(_("Sustain"), 0, 100, 2),      eEG2Sustain(_("Sustain Level (%)"), 0, 100, 2),
368      eEG2Release(_("Release"), 0, 60, 3),      eEG2Release(_("Release Time (seconds)"), 0, 60, 3),
369      eEG2Controller(_("Controller")),      eEG2Controller(_("Controller")),
370      eEG2ControllerInvert(_("Controller invert")),      eEG2ControllerInvert(_("Controller invert")),
371      eEG2ControllerAttackInfluence(_("Controller attack influence"), 0, 3),      eEG2ControllerAttackInfluence(_("Controller attack influence"), 0, 3),
372      eEG2ControllerDecayInfluence(_("Controller decay influence"), 0, 3),      eEG2ControllerDecayInfluence(_("Controller decay influence"), 0, 3),
373      eEG2ControllerReleaseInfluence(_("Controller release influence"), 0, 3),      eEG2ControllerReleaseInfluence(_("Controller release influence"), 0, 3),
374        eLFO2Wave(_("Wave Form")),
375      eLFO2Frequency(_("Frequency"), 0.1, 10, 2),      eLFO2Frequency(_("Frequency"), 0.1, 10, 2),
376        eLFO2Phase(_("Phase"), 0.0, 360.0, 2),
377      eLFO2InternalDepth(_("Internal depth"), 0, 1200),      eLFO2InternalDepth(_("Internal depth"), 0, 1200),
378      eLFO2ControlDepth(_("Control depth"), 0, 1200),      eLFO2ControlDepth(_("Control depth"), 0, 1200),
379      eLFO2Controller(_("Controller")),      eLFO2Controller(_("Controller")),
# Line 61  DimRegionEdit::DimRegionEdit() : Line 381  DimRegionEdit::DimRegionEdit() :
381      eLFO2Sync(_("Sync")),      eLFO2Sync(_("Sync")),
382      eEG3Attack(_("Attack"), 0, 10, 3),      eEG3Attack(_("Attack"), 0, 10, 3),
383      eEG3Depth(_("Depth"), -1200, 1200),      eEG3Depth(_("Depth"), -1200, 1200),
384        eLFO3Wave(_("Wave Form")),
385      eLFO3Frequency(_("Frequency"), 0.1, 10, 2),      eLFO3Frequency(_("Frequency"), 0.1, 10, 2),
386        eLFO3Phase(_("Phase"), 0.0, 360.0, 2),
387      eLFO3InternalDepth(_("Internal depth"), 0, 1200),      eLFO3InternalDepth(_("Internal depth"), 0, 1200),
388      eLFO3ControlDepth(_("Control depth"), 0, 1200),      eLFO3ControlDepth(_("Control depth"), 0, 1200),
389      eLFO3Controller(_("Controller")),      eLFO3Controller(_("Controller")),
390        eLFO3FlipPhase(_("Flip phase")),
391      eLFO3Sync(_("Sync")),      eLFO3Sync(_("Sync")),
392      eVCFEnabled(_("Enabled")),      eVCFEnabled(_("Enabled")),
393      eVCFType(_("Type")),      eVCFType(_("Type")),
# Line 90  DimRegionEdit::DimRegionEdit() : Line 413  DimRegionEdit::DimRegionEdit() :
413      eCrossfade_out_start(_("Crossfade-out start")),      eCrossfade_out_start(_("Crossfade-out start")),
414      eCrossfade_out_end(_("Crossfade-out end")),      eCrossfade_out_end(_("Crossfade-out end")),
415      ePitchTrack(_("Pitch track")),      ePitchTrack(_("Pitch track")),
416        eSustainReleaseTrigger(_("Sustain Release Trigger")),
417        eNoNoteOffReleaseTrigger(_("No note-off release trigger")),
418      eDimensionBypass(_("Dimension bypass")),      eDimensionBypass(_("Dimension bypass")),
419      ePan(_("Pan"), -64, 63),      ePan(_("Pan"), -64, 63),
420      eSelfMask(_("Self mask")),      eSelfMask(_("Kill lower velocity voices (a.k.a \"Self mask\")")),
421      eAttenuationController(_("Attenuation controller")),      eAttenuationController(_("Attenuation controller")),
422      eInvertAttenuationController(_("Invert attenuation controller")),      eInvertAttenuationController(_("Invert attenuation controller")),
423      eAttenuationControllerThreshold(_("Attenuation controller threshold")),      eAttenuationControllerThreshold(_("Attenuation controller threshold")),
424      eChannelOffset(_("Channel offset"), 0, 9),      eChannelOffset(_("Channel offset"), 0, 9),
425      eSustainDefeat(_("Sustain defeat")),      eSustainDefeat(_("Ignore Hold Pedal (a.k.a. \"Sustain defeat\")")),
426      eMSDecode(_("MS decode")),      eMSDecode(_("Decode Mid/Side Recordings")),
427      eSampleStartOffset(_("Sample start offset"), 0, 2000),      eSampleStartOffset(_("Sample start offset"), 0, 2000),
428      eUnityNote(_("Unity note")),      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),      eFineTune(_("Fine tune"), -49, 50),
434      eGain(_("Gain"), -96, 0, 2, -655360),      eGain(_("Gain (dB)"), -96, +96, 2, -655360),
     eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360),  
435      eSampleLoopEnabled(_("Enabled")),      eSampleLoopEnabled(_("Enabled")),
436      eSampleLoopStart(_("Loop start positon")),      eSampleLoopStart(_("Loop start position")),
437      eSampleLoopLength(_("Loop size")),      eSampleLoopLength(_("Loop size")),
438      eSampleLoopType(_("Loop type")),      eSampleLoopType(_("Loop type")),
439      eSampleLoopInfinite(_("Infinite loop")),      eSampleLoopInfinite(_("Infinite loop")),
440      eSampleLoopPlayCount(_("Playback count"), 1),      eSampleLoopPlayCount(_("Playback count"), 1),
441        buttonSelectSample(UNICODE_LEFT_ARROW + "  " + _("Select Sample")),
442      update_model(0)      update_model(0)
443  {  {
444        // make synthesis parameter page tabs scrollable
445        // (workaround for GTK3: default theme uses huge tabs which breaks layout)
446        set_scrollable();
447    
448      connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack);      connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack);
449      connect(eEG1Attack, &gig::DimensionRegion::EG1Attack);      connect(eEG1Attack, &gig::DimensionRegion::EG1Attack);
450      connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1);      connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1);
# Line 128  DimRegionEdit::DimRegionEdit() : Line 461  DimRegionEdit::DimRegionEdit() :
461              &gig::DimensionRegion::EG1ControllerDecayInfluence);              &gig::DimensionRegion::EG1ControllerDecayInfluence);
462      connect(eEG1ControllerReleaseInfluence,      connect(eEG1ControllerReleaseInfluence,
463              &gig::DimensionRegion::EG1ControllerReleaseInfluence);              &gig::DimensionRegion::EG1ControllerReleaseInfluence);
464        connect(eEG1StateOptions.checkBoxAttack, &gig::DimensionRegion::EG1Options,
465                &gig::eg_opt_t::AttackCancel);
466        connect(eEG1StateOptions.checkBoxAttackHold, &gig::DimensionRegion::EG1Options,
467                &gig::eg_opt_t::AttackHoldCancel);
468        connect(eEG1StateOptions.checkBoxDecay1, &gig::DimensionRegion::EG1Options,
469                &gig::eg_opt_t::Decay1Cancel);
470        connect(eEG1StateOptions.checkBoxDecay2, &gig::DimensionRegion::EG1Options,
471                &gig::eg_opt_t::Decay2Cancel);
472        connect(eEG1StateOptions.checkBoxRelease, &gig::DimensionRegion::EG1Options,
473                &gig::eg_opt_t::ReleaseCancel);
474        connect(eLFO1Wave, &gig::DimensionRegion::LFO1WaveForm);
475      connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency);      connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency);
476        connect(eLFO1Phase, &gig::DimensionRegion::LFO1Phase);
477      connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth);      connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth);
478      connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth);      connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth);
479      connect(eLFO1Controller, &gig::DimensionRegion::LFO1Controller);      connect(eLFO1Controller, &gig::DimensionRegion::LFO1Controller);
# Line 149  DimRegionEdit::DimRegionEdit() : Line 494  DimRegionEdit::DimRegionEdit() :
494              &gig::DimensionRegion::EG2ControllerDecayInfluence);              &gig::DimensionRegion::EG2ControllerDecayInfluence);
495      connect(eEG2ControllerReleaseInfluence,      connect(eEG2ControllerReleaseInfluence,
496              &gig::DimensionRegion::EG2ControllerReleaseInfluence);              &gig::DimensionRegion::EG2ControllerReleaseInfluence);
497        connect(eEG2StateOptions.checkBoxAttack, &gig::DimensionRegion::EG2Options,
498                &gig::eg_opt_t::AttackCancel);
499        connect(eEG2StateOptions.checkBoxAttackHold, &gig::DimensionRegion::EG2Options,
500                &gig::eg_opt_t::AttackHoldCancel);
501        connect(eEG2StateOptions.checkBoxDecay1, &gig::DimensionRegion::EG2Options,
502                &gig::eg_opt_t::Decay1Cancel);
503        connect(eEG2StateOptions.checkBoxDecay2, &gig::DimensionRegion::EG2Options,
504                &gig::eg_opt_t::Decay2Cancel);
505        connect(eEG2StateOptions.checkBoxRelease, &gig::DimensionRegion::EG2Options,
506                &gig::eg_opt_t::ReleaseCancel);
507        connect(eLFO2Wave, &gig::DimensionRegion::LFO2WaveForm);
508      connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency);      connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency);
509        connect(eLFO2Phase, &gig::DimensionRegion::LFO2Phase);
510      connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth);      connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth);
511      connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth);      connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth);
512      connect(eLFO2Controller, &gig::DimensionRegion::LFO2Controller);      connect(eLFO2Controller, &gig::DimensionRegion::LFO2Controller);
# Line 157  DimRegionEdit::DimRegionEdit() : Line 514  DimRegionEdit::DimRegionEdit() :
514      connect(eLFO2Sync, &gig::DimensionRegion::LFO2Sync);      connect(eLFO2Sync, &gig::DimensionRegion::LFO2Sync);
515      connect(eEG3Attack, &gig::DimensionRegion::EG3Attack);      connect(eEG3Attack, &gig::DimensionRegion::EG3Attack);
516      connect(eEG3Depth, &gig::DimensionRegion::EG3Depth);      connect(eEG3Depth, &gig::DimensionRegion::EG3Depth);
517        connect(eLFO3Wave, &gig::DimensionRegion::LFO3WaveForm);
518      connect(eLFO3Frequency, &gig::DimensionRegion::LFO3Frequency);      connect(eLFO3Frequency, &gig::DimensionRegion::LFO3Frequency);
519        connect(eLFO3Phase, &gig::DimensionRegion::LFO3Phase);
520      connect(eLFO3InternalDepth, &gig::DimensionRegion::LFO3InternalDepth);      connect(eLFO3InternalDepth, &gig::DimensionRegion::LFO3InternalDepth);
521      connect(eLFO3ControlDepth, &gig::DimensionRegion::LFO3ControlDepth);      connect(eLFO3ControlDepth, &gig::DimensionRegion::LFO3ControlDepth);
522      connect(eLFO3Controller, &gig::DimensionRegion::LFO3Controller);      connect(eLFO3Controller, &gig::DimensionRegion::LFO3Controller);
523        connect(eLFO3FlipPhase, &gig::DimensionRegion::LFO3FlipPhase);
524      connect(eLFO3Sync, &gig::DimensionRegion::LFO3Sync);      connect(eLFO3Sync, &gig::DimensionRegion::LFO3Sync);
525      connect(eVCFEnabled, &gig::DimensionRegion::VCFEnabled);      connect(eVCFEnabled, &gig::DimensionRegion::VCFEnabled);
526      connect(eVCFType, &gig::DimensionRegion::VCFType);      connect(eVCFType, &gig::DimensionRegion::VCFType);
# Line 196  DimRegionEdit::DimRegionEdit() : Line 556  DimRegionEdit::DimRegionEdit() :
556      connect(eCrossfade_out_start, &DimRegionEdit::set_Crossfade_out_start);      connect(eCrossfade_out_start, &DimRegionEdit::set_Crossfade_out_start);
557      connect(eCrossfade_out_end, &DimRegionEdit::set_Crossfade_out_end);      connect(eCrossfade_out_end, &DimRegionEdit::set_Crossfade_out_end);
558      connect(ePitchTrack, &gig::DimensionRegion::PitchTrack);      connect(ePitchTrack, &gig::DimensionRegion::PitchTrack);
559        connect(eSustainReleaseTrigger, &gig::DimensionRegion::SustainReleaseTrigger);
560        connect(eNoNoteOffReleaseTrigger, &gig::DimensionRegion::NoNoteOffReleaseTrigger);
561      connect(eDimensionBypass, &gig::DimensionRegion::DimensionBypass);      connect(eDimensionBypass, &gig::DimensionRegion::DimensionBypass);
562      connect(ePan, &gig::DimensionRegion::Pan);      connect(ePan, &gig::DimensionRegion::Pan);
563      connect(eSelfMask, &gig::DimensionRegion::SelfMask);      connect(eSelfMask, &gig::DimensionRegion::SelfMask);
# Line 212  DimRegionEdit::DimRegionEdit() : Line 574  DimRegionEdit::DimRegionEdit() :
574      connect(eUnityNote, &DimRegionEdit::set_UnityNote);      connect(eUnityNote, &DimRegionEdit::set_UnityNote);
575      connect(eFineTune, &DimRegionEdit::set_FineTune);      connect(eFineTune, &DimRegionEdit::set_FineTune);
576      connect(eGain, &DimRegionEdit::set_Gain);      connect(eGain, &DimRegionEdit::set_Gain);
     connect(eGainPlus6, &DimRegionEdit::set_Gain);  
577      connect(eSampleLoopEnabled, &DimRegionEdit::set_LoopEnabled);      connect(eSampleLoopEnabled, &DimRegionEdit::set_LoopEnabled);
578      connect(eSampleLoopType, &DimRegionEdit::set_LoopType);      connect(eSampleLoopType, &DimRegionEdit::set_LoopType);
579      connect(eSampleLoopStart, &DimRegionEdit::set_LoopStart);      connect(eSampleLoopStart, &DimRegionEdit::set_LoopStart);
580      connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength);      connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength);
581      connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite);      connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite);
582      connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount);      connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount);
583        buttonSelectSample.signal_clicked().connect(
584            sigc::mem_fun(*this, &DimRegionEdit::onButtonSelectSamplePressed)
585        );
586    
587      for (int i = 0 ; i < 7 ; i++) {      for (int i = 0 ; i < 9 ; i++) {
588    #if USE_GTKMM_GRID
589            table[i] = new Gtk::Grid;
590            table[i]->set_column_spacing(7);
591    #else
592          table[i] = new Gtk::Table(3, 1);          table[i] = new Gtk::Table(3, 1);
593          table[i]->set_col_spacings(7);          table[i]->set_col_spacings(7);
594    #endif
595    
596    // on Gtk 3 there is absolutely no margin by default
597    #if GTKMM_MAJOR_VERSION >= 3
598    # if GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION < 12
599            table[i]->set_margin_left(12);
600            table[i]->set_margin_right(12);
601    # else
602            table[i]->set_margin_start(12);
603            table[i]->set_margin_end(12);
604    # endif
605    #endif
606      }      }
607    
608      // set tooltips      // set tooltips
609      eUnityNote.set_tip(      eUnityNote.set_tip(
610          _("Note this sample is associated with (a.k.a. 'root note')")          _("Note this sample is associated with (a.k.a. 'root note')")
611      );      );
612        buttonSelectSample.set_tooltip_text(
613            _("Selects the sample of this dimension region on the left hand side's sample tree view.")
614        );
615      eSampleStartOffset.set_tip(_("Sample position at which playback should be started"));      eSampleStartOffset.set_tip(_("Sample position at which playback should be started"));
616      ePan.set_tip(_("Stereo balance (left/right)"));      ePan.set_tip(_("Stereo balance (left/right)"));
617      eChannelOffset.set_tip(      eChannelOffset.set_tip(
# Line 259  DimRegionEdit::DimRegionEdit() : Line 642  DimRegionEdit::DimRegionEdit() :
642            "Caution: this setting is stored on Sample side, thus is shared "            "Caution: this setting is stored on Sample side, thus is shared "
643            "among all dimension regions that use this sample!")            "among all dimension regions that use this sample!")
644      );      );
645        
646        eEG1PreAttack.set_tip(
647            "Very first level this EG starts with. It rises then in Attack Time "
648            "seconds from this initial level to 100%."
649        );
650        eEG1Attack.set_tip(
651            "Duration of the EG's Attack stage, which raises its level from "
652            "Pre-Attack Level to 100%."
653        );
654        eEG1Hold.set_tip(
655           "On looped sounds, enabling this will cause the Decay 1 stage not to "
656           "enter before the loop has been passed one time."
657        );
658        eAttenuationController.set_tip(_(
659            "If you are not using the 'Layer' dimension, then this controller "
660            "simply alters the volume. If you are using the 'Layer' dimension, "
661            "then this controller is controlling the crossfade between Layers in "
662            "real-time."
663        ));
664    
665        eLFO1Sync.set_tip(
666            "If not checked, every voice will use its own LFO instance, which "
667            "causes voices triggered at different points in time to have different "
668            "LFO levels. By enabling 'Sync' here the voices will instead use and "
669            "share one single LFO, causing all voices to have the same LFO level, "
670            "no matter when the individual notes have been triggered."
671        );
672        eLFO2Sync.set_tip(
673            "If not checked, every voice will use its own LFO instance, which "
674            "causes voices triggered at different points in time to have different "
675            "LFO levels. By enabling 'Sync' here the voices will instead use and "
676            "share one single LFO, causing all voices to have the same LFO level, "
677            "no matter when the individual notes have been triggered."
678        );
679        eLFO3Sync.set_tip(
680            "If not checked, every voice will use its own LFO instance, which "
681            "causes voices triggered at different points in time to have different "
682            "LFO levels. By enabling 'Sync' here the voices will instead use and "
683            "share one single LFO, causing all voices to have the same LFO level, "
684            "no matter when the individual notes have been triggered."
685        );
686        eLFO1FlipPhase.set_tip(
687           "Inverts the LFO's generated wave vertically."
688        );
689        eLFO2FlipPhase.set_tip(
690           "Inverts the LFO's generated wave vertically."
691        );
692        eLFO3FlipPhase.set_tip(
693           "Inverts the LFO's generated wave vertically."
694        );
695    
696      pageno = 0;      pageno = 0;
697      rowno = 0;      rowno = 0;
698      firstRowInBlock = 0;      firstRowInBlock = 0;
699    
700      addHeader(_("Mandatory Settings"));      addHeader(_("Mandatory Settings"));
701      addString(_("Sample"), lSample, wSample);      addString(_("Sample"), lSample, wSample, buttonNullSampleReference);
702        buttonNullSampleReference->set_label("X");
703        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."));
704        buttonNullSampleReference->signal_clicked().connect(
705            sigc::mem_fun(*this, &DimRegionEdit::nullOutSampleReference)
706        );
707      //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);
708  #ifdef OLD_TOOLTIPS  #ifdef OLD_TOOLTIPS
709      tooltips.set_tip(*wSample, _("Drop a sample here"));      tooltips.set_tip(*wSample, _("Drag & drop a sample here"));
710  #else  #else
711      wSample->set_tooltip_text(_("Drop a sample here"));      wSample->set_tooltip_text(_("Drag & drop a sample here"));
712  #endif  #endif
713      addProp(eUnityNote);      addProp(eUnityNote);
714        addProp(eSampleGroup);
715        addProp(eSampleFormatInfo);
716        addProp(eSampleID);
717        addProp(eChecksum);
718        addRightHandSide(buttonSelectSample);
719      addHeader(_("Optional Settings"));      addHeader(_("Optional Settings"));
720      addProp(eSampleStartOffset);      addProp(eSampleStartOffset);
721      addProp(eChannelOffset);      addProp(eChannelOffset);
# Line 297  DimRegionEdit::DimRegionEdit() : Line 740  DimRegionEdit::DimRegionEdit() :
740    
741      addHeader(_("General Amplitude Settings"));      addHeader(_("General Amplitude Settings"));
742      addProp(eGain);      addProp(eGain);
     addProp(eGainPlus6);  
743      addProp(ePan);      addProp(ePan);
744      addHeader(_("Amplitude Envelope (EG1)"));      addHeader(_("Amplitude Envelope (EG1)"));
745      addProp(eEG1PreAttack);      addProp(eEG1PreAttack);
746      addProp(eEG1Attack);      addProp(eEG1Attack);
747        addProp(eEG1Hold);
748      addProp(eEG1Decay1);      addProp(eEG1Decay1);
749      addProp(eEG1Decay2);      addProp(eEG1Decay2);
750      addProp(eEG1InfiniteSustain);      addProp(eEG1InfiniteSustain);
751      addProp(eEG1Sustain);      addProp(eEG1Sustain);
752      addProp(eEG1Release);      addProp(eEG1Release);
     addProp(eEG1Hold);  
753      addProp(eEG1Controller);      addProp(eEG1Controller);
754      addProp(eEG1ControllerInvert);      addProp(eEG1ControllerInvert);
755      addProp(eEG1ControllerAttackInfluence);      addProp(eEG1ControllerAttackInfluence);
756      addProp(eEG1ControllerDecayInfluence);      addProp(eEG1ControllerDecayInfluence);
757      addProp(eEG1ControllerReleaseInfluence);      addProp(eEG1ControllerReleaseInfluence);
758        addLine(eEG1StateOptions);
759    
760      nextPage();      nextPage();
761    
762      addHeader(_("Amplitude Oscillator (LFO1)"));      addHeader(_("Amplitude Oscillator (LFO1)"));
763        addProp(eLFO1Wave);
764      addProp(eLFO1Frequency);      addProp(eLFO1Frequency);
765        addProp(eLFO1Phase);
766      addProp(eLFO1InternalDepth);      addProp(eLFO1InternalDepth);
767      addProp(eLFO1ControlDepth);      addProp(eLFO1ControlDepth);
768      {      {
# Line 335  DimRegionEdit::DimRegionEdit() : Line 780  DimRegionEdit::DimRegionEdit() :
780      addProp(eLFO1Controller);      addProp(eLFO1Controller);
781      addProp(eLFO1FlipPhase);      addProp(eLFO1FlipPhase);
782      addProp(eLFO1Sync);      addProp(eLFO1Sync);
783        {
784            Gtk::Frame* frame = new Gtk::Frame;
785            frame->add(lfo1Graph);
786            // on Gtk 3 there is no margin at all by default
787    #if GTKMM_MAJOR_VERSION >= 3
788            frame->set_margin_top(12);
789            frame->set_margin_bottom(12);
790    #endif
791    #if USE_GTKMM_GRID
792            table[pageno]->attach(*frame, 1, rowno, 2);
793    #else
794            table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
795                                  Gtk::SHRINK, Gtk::SHRINK);
796    #endif
797            rowno++;
798        }
799        eLFO1Wave.signal_value_changed().connect(
800            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
801        );
802        eLFO1Frequency.signal_value_changed().connect(
803            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
804        );
805        eLFO1Phase.signal_value_changed().connect(
806            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
807        );
808        eLFO1InternalDepth.signal_value_changed().connect(
809            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
810        );
811        eLFO1ControlDepth.signal_value_changed().connect(
812            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
813        );
814        eLFO1Controller.signal_value_changed().connect(
815            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
816        );
817        eLFO1FlipPhase.signal_value_changed().connect(
818            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
819        );
820        eLFO1Sync.signal_value_changed().connect(
821            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
822        );
823    
824        nextPage();
825    
826      addHeader(_("Crossfade"));      addHeader(_("Crossfade"));
827      addProp(eAttenuationController);      addProp(eAttenuationController);
828      addProp(eInvertAttenuationController);      addProp(eInvertAttenuationController);
# Line 344  DimRegionEdit::DimRegionEdit() : Line 832  DimRegionEdit::DimRegionEdit() :
832      addProp(eCrossfade_out_start);      addProp(eCrossfade_out_start);
833      addProp(eCrossfade_out_end);      addProp(eCrossfade_out_end);
834    
835        Gtk::Frame* frame = new Gtk::Frame;
836        frame->add(crossfade_curve);
837        // on Gtk 3 there is no margin at all by default
838    #if GTKMM_MAJOR_VERSION >= 3
839        frame->set_margin_top(12);
840        frame->set_margin_bottom(12);
841    #endif
842    #if USE_GTKMM_GRID
843        table[pageno]->attach(*frame, 1, rowno, 2);
844    #else
845        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
846                              Gtk::SHRINK, Gtk::SHRINK);
847    #endif
848        rowno++;
849    
850        eCrossfade_in_start.signal_value_changed().connect(
851            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
852        eCrossfade_in_end.signal_value_changed().connect(
853            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
854        eCrossfade_out_start.signal_value_changed().connect(
855            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
856        eCrossfade_out_end.signal_value_changed().connect(
857            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
858    
859      nextPage();      nextPage();
860    
861      addHeader(_("General Filter Settings"));      addHeader(_("General Filter Settings"));
# Line 394  DimRegionEdit::DimRegionEdit() : Line 906  DimRegionEdit::DimRegionEdit() :
906      addProp(eVCFVelocityCurve);      addProp(eVCFVelocityCurve);
907      addProp(eVCFVelocityScale);      addProp(eVCFVelocityScale);
908      addProp(eVCFVelocityDynamicRange);      addProp(eVCFVelocityDynamicRange);
909    
910        eVCFCutoffController.signal_value_changed().connect(
911            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
912        eVCFVelocityCurve.signal_value_changed().connect(
913            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
914        eVCFVelocityScale.signal_value_changed().connect(
915            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
916        eVCFVelocityDynamicRange.signal_value_changed().connect(
917            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
918    
919        frame = new Gtk::Frame;
920        frame->add(cutoff_curve);
921        // on Gtk 3 there is no margin at all by default
922    #if GTKMM_MAJOR_VERSION >= 3
923        frame->set_margin_top(12);
924        frame->set_margin_bottom(12);
925    #endif
926    #if USE_GTKMM_GRID
927        table[pageno]->attach(*frame, 1, rowno, 2);
928    #else
929        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
930                              Gtk::SHRINK, Gtk::SHRINK);
931    #endif
932        rowno++;
933    
934      addProp(eVCFResonance);      addProp(eVCFResonance);
935      addProp(eVCFResonanceDynamic);      addProp(eVCFResonanceDynamic);
936      {      {
# Line 427  DimRegionEdit::DimRegionEdit() : Line 964  DimRegionEdit::DimRegionEdit() :
964      addProp(eEG2ControllerAttackInfluence);      addProp(eEG2ControllerAttackInfluence);
965      addProp(eEG2ControllerDecayInfluence);      addProp(eEG2ControllerDecayInfluence);
966      addProp(eEG2ControllerReleaseInfluence);      addProp(eEG2ControllerReleaseInfluence);
967        addLine(eEG2StateOptions);
968    
969        nextPage();
970    
971      lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)"));      lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)"));
972        addProp(eLFO2Wave);
973      addProp(eLFO2Frequency);      addProp(eLFO2Frequency);
974        addProp(eLFO2Phase);
975      addProp(eLFO2InternalDepth);      addProp(eLFO2InternalDepth);
976      addProp(eLFO2ControlDepth);      addProp(eLFO2ControlDepth);
977      {      {
# Line 446  DimRegionEdit::DimRegionEdit() : Line 989  DimRegionEdit::DimRegionEdit() :
989      addProp(eLFO2Controller);      addProp(eLFO2Controller);
990      addProp(eLFO2FlipPhase);      addProp(eLFO2FlipPhase);
991      addProp(eLFO2Sync);      addProp(eLFO2Sync);
992        {
993            Gtk::Frame* frame = new Gtk::Frame;
994            frame->add(lfo2Graph);
995            // on Gtk 3 there is no margin at all by default
996    #if GTKMM_MAJOR_VERSION >= 3
997            frame->set_margin_top(12);
998            frame->set_margin_bottom(12);
999    #endif
1000    #if USE_GTKMM_GRID
1001            table[pageno]->attach(*frame, 1, rowno, 2);
1002    #else
1003            table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
1004                                  Gtk::SHRINK, Gtk::SHRINK);
1005    #endif
1006            rowno++;
1007        }
1008        eLFO2Wave.signal_value_changed().connect(
1009            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1010        );
1011        eLFO2Frequency.signal_value_changed().connect(
1012            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1013        );
1014        eLFO2Phase.signal_value_changed().connect(
1015            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1016        );
1017        eLFO2InternalDepth.signal_value_changed().connect(
1018            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1019        );
1020        eLFO2ControlDepth.signal_value_changed().connect(
1021            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1022        );
1023        eLFO2Controller.signal_value_changed().connect(
1024            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1025        );
1026        eLFO2FlipPhase.signal_value_changed().connect(
1027            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1028        );
1029        eLFO2Sync.signal_value_changed().connect(
1030            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1031        );
1032    
1033      nextPage();      nextPage();
1034    
# Line 456  DimRegionEdit::DimRegionEdit() : Line 1039  DimRegionEdit::DimRegionEdit() :
1039      addProp(eEG3Attack);      addProp(eEG3Attack);
1040      addProp(eEG3Depth);      addProp(eEG3Depth);
1041      addHeader(_("Pitch Oscillator (LFO3)"));      addHeader(_("Pitch Oscillator (LFO3)"));
1042        addProp(eLFO3Wave);
1043      addProp(eLFO3Frequency);      addProp(eLFO3Frequency);
1044        addProp(eLFO3Phase);
1045      addProp(eLFO3InternalDepth);      addProp(eLFO3InternalDepth);
1046      addProp(eLFO3ControlDepth);      addProp(eLFO3ControlDepth);
1047      {      {
# Line 472  DimRegionEdit::DimRegionEdit() : Line 1057  DimRegionEdit::DimRegionEdit() :
1057          eLFO3Controller.set_choices(choices, values);          eLFO3Controller.set_choices(choices, values);
1058      }      }
1059      addProp(eLFO3Controller);      addProp(eLFO3Controller);
1060        addProp(eLFO3FlipPhase);
1061      addProp(eLFO3Sync);      addProp(eLFO3Sync);
1062        {
1063            Gtk::Frame* frame = new Gtk::Frame;
1064            frame->add(lfo3Graph);
1065            // on Gtk 3 there is no margin at all by default
1066    #if GTKMM_MAJOR_VERSION >= 3
1067            frame->set_margin_top(12);
1068            frame->set_margin_bottom(12);
1069    #endif
1070    #if USE_GTKMM_GRID
1071            table[pageno]->attach(*frame, 1, rowno, 2);
1072    #else
1073            table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
1074                                  Gtk::SHRINK, Gtk::SHRINK);
1075    #endif
1076            rowno++;
1077        }
1078        eLFO3Wave.signal_value_changed().connect(
1079            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1080        );
1081        eLFO3Frequency.signal_value_changed().connect(
1082            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1083        );
1084        eLFO3Phase.signal_value_changed().connect(
1085            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1086        );
1087        eLFO3InternalDepth.signal_value_changed().connect(
1088            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1089        );
1090        eLFO3ControlDepth.signal_value_changed().connect(
1091            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1092        );
1093        eLFO3Controller.signal_value_changed().connect(
1094            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1095        );
1096        eLFO3FlipPhase.signal_value_changed().connect(
1097            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1098        );
1099        eLFO3Sync.signal_value_changed().connect(
1100            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1101        );
1102    
1103      nextPage();      nextPage();
1104    
1105        addHeader(_("Velocity Response"));
1106      eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values);      eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values);
1107      addProp(eVelocityResponseCurve);      addProp(eVelocityResponseCurve);
1108      addProp(eVelocityResponseDepth);      addProp(eVelocityResponseDepth);
1109      addProp(eVelocityResponseCurveScaling);      addProp(eVelocityResponseCurveScaling);
1110    
1111        eVelocityResponseCurve.signal_value_changed().connect(
1112            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
1113        eVelocityResponseDepth.signal_value_changed().connect(
1114            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
1115        eVelocityResponseCurveScaling.signal_value_changed().connect(
1116            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
1117    
1118        frame = new Gtk::Frame;
1119        frame->add(velocity_curve);
1120        // on Gtk 3 there is no margin at all by default
1121    #if GTKMM_MAJOR_VERSION >= 3
1122        frame->set_margin_top(12);
1123        frame->set_margin_bottom(12);
1124    #endif
1125    #if USE_GTKMM_GRID
1126        table[pageno]->attach(*frame, 1, rowno, 2);
1127    #else
1128        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
1129                              Gtk::SHRINK, Gtk::SHRINK);
1130    #endif
1131        rowno++;
1132    
1133        addHeader(_("Release Velocity Response"));
1134      eReleaseVelocityResponseCurve.set_choices(curve_type_texts,      eReleaseVelocityResponseCurve.set_choices(curve_type_texts,
1135                                                curve_type_values);                                                curve_type_values);
1136      addProp(eReleaseVelocityResponseCurve);      addProp(eReleaseVelocityResponseCurve);
1137      addProp(eReleaseVelocityResponseDepth);      addProp(eReleaseVelocityResponseDepth);
1138    
1139        eReleaseVelocityResponseCurve.signal_value_changed().connect(
1140            sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));
1141        eReleaseVelocityResponseDepth.signal_value_changed().connect(
1142            sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));
1143        frame = new Gtk::Frame;
1144        frame->add(release_curve);
1145        // on Gtk 3 there is no margin at all by default
1146    #if GTKMM_MAJOR_VERSION >= 3
1147        frame->set_margin_top(12);
1148        frame->set_margin_bottom(12);
1149    #endif
1150    #if USE_GTKMM_GRID
1151        table[pageno]->attach(*frame, 1, rowno, 2);
1152    #else
1153        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
1154                              Gtk::SHRINK, Gtk::SHRINK);
1155    #endif
1156        rowno++;
1157    
1158      addProp(eReleaseTriggerDecay);      addProp(eReleaseTriggerDecay);
1159      {      {
1160            const char* choices[] = { _("off"), _("on (max. velocity)"), _("on (key velocity)"), 0 };
1161            static const gig::sust_rel_trg_t values[] = {
1162                gig::sust_rel_trg_none,
1163                gig::sust_rel_trg_maxvelocity,
1164                gig::sust_rel_trg_keyvelocity
1165            };
1166            eSustainReleaseTrigger.set_choices(choices, values);
1167        }
1168        eSustainReleaseTrigger.set_tip(_(
1169            "By default release trigger samples are played on note-off events only. "
1170            "This option allows to play release trigger sample on sustain pedal up "
1171            "events as well. NOTE: This is a format extension!"
1172        ));
1173        addProp(eSustainReleaseTrigger);
1174        {
1175          const char* choices[] = { _("none"), _("effect4depth"), _("effect5depth"), 0 };          const char* choices[] = { _("none"), _("effect4depth"), _("effect5depth"), 0 };
1176          static const gig::dim_bypass_ctrl_t values[] = {          static const gig::dim_bypass_ctrl_t values[] = {
1177              gig::dim_bypass_ctrl_none,              gig::dim_bypass_ctrl_none,
# Line 494  DimRegionEdit::DimRegionEdit() : Line 1180  DimRegionEdit::DimRegionEdit() :
1180          };          };
1181          eDimensionBypass.set_choices(choices, values);          eDimensionBypass.set_choices(choices, values);
1182      }      }
1183        eNoNoteOffReleaseTrigger.set_tip(_(
1184            "By default release trigger samples are played on note-off events only. "
1185            "If this option is checked, then no release trigger sample is played "
1186            "when releasing a note. NOTE: This is a format extension!"
1187        ));
1188        addProp(eNoNoteOffReleaseTrigger);
1189      addProp(eDimensionBypass);      addProp(eDimensionBypass);
1190        eSelfMask.widget.set_tooltip_text(_(
1191            "If enabled: new notes with higher velocity value will stop older "
1192            "notes with lower velocity values, that way you can save voices that "
1193            "would barely be audible. This is also useful for certain drum sounds."
1194        ));
1195      addProp(eSelfMask);      addProp(eSelfMask);
1196        eSustainDefeat.widget.set_tooltip_text(_(
1197            "If enabled: sustain pedal will not hold a note. This way you can use "
1198            "the sustain pedal for other purposes, for example to switch among "
1199            "dimension regions."
1200        ));
1201      addProp(eSustainDefeat);      addProp(eSustainDefeat);
1202        eMSDecode.widget.set_tooltip_text(_(
1203            "Defines if Mid/Side Recordings should be decoded. Mid/Side Recordings "
1204            "are an alternative way to record sounds in stereo. The sampler needs "
1205            "to decode such samples to actually make use of them. Note: this "
1206            "feature is currently not supported by LinuxSampler."
1207        ));
1208      addProp(eMSDecode);      addProp(eMSDecode);
1209    
1210      nextPage();      nextPage();
# Line 544  DimRegionEdit::DimRegionEdit() : Line 1252  DimRegionEdit::DimRegionEdit() :
1252          sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled));          sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled));
1253    
1254      append_page(*table[0], _("Sample"));      append_page(*table[0], _("Sample"));
1255      append_page(*table[1], _("Amplitude (1)"));      append_page(*table[1], _("Amp (1)"));
1256      append_page(*table[2], _("Amplitude (2)"));      append_page(*table[2], _("Amp (2)"));
1257      append_page(*table[3], _("Filter (1)"));      append_page(*table[3], _("Amp (3)"));
1258      append_page(*table[4], _("Filter (2)"));      append_page(*table[4], _("Filter (1)"));
1259      append_page(*table[5], _("Pitch"));      append_page(*table[5], _("Filter (2)"));
1260      append_page(*table[6], _("Misc"));      append_page(*table[6], _("Filter (3)"));
1261        append_page(*table[7], _("Pitch"));
1262        append_page(*table[8], _("Misc"));
1263    
1264        Settings::singleton()->showTooltips.get_proxy().signal_changed().connect(
1265            sigc::mem_fun(*this, &DimRegionEdit::on_show_tooltips_changed)
1266        );
1267    
1268        on_show_tooltips_changed();
1269  }  }
1270    
1271  DimRegionEdit::~DimRegionEdit()  DimRegionEdit::~DimRegionEdit()
# Line 560  void DimRegionEdit::addString(const char Line 1276  void DimRegionEdit::addString(const char
1276                                Gtk::Entry*& widget)                                Gtk::Entry*& widget)
1277  {  {
1278      label = new Gtk::Label(Glib::ustring(labelText) + ":");      label = new Gtk::Label(Glib::ustring(labelText) + ":");
1279      label->set_alignment(Gtk::ALIGN_LEFT);  #if HAS_GTKMM_ALIGNMENT
1280        label->set_alignment(Gtk::ALIGN_START);
1281    #else
1282        label->set_halign(Gtk::Align::START);
1283    #endif
1284    
1285    #if USE_GTKMM_GRID
1286        table[pageno]->attach(*label, 1, rowno);
1287    #else
1288      table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,      table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,
1289                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1290    #endif
1291    
1292      widget = new Gtk::Entry();      widget = new Gtk::Entry();
1293    
1294    #if USE_GTKMM_GRID
1295        table[pageno]->attach(*widget, 2, rowno);
1296    #else
1297      table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1,      table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1,
1298                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1299    #endif
1300    
1301        rowno++;
1302    }
1303    
1304    void DimRegionEdit::addString(const char* labelText, Gtk::Label*& label,
1305                                  Gtk::Entry*& widget, Gtk::Button*& button)
1306    {
1307        label = new Gtk::Label(Glib::ustring(labelText) + ":");
1308    #if HAS_GTKMM_ALIGNMENT
1309        label->set_alignment(Gtk::ALIGN_START);
1310    #else
1311        label->set_halign(Gtk::Align::START);
1312    #endif
1313    
1314    #if USE_GTKMM_GRID
1315        table[pageno]->attach(*label, 1, rowno);
1316    #else
1317        table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,
1318                              Gtk::FILL, Gtk::SHRINK);
1319    #endif
1320    
1321        widget = new Gtk::Entry();
1322        button = new Gtk::Button();
1323    
1324        HBox* hbox = new HBox;
1325        hbox->pack_start(*widget);
1326        hbox->pack_start(*button, Gtk::PACK_SHRINK);
1327    
1328    #if USE_GTKMM_GRID
1329        table[pageno]->attach(*hbox, 2, rowno);
1330    #else
1331        table[pageno]->attach(*hbox, 2, 3, rowno, rowno + 1,
1332                              Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1333    #endif
1334    
1335      rowno++;      rowno++;
1336  }  }
# Line 578  Gtk::Label* DimRegionEdit::addHeader(con Line 1340  Gtk::Label* DimRegionEdit::addHeader(con
1340      if (firstRowInBlock < rowno - 1)      if (firstRowInBlock < rowno - 1)
1341      {      {
1342          Gtk::Label* filler = new Gtk::Label("    ");          Gtk::Label* filler = new Gtk::Label("    ");
1343    #if USE_GTKMM_GRID
1344            table[pageno]->attach(*filler, 0, firstRowInBlock);
1345    #else
1346          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,
1347                                Gtk::FILL, Gtk::SHRINK);                                Gtk::FILL, Gtk::SHRINK);
1348    #endif
1349      }      }
1350      Glib::ustring str = "<b>";      Glib::ustring str = "<b>";
1351      str += text;      str += text;
1352      str += "</b>";      str += "</b>";
1353      Gtk::Label* label = new Gtk::Label(str);      Gtk::Label* label = new Gtk::Label(str);
1354      label->set_use_markup();      label->set_use_markup();
1355      label->set_alignment(Gtk::ALIGN_LEFT);  #if HAS_GTKMM_ALIGNMENT
1356        label->set_alignment(Gtk::ALIGN_START);
1357    #else
1358        label->set_halign(Gtk::Align::START);
1359    #endif
1360        // on GTKMM 3 there is absolutely no margin by default
1361    #if GTKMM_MAJOR_VERSION >= 3
1362        label->set_margin_top(18);
1363        label->set_margin_bottom(13);
1364    #endif
1365    #if USE_GTKMM_GRID
1366        table[pageno]->attach(*label, 0, rowno, 3);
1367    #else
1368      table[pageno]->attach(*label, 0, 3, rowno, rowno + 1,      table[pageno]->attach(*label, 0, 3, rowno, rowno + 1,
1369                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1370    #endif
1371      rowno++;      rowno++;
1372      firstRowInBlock = rowno;      firstRowInBlock = rowno;
1373      return label;      return label;
1374  }  }
1375    
1376    void DimRegionEdit::on_show_tooltips_changed() {
1377        const bool b = Settings::singleton()->showTooltips;
1378    
1379        buttonSelectSample.set_has_tooltip(b);
1380        buttonNullSampleReference->set_has_tooltip(b);
1381        wSample->set_has_tooltip(b);
1382    
1383        eEG1StateOptions.on_show_tooltips_changed();
1384        eEG2StateOptions.on_show_tooltips_changed();
1385    
1386        set_has_tooltip(b);
1387    }
1388    
1389  void DimRegionEdit::nextPage()  void DimRegionEdit::nextPage()
1390  {  {
1391      if (firstRowInBlock < rowno - 1)      if (firstRowInBlock < rowno - 1)
1392      {      {
1393          Gtk::Label* filler = new Gtk::Label("    ");          Gtk::Label* filler = new Gtk::Label("    ");
1394    #if USE_GTKMM_GRID
1395            table[pageno]->attach(*filler, 0, firstRowInBlock);
1396    #else
1397          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,
1398                                Gtk::FILL, Gtk::SHRINK);                                Gtk::FILL, Gtk::SHRINK);
1399    #endif
1400      }      }
1401      pageno++;      pageno++;
1402      rowno = 0;      rowno = 0;
# Line 609  void DimRegionEdit::nextPage() Line 1405  void DimRegionEdit::nextPage()
1405    
1406  void DimRegionEdit::addProp(BoolEntry& boolentry)  void DimRegionEdit::addProp(BoolEntry& boolentry)
1407  {  {
1408    #if USE_GTKMM_GRID
1409        table[pageno]->attach(boolentry.widget, 1, rowno, 2);
1410    #else
1411      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,
1412                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1413    #endif
1414      rowno++;      rowno++;
1415  }  }
1416    
1417  void DimRegionEdit::addProp(BoolEntryPlus6& boolentry)  void DimRegionEdit::addProp(LabelWidget& prop)
1418  {  {
1419      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,  #if USE_GTKMM_GRID
1420        table[pageno]->attach(prop.label, 1, rowno);
1421        table[pageno]->attach(prop.widget, 2, rowno);
1422    #else
1423        table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1,
1424                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1425        table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1,
1426                              Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1427    #endif
1428      rowno++;      rowno++;
1429  }  }
1430    
1431  void DimRegionEdit::addProp(LabelWidget& prop)  void DimRegionEdit::addLine(HBox& line)
1432  {  {
1433      table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1,  #if USE_GTKMM_GRID
1434        table[pageno]->attach(line, 1, rowno, 2);
1435    #else
1436        table[pageno]->attach(line, 1, 3, rowno, rowno + 1,
1437                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1438      table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1,  #endif
                           Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);  
1439      rowno++;      rowno++;
1440  }  }
1441    
1442    void DimRegionEdit::addRightHandSide(Gtk::Widget& widget)
1443    {
1444    #if USE_GTKMM_GRID
1445        table[pageno]->attach(widget, 2, rowno);
1446    #else
1447        table[pageno]->attach(widget, 2, 3, rowno, rowno + 1,
1448                              Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1449    #endif
1450        rowno++;
1451    }
1452    
1453  void DimRegionEdit::set_dim_region(gig::DimensionRegion* d)  void DimRegionEdit::set_dim_region(gig::DimensionRegion* d)
1454  {  {
1455      dimregion = d;      dimregion = d;
1456        velocity_curve.set_dim_region(d);
1457        release_curve.set_dim_region(d);
1458        cutoff_curve.set_dim_region(d);
1459        crossfade_curve.set_dim_region(d);
1460        lfo1Graph.set_dim_region(d);
1461        lfo2Graph.set_dim_region(d);
1462        lfo3Graph.set_dim_region(d);
1463    
1464      set_sensitive(d);      set_sensitive(d);
1465      if (!d) return;      if (!d) return;
# Line 652  void DimRegionEdit::set_dim_region(gig:: Line 1478  void DimRegionEdit::set_dim_region(gig::
1478      eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence);      eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence);
1479      eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence);      eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence);
1480      eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence);      eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence);
1481        eEG1StateOptions.checkBoxAttack.set_value(d->EG1Options.AttackCancel);
1482        eEG1StateOptions.checkBoxAttackHold.set_value(d->EG1Options.AttackHoldCancel);
1483        eEG1StateOptions.checkBoxDecay1.set_value(d->EG1Options.Decay1Cancel);
1484        eEG1StateOptions.checkBoxDecay2.set_value(d->EG1Options.Decay2Cancel);
1485        eEG1StateOptions.checkBoxRelease.set_value(d->EG1Options.ReleaseCancel);
1486        eLFO1Wave.set_value(d->LFO1WaveForm);
1487      eLFO1Frequency.set_value(d->LFO1Frequency);      eLFO1Frequency.set_value(d->LFO1Frequency);
1488        eLFO1Phase.set_value(d->LFO1Phase);
1489      eLFO1InternalDepth.set_value(d->LFO1InternalDepth);      eLFO1InternalDepth.set_value(d->LFO1InternalDepth);
1490      eLFO1ControlDepth.set_value(d->LFO1ControlDepth);      eLFO1ControlDepth.set_value(d->LFO1ControlDepth);
1491      eLFO1Controller.set_value(d->LFO1Controller);      eLFO1Controller.set_value(d->LFO1Controller);
# Line 670  void DimRegionEdit::set_dim_region(gig:: Line 1503  void DimRegionEdit::set_dim_region(gig::
1503      eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence);      eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence);
1504      eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence);      eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence);
1505      eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence);      eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence);
1506        eEG2StateOptions.checkBoxAttack.set_value(d->EG2Options.AttackCancel);
1507        eEG2StateOptions.checkBoxAttackHold.set_value(d->EG2Options.AttackHoldCancel);
1508        eEG2StateOptions.checkBoxDecay1.set_value(d->EG2Options.Decay1Cancel);
1509        eEG2StateOptions.checkBoxDecay2.set_value(d->EG2Options.Decay2Cancel);
1510        eEG2StateOptions.checkBoxRelease.set_value(d->EG2Options.ReleaseCancel);
1511        eLFO2Wave.set_value(d->LFO2WaveForm);
1512      eLFO2Frequency.set_value(d->LFO2Frequency);      eLFO2Frequency.set_value(d->LFO2Frequency);
1513        eLFO2Phase.set_value(d->LFO2Phase);
1514      eLFO2InternalDepth.set_value(d->LFO2InternalDepth);      eLFO2InternalDepth.set_value(d->LFO2InternalDepth);
1515      eLFO2ControlDepth.set_value(d->LFO2ControlDepth);      eLFO2ControlDepth.set_value(d->LFO2ControlDepth);
1516      eLFO2Controller.set_value(d->LFO2Controller);      eLFO2Controller.set_value(d->LFO2Controller);
# Line 678  void DimRegionEdit::set_dim_region(gig:: Line 1518  void DimRegionEdit::set_dim_region(gig::
1518      eLFO2Sync.set_value(d->LFO2Sync);      eLFO2Sync.set_value(d->LFO2Sync);
1519      eEG3Attack.set_value(d->EG3Attack);      eEG3Attack.set_value(d->EG3Attack);
1520      eEG3Depth.set_value(d->EG3Depth);      eEG3Depth.set_value(d->EG3Depth);
1521        eLFO3Wave.set_value(d->LFO3WaveForm);
1522      eLFO3Frequency.set_value(d->LFO3Frequency);      eLFO3Frequency.set_value(d->LFO3Frequency);
1523        eLFO3Phase.set_value(d->LFO3Phase);
1524      eLFO3InternalDepth.set_value(d->LFO3InternalDepth);      eLFO3InternalDepth.set_value(d->LFO3InternalDepth);
1525      eLFO3ControlDepth.set_value(d->LFO3ControlDepth);      eLFO3ControlDepth.set_value(d->LFO3ControlDepth);
1526      eLFO3Controller.set_value(d->LFO3Controller);      eLFO3Controller.set_value(d->LFO3Controller);
1527        eLFO3FlipPhase.set_value(d->LFO3FlipPhase);
1528      eLFO3Sync.set_value(d->LFO3Sync);      eLFO3Sync.set_value(d->LFO3Sync);
1529      eVCFEnabled.set_value(d->VCFEnabled);      eVCFEnabled.set_value(d->VCFEnabled);
1530      eVCFType.set_value(d->VCFType);      eVCFType.set_value(d->VCFType);
# Line 707  void DimRegionEdit::set_dim_region(gig:: Line 1550  void DimRegionEdit::set_dim_region(gig::
1550      eCrossfade_out_start.set_value(d->Crossfade.out_start);      eCrossfade_out_start.set_value(d->Crossfade.out_start);
1551      eCrossfade_out_end.set_value(d->Crossfade.out_end);      eCrossfade_out_end.set_value(d->Crossfade.out_end);
1552      ePitchTrack.set_value(d->PitchTrack);      ePitchTrack.set_value(d->PitchTrack);
1553        eSustainReleaseTrigger.set_value(d->SustainReleaseTrigger);
1554        eNoNoteOffReleaseTrigger.set_value(d->NoNoteOffReleaseTrigger);
1555      eDimensionBypass.set_value(d->DimensionBypass);      eDimensionBypass.set_value(d->DimensionBypass);
1556      ePan.set_value(d->Pan);      ePan.set_value(d->Pan);
1557      eSelfMask.set_value(d->SelfMask);      eSelfMask.set_value(d->SelfMask);
# Line 718  void DimRegionEdit::set_dim_region(gig:: Line 1563  void DimRegionEdit::set_dim_region(gig::
1563      eMSDecode.set_value(d->MSDecode);      eMSDecode.set_value(d->MSDecode);
1564      eSampleStartOffset.set_value(d->SampleStartOffset);      eSampleStartOffset.set_value(d->SampleStartOffset);
1565      eUnityNote.set_value(d->UnityNote);      eUnityNote.set_value(d->UnityNote);
1566        // show sample group name
1567        {
1568            Glib::ustring s = "---";
1569            if (d->pSample && d->pSample->GetGroup())
1570                s = d->pSample->GetGroup()->Name;
1571            eSampleGroup.text.set_text(s);
1572        }
1573        // assemble sample format info string
1574        {
1575            Glib::ustring s;
1576            if (d->pSample) {
1577                switch (d->pSample->Channels) {
1578                    case 1: s = _("Mono"); break;
1579                    case 2: s = _("Stereo"); break;
1580                    default:
1581                        s = ToString(d->pSample->Channels) + _(" audio channels");
1582                        break;
1583                }
1584                s += " " + ToString(d->pSample->BitDepth) + " Bits";
1585                s += " " + ToString(d->pSample->SamplesPerSecond/1000) + "."
1586                          + ToString((d->pSample->SamplesPerSecond%1000)/100) + " kHz";
1587            } else {
1588                s = _("No sample assigned to this dimension region.");
1589            }
1590            eSampleFormatInfo.text.set_text(s);
1591        }
1592        // generate sample's memory address pointer string
1593        {
1594            Glib::ustring s;
1595            if (d->pSample) {
1596                char buf[64] = {};
1597                snprintf(buf, sizeof(buf), "%p", d->pSample);
1598                s = buf;
1599            } else {
1600                s = "---";
1601            }
1602            eSampleID.text.set_text(s);
1603        }
1604        // generate raw wave form data CRC-32 checksum string
1605        {
1606            Glib::ustring s = "---";
1607            if (d->pSample) {
1608                char buf[64] = {};
1609                snprintf(buf, sizeof(buf), "%x", d->pSample->GetWaveDataCRC32Checksum());
1610                s = buf;
1611            }
1612            eChecksum.text.set_text(s);
1613        }
1614        buttonSelectSample.set_sensitive(d && d->pSample);
1615      eFineTune.set_value(d->FineTune);      eFineTune.set_value(d->FineTune);
1616      eGain.set_value(d->Gain);      eGain.set_value(d->Gain);
     eGainPlus6.set_value(d->Gain);  
1617      eSampleLoopEnabled.set_value(d->SampleLoops);      eSampleLoopEnabled.set_value(d->SampleLoops);
1618      eSampleLoopType.set_value(      eSampleLoopType.set_value(
1619          d->SampleLoops ? d->pSampleLoops[0].LoopType : 0);          d->SampleLoops ? d->pSampleLoops[0].LoopType : 0);
# Line 734  void DimRegionEdit::set_dim_region(gig:: Line 1627  void DimRegionEdit::set_dim_region(gig::
1627          d->pSample ? d->pSample->LoopPlayCount : 0);          d->pSample ? d->pSample->LoopPlayCount : 0);
1628      update_model--;      update_model--;
1629    
1630      wSample->set_text(d->pSample ? d->pSample->pInfo->Name.c_str() : _("NULL"));      wSample->set_text(d->pSample ? gig_to_utf8(d->pSample->pInfo->Name) :
1631                          _("NULL"));
1632    
1633      update_loop_elements();      update_loop_elements();
1634      VCFEnabled_toggled();      VCFEnabled_toggled();
# Line 749  void DimRegionEdit::VCFEnabled_toggled() Line 1643  void DimRegionEdit::VCFEnabled_toggled()
1643      eVCFVelocityCurve.set_sensitive(sensitive);      eVCFVelocityCurve.set_sensitive(sensitive);
1644      eVCFVelocityScale.set_sensitive(sensitive);      eVCFVelocityScale.set_sensitive(sensitive);
1645      eVCFVelocityDynamicRange.set_sensitive(sensitive);      eVCFVelocityDynamicRange.set_sensitive(sensitive);
1646        cutoff_curve.set_sensitive(sensitive);
1647      eVCFResonance.set_sensitive(sensitive);      eVCFResonance.set_sensitive(sensitive);
1648      eVCFResonanceController.set_sensitive(sensitive);      eVCFResonanceController.set_sensitive(sensitive);
1649      eVCFKeyboardTracking.set_sensitive(sensitive);      eVCFKeyboardTracking.set_sensitive(sensitive);
# Line 764  void DimRegionEdit::VCFEnabled_toggled() Line 1659  void DimRegionEdit::VCFEnabled_toggled()
1659      eEG2ControllerAttackInfluence.set_sensitive(sensitive);      eEG2ControllerAttackInfluence.set_sensitive(sensitive);
1660      eEG2ControllerDecayInfluence.set_sensitive(sensitive);      eEG2ControllerDecayInfluence.set_sensitive(sensitive);
1661      eEG2ControllerReleaseInfluence.set_sensitive(sensitive);      eEG2ControllerReleaseInfluence.set_sensitive(sensitive);
1662        eEG2StateOptions.set_sensitive(sensitive);
1663      lLFO2->set_sensitive(sensitive);      lLFO2->set_sensitive(sensitive);
1664        eLFO2Wave.set_sensitive(sensitive);
1665      eLFO2Frequency.set_sensitive(sensitive);      eLFO2Frequency.set_sensitive(sensitive);
1666        eLFO2Phase.set_sensitive(sensitive);
1667      eLFO2InternalDepth.set_sensitive(sensitive);      eLFO2InternalDepth.set_sensitive(sensitive);
1668      eLFO2ControlDepth.set_sensitive(sensitive);      eLFO2ControlDepth.set_sensitive(sensitive);
1669      eLFO2Controller.set_sensitive(sensitive);      eLFO2Controller.set_sensitive(sensitive);
1670      eLFO2FlipPhase.set_sensitive(sensitive);      eLFO2FlipPhase.set_sensitive(sensitive);
1671      eLFO2Sync.set_sensitive(sensitive);      eLFO2Sync.set_sensitive(sensitive);
1672        lfo2Graph.set_sensitive(sensitive);
1673      if (sensitive) {      if (sensitive) {
1674          VCFCutoffController_changed();          VCFCutoffController_changed();
1675          VCFResonanceController_changed();          VCFResonanceController_changed();
# Line 841  void DimRegionEdit::AttenuationControlle Line 1740  void DimRegionEdit::AttenuationControlle
1740      eCrossfade_in_end.set_sensitive(hasController);      eCrossfade_in_end.set_sensitive(hasController);
1741      eCrossfade_out_start.set_sensitive(hasController);      eCrossfade_out_start.set_sensitive(hasController);
1742      eCrossfade_out_end.set_sensitive(hasController);      eCrossfade_out_end.set_sensitive(hasController);
1743        crossfade_curve.set_sensitive(hasController);
1744  }  }
1745    
1746  void DimRegionEdit::LFO1Controller_changed()  void DimRegionEdit::LFO1Controller_changed()
# Line 954  void DimRegionEdit::loop_infinite_toggle Line 1854  void DimRegionEdit::loop_infinite_toggle
1854      update_model--;      update_model--;
1855  }  }
1856    
1857  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)
1858    {
1859        bool result = false;
1860        for (std::set<gig::DimensionRegion*>::iterator itDimReg = dimregs.begin();
1861             itDimReg != dimregs.end(); ++itDimReg)
1862        {
1863            result |= set_sample(*itDimReg, sample, copy_sample_unity, copy_sample_tune, copy_sample_loop);
1864        }
1865        return result;
1866    }
1867    
1868    bool DimRegionEdit::set_sample(gig::DimensionRegion* dimreg, gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop)
1869  {  {
1870      if (dimregion) {      if (dimreg) {
1871          //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
1872    
1873          // 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()
1874          //dimreg_to_be_changed_signal.emit(dimregion);          //DimRegionChangeGuard(this, dimregion);
1875    
1876          // make sure stereo samples always are the same in both          // make sure stereo samples always are the same in both
1877          // dimregs in the samplechannel dimension          // dimregs in the samplechannel dimension
1878          int nbDimregs = 1;          int nbDimregs = 1;
1879          gig::DimensionRegion* d[2] = { dimregion, 0 };          gig::DimensionRegion* d[2] = { dimreg, 0 };
1880          if (sample->Channels == 2) {          if (sample->Channels == 2) {
1881              gig::Region* region = dimregion->GetParent();              gig::Region* region = dimreg->GetParent();
1882    
1883              int bitcount = 0;              int bitcount = 0;
1884              int stereo_bit = 0;              int stereo_bit = 0;
# Line 982  bool DimRegionEdit::set_sample(gig::Samp Line 1893  bool DimRegionEdit::set_sample(gig::Samp
1893              if (stereo_bit) {              if (stereo_bit) {
1894                  int dimregno;                  int dimregno;
1895                  for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) {                  for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) {
1896                      if (region->pDimensionRegions[dimregno] == dimregion) {                      if (region->pDimensionRegions[dimregno] == dimreg) {
1897                          break;                          break;
1898                      }                      }
1899                  }                  }
# Line 992  bool DimRegionEdit::set_sample(gig::Samp Line 1903  bool DimRegionEdit::set_sample(gig::Samp
1903              }              }
1904          }          }
1905    
1906          gig::Sample* oldref = dimregion->pSample;          gig::Sample* oldref = dimreg->pSample;
1907    
1908          for (int i = 0 ; i < nbDimregs ; i++) {          for (int i = 0 ; i < nbDimregs ; i++) {
1909              d[i]->pSample = sample;              d[i]->pSample = sample;
1910    
1911              // copy sample information from Sample to DimensionRegion              // copy sample information from Sample to DimensionRegion
1912                if (copy_sample_unity)
1913              d[i]->UnityNote = sample->MIDIUnityNote;                  d[i]->UnityNote = sample->MIDIUnityNote;
1914              d[i]->FineTune = sample->FineTune;              if (copy_sample_tune)
1915                    d[i]->FineTune = sample->FineTune;
1916              int loops = sample->Loops ? 1 : 0;              if (copy_sample_loop) {
1917              while (d[i]->SampleLoops > loops) {                  int loops = sample->Loops ? 1 : 0;
1918                  d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]);                  while (d[i]->SampleLoops > loops) {
1919              }                      d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]);
1920              while (d[i]->SampleLoops < sample->Loops) {                  }
1921                  DLS::sample_loop_t loop;                  while (d[i]->SampleLoops < sample->Loops) {
1922                  d[i]->AddSampleLoop(&loop);                      DLS::sample_loop_t loop;
1923              }                      d[i]->AddSampleLoop(&loop);
1924              if (loops) {                  }
1925                  d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t);                  if (loops) {
1926                  d[i]->pSampleLoops[0].LoopType = sample->LoopType;                      d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t);
1927                  d[i]->pSampleLoops[0].LoopStart = sample->LoopStart;                      d[i]->pSampleLoops[0].LoopType = sample->LoopType;
1928                  d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1;                      d[i]->pSampleLoops[0].LoopStart = sample->LoopStart;
1929                        d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1;
1930                    }
1931              }              }
1932          }          }
1933    
1934          // update ui          // update ui
1935          update_model++;          update_model++;
1936          wSample->set_text(dimregion->pSample->pInfo->Name);          wSample->set_text(gig_to_utf8(dimreg->pSample->pInfo->Name));
1937          eUnityNote.set_value(dimregion->UnityNote);          eUnityNote.set_value(dimreg->UnityNote);
1938          eFineTune.set_value(dimregion->FineTune);          eFineTune.set_value(dimreg->FineTune);
1939          eSampleLoopEnabled.set_value(dimregion->SampleLoops);          eSampleLoopEnabled.set_value(dimreg->SampleLoops);
1940          update_loop_elements();          update_loop_elements();
1941          update_model--;          update_model--;
1942    
1943          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);  
1944          return true;          return true;
1945      }      }
1946      return false;      return false;
# Line 1048  sigc::signal<void, gig::Sample*/*old*/, Line 1959  sigc::signal<void, gig::Sample*/*old*/,
1959  }  }
1960    
1961    
1962  void DimRegionEdit::set_UnityNote(gig::DimensionRegion* d, uint8_t value)  void DimRegionEdit::set_UnityNote(gig::DimensionRegion& d, uint8_t value)
1963  {  {
1964      d->UnityNote = value;      d.UnityNote = value;
1965  }  }
1966    
1967  void DimRegionEdit::set_FineTune(gig::DimensionRegion* d, int16_t value)  void DimRegionEdit::set_FineTune(gig::DimensionRegion& d, int16_t value)
1968  {  {
1969      d->FineTune = value;      d.FineTune = value;
1970  }  }
1971    
1972  void DimRegionEdit::set_Crossfade_in_start(gig::DimensionRegion* d,  void DimRegionEdit::set_Crossfade_in_start(gig::DimensionRegion& d,
1973                                             uint8_t value)                                             uint8_t value)
1974  {  {
1975      d->Crossfade.in_start = value;      d.Crossfade.in_start = value;
1976      if (d->Crossfade.in_end < value) set_Crossfade_in_end(d, value);      if (d.Crossfade.in_end < value) set_Crossfade_in_end(d, value);
1977  }  }
1978    
1979  void DimRegionEdit::set_Crossfade_in_end(gig::DimensionRegion* d,  void DimRegionEdit::set_Crossfade_in_end(gig::DimensionRegion& d,
1980                                           uint8_t value)                                           uint8_t value)
1981  {  {
1982      d->Crossfade.in_end = value;      d.Crossfade.in_end = value;
1983      if (value < d->Crossfade.in_start) set_Crossfade_in_start(d, value);      if (value < d.Crossfade.in_start) set_Crossfade_in_start(d, value);
1984      if (value > d->Crossfade.out_start) set_Crossfade_out_start(d, value);      if (value > d.Crossfade.out_start) set_Crossfade_out_start(d, value);
1985  }  }
1986    
1987  void DimRegionEdit::set_Crossfade_out_start(gig::DimensionRegion* d,  void DimRegionEdit::set_Crossfade_out_start(gig::DimensionRegion& d,
1988                                              uint8_t value)                                              uint8_t value)
1989  {  {
1990      d->Crossfade.out_start = value;      d.Crossfade.out_start = value;
1991      if (value < d->Crossfade.in_end) set_Crossfade_in_end(d, value);      if (value < d.Crossfade.in_end) set_Crossfade_in_end(d, value);
1992      if (value > d->Crossfade.out_end) set_Crossfade_out_end(d, value);      if (value > d.Crossfade.out_end) set_Crossfade_out_end(d, value);
1993  }  }
1994    
1995  void DimRegionEdit::set_Crossfade_out_end(gig::DimensionRegion* d,  void DimRegionEdit::set_Crossfade_out_end(gig::DimensionRegion& d,
1996                                            uint8_t value)                                            uint8_t value)
1997  {  {
1998      d->Crossfade.out_end = value;      d.Crossfade.out_end = value;
1999      if (value < d->Crossfade.out_start) set_Crossfade_out_start(d, value);      if (value < d.Crossfade.out_start) set_Crossfade_out_start(d, value);
2000  }  }
2001    
2002  void DimRegionEdit::set_Gain(gig::DimensionRegion* d, int32_t value)  void DimRegionEdit::set_Gain(gig::DimensionRegion& d, int32_t value)
2003  {  {
2004      d->SetGain(value);      d.SetGain(value);
2005  }  }
2006    
2007  void DimRegionEdit::set_LoopEnabled(gig::DimensionRegion* d, bool value)  void DimRegionEdit::set_LoopEnabled(gig::DimensionRegion& d, bool value)
2008  {  {
2009      if (value) {      if (value) {
2010          // create a new sample loop in case there is none yet          // create a new sample loop in case there is none yet
2011          if (!d->SampleLoops) {          if (!d.SampleLoops) {
2012                DimRegionChangeGuard(this, &d);
2013    
2014              DLS::sample_loop_t loop;              DLS::sample_loop_t loop;
2015              loop.LoopType = gig::loop_type_normal;              loop.LoopType = gig::loop_type_normal;
2016              // loop the whole sample by default              // loop the whole sample by default
2017              loop.LoopStart  = 0;              loop.LoopStart  = 0;
2018              loop.LoopLength =              loop.LoopLength =
2019                  (d->pSample) ? d->pSample->SamplesTotal : 0;                  (d.pSample) ? d.pSample->SamplesTotal : 0;
2020              dimreg_to_be_changed_signal.emit(d);              d.AddSampleLoop(&loop);
             d->AddSampleLoop(&loop);  
             dimreg_changed_signal.emit(d);  
2021          }          }
2022      } else {      } else {
2023          if (d->SampleLoops) {          if (d.SampleLoops) {
2024              dimreg_to_be_changed_signal.emit(d);              DimRegionChangeGuard(this, &d);
2025    
2026              // delete ALL existing sample loops              // delete ALL existing sample loops
2027              while (d->SampleLoops) {              while (d.SampleLoops) {
2028                  d->DeleteSampleLoop(&d->pSampleLoops[0]);                  d.DeleteSampleLoop(&d.pSampleLoops[0]);
2029              }              }
             dimreg_changed_signal.emit(d);  
2030          }          }
2031      }      }
2032  }  }
2033    
2034  void DimRegionEdit::set_LoopType(gig::DimensionRegion* d, uint32_t value)  void DimRegionEdit::set_LoopType(gig::DimensionRegion& d, uint32_t value)
2035  {  {
2036      if (d->SampleLoops) d->pSampleLoops[0].LoopType = value;      if (d.SampleLoops) d.pSampleLoops[0].LoopType = value;
2037  }  }
2038    
2039  void DimRegionEdit::set_LoopStart(gig::DimensionRegion* d, uint32_t value)  void DimRegionEdit::set_LoopStart(gig::DimensionRegion& d, uint32_t value)
2040  {  {
2041      if (d->SampleLoops) {      if (d.SampleLoops) {
2042          d->pSampleLoops[0].LoopStart =          d.pSampleLoops[0].LoopStart =
2043              d->pSample ?              d.pSample ?
2044              std::min(value, uint32_t(d->pSample->SamplesTotal -              std::min(value, uint32_t(d.pSample->SamplesTotal -
2045                                       d->pSampleLoops[0].LoopLength)) :                                       d.pSampleLoops[0].LoopLength)) :
2046              0;              0;
2047      }      }
2048  }  }
2049    
2050  void DimRegionEdit::set_LoopLength(gig::DimensionRegion* d, uint32_t value)  void DimRegionEdit::set_LoopLength(gig::DimensionRegion& d, uint32_t value)
2051  {  {
2052      if (d->SampleLoops) {      if (d.SampleLoops) {
2053          d->pSampleLoops[0].LoopLength =          d.pSampleLoops[0].LoopLength =
2054              d->pSample ?              d.pSample ?
2055              std::min(value, uint32_t(d->pSample->SamplesTotal -              std::min(value, uint32_t(d.pSample->SamplesTotal -
2056                                       d->pSampleLoops[0].LoopStart)) :                                       d.pSampleLoops[0].LoopStart)) :
2057              0;              0;
2058      }      }
2059  }  }
2060    
2061  void DimRegionEdit::set_LoopInfinite(gig::DimensionRegion* d, bool value)  void DimRegionEdit::set_LoopInfinite(gig::DimensionRegion& d, bool value)
2062  {  {
2063      if (d->pSample) {      if (d.pSample) {
2064          if (value) d->pSample->LoopPlayCount = 0;          if (value) d.pSample->LoopPlayCount = 0;
2065          else if (d->pSample->LoopPlayCount == 0) d->pSample->LoopPlayCount = 1;          else if (d.pSample->LoopPlayCount == 0) d.pSample->LoopPlayCount = 1;
2066      }      }
2067  }  }
2068    
2069  void DimRegionEdit::set_LoopPlayCount(gig::DimensionRegion* d, uint32_t value)  void DimRegionEdit::set_LoopPlayCount(gig::DimensionRegion& d, uint32_t value)
2070  {  {
2071      if (d->pSample) d->pSample->LoopPlayCount = value;      if (d.pSample) d.pSample->LoopPlayCount = value;
2072    }
2073    
2074    void DimRegionEdit::nullOutSampleReference() {
2075        if (!dimregion) return;
2076        gig::Sample* oldref = dimregion->pSample;
2077        if (!oldref) return;
2078    
2079        DimRegionChangeGuard(this, dimregion);
2080    
2081        // in case currently assigned sample is a stereo one, then remove both
2082        // references (expected to be due to a "stereo dimension")
2083        gig::DimensionRegion* d[2] = { dimregion, NULL };
2084        if (oldref->Channels == 2) {
2085            gig::Region* region = dimregion->GetParent();
2086            {
2087                int stereo_bit = 0;
2088                int bitcount = 0;
2089                for (int dim = 0 ; dim < region->Dimensions ; dim++) {
2090                    if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) {
2091                        stereo_bit = 1 << bitcount;
2092                        break;
2093                    }
2094                    bitcount += region->pDimensionDefinitions[dim].bits;
2095                }
2096    
2097                if (stereo_bit) {
2098                    int dimregno;
2099                    for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) {
2100                        if (region->pDimensionRegions[dimregno] == dimregion) {
2101                            break;
2102                        }
2103                    }
2104                    d[0] = region->pDimensionRegions[dimregno & ~stereo_bit];
2105                    d[1] = region->pDimensionRegions[dimregno | stereo_bit];
2106                }
2107            }
2108        }
2109    
2110        if (d[0]) d[0]->pSample = NULL;
2111        if (d[1]) d[1]->pSample = NULL;
2112    
2113        // update UI elements
2114        set_dim_region(dimregion);
2115    
2116        sample_ref_changed_signal.emit(oldref, NULL);
2117    }
2118    
2119    void DimRegionEdit::onButtonSelectSamplePressed() {
2120        if (!dimregion) return;
2121        if (!dimregion->pSample) return;
2122        select_sample_signal.emit(dimregion->pSample);
2123    }
2124    
2125    sigc::signal<void, gig::Sample*>& DimRegionEdit::signal_select_sample() {
2126        return select_sample_signal;
2127  }  }

Legend:
Removed from v.2151  
changed lines
  Added in v.3643

  ViewVC Help
Powered by ViewVC