/[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 3632 by schoenebeck, Wed Oct 16 17:56:41 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"), -96, 0, 2, -655360),
435      eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360),      eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360),
436      eSampleLoopEnabled(_("Enabled")),      eSampleLoopEnabled(_("Enabled")),
437      eSampleLoopStart(_("Loop start positon")),      eSampleLoopStart(_("Loop start position")),
438      eSampleLoopLength(_("Loop size")),      eSampleLoopLength(_("Loop size")),
439      eSampleLoopType(_("Loop type")),      eSampleLoopType(_("Loop type")),
440      eSampleLoopInfinite(_("Infinite loop")),      eSampleLoopInfinite(_("Infinite loop")),
441      eSampleLoopPlayCount(_("Playback count"), 1),      eSampleLoopPlayCount(_("Playback count"), 1),
442        buttonSelectSample(UNICODE_LEFT_ARROW + "  " + _("Select Sample")),
443      update_model(0)      update_model(0)
444  {  {
445        // make synthesis parameter page tabs scrollable
446        // (workaround for GTK3: default theme uses huge tabs which breaks layout)
447        set_scrollable();
448    
449      connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack);      connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack);
450      connect(eEG1Attack, &gig::DimensionRegion::EG1Attack);      connect(eEG1Attack, &gig::DimensionRegion::EG1Attack);
451      connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1);      connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1);
# Line 128  DimRegionEdit::DimRegionEdit() : Line 462  DimRegionEdit::DimRegionEdit() :
462              &gig::DimensionRegion::EG1ControllerDecayInfluence);              &gig::DimensionRegion::EG1ControllerDecayInfluence);
463      connect(eEG1ControllerReleaseInfluence,      connect(eEG1ControllerReleaseInfluence,
464              &gig::DimensionRegion::EG1ControllerReleaseInfluence);              &gig::DimensionRegion::EG1ControllerReleaseInfluence);
465        connect(eEG1StateOptions.checkBoxAttack, &gig::DimensionRegion::EG1Options,
466                &gig::eg_opt_t::AttackCancel);
467        connect(eEG1StateOptions.checkBoxAttackHold, &gig::DimensionRegion::EG1Options,
468                &gig::eg_opt_t::AttackHoldCancel);
469        connect(eEG1StateOptions.checkBoxDecay1, &gig::DimensionRegion::EG1Options,
470                &gig::eg_opt_t::Decay1Cancel);
471        connect(eEG1StateOptions.checkBoxDecay2, &gig::DimensionRegion::EG1Options,
472                &gig::eg_opt_t::Decay2Cancel);
473        connect(eEG1StateOptions.checkBoxRelease, &gig::DimensionRegion::EG1Options,
474                &gig::eg_opt_t::ReleaseCancel);
475        connect(eLFO1Wave, &gig::DimensionRegion::LFO1WaveForm);
476      connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency);      connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency);
477        connect(eLFO1Phase, &gig::DimensionRegion::LFO1Phase);
478      connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth);      connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth);
479      connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth);      connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth);
480      connect(eLFO1Controller, &gig::DimensionRegion::LFO1Controller);      connect(eLFO1Controller, &gig::DimensionRegion::LFO1Controller);
# Line 149  DimRegionEdit::DimRegionEdit() : Line 495  DimRegionEdit::DimRegionEdit() :
495              &gig::DimensionRegion::EG2ControllerDecayInfluence);              &gig::DimensionRegion::EG2ControllerDecayInfluence);
496      connect(eEG2ControllerReleaseInfluence,      connect(eEG2ControllerReleaseInfluence,
497              &gig::DimensionRegion::EG2ControllerReleaseInfluence);              &gig::DimensionRegion::EG2ControllerReleaseInfluence);
498        connect(eEG2StateOptions.checkBoxAttack, &gig::DimensionRegion::EG2Options,
499                &gig::eg_opt_t::AttackCancel);
500        connect(eEG2StateOptions.checkBoxAttackHold, &gig::DimensionRegion::EG2Options,
501                &gig::eg_opt_t::AttackHoldCancel);
502        connect(eEG2StateOptions.checkBoxDecay1, &gig::DimensionRegion::EG2Options,
503                &gig::eg_opt_t::Decay1Cancel);
504        connect(eEG2StateOptions.checkBoxDecay2, &gig::DimensionRegion::EG2Options,
505                &gig::eg_opt_t::Decay2Cancel);
506        connect(eEG2StateOptions.checkBoxRelease, &gig::DimensionRegion::EG2Options,
507                &gig::eg_opt_t::ReleaseCancel);
508        connect(eLFO2Wave, &gig::DimensionRegion::LFO2WaveForm);
509      connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency);      connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency);
510        connect(eLFO2Phase, &gig::DimensionRegion::LFO2Phase);
511      connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth);      connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth);
512      connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth);      connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth);
513      connect(eLFO2Controller, &gig::DimensionRegion::LFO2Controller);      connect(eLFO2Controller, &gig::DimensionRegion::LFO2Controller);
# Line 157  DimRegionEdit::DimRegionEdit() : Line 515  DimRegionEdit::DimRegionEdit() :
515      connect(eLFO2Sync, &gig::DimensionRegion::LFO2Sync);      connect(eLFO2Sync, &gig::DimensionRegion::LFO2Sync);
516      connect(eEG3Attack, &gig::DimensionRegion::EG3Attack);      connect(eEG3Attack, &gig::DimensionRegion::EG3Attack);
517      connect(eEG3Depth, &gig::DimensionRegion::EG3Depth);      connect(eEG3Depth, &gig::DimensionRegion::EG3Depth);
518        connect(eLFO3Wave, &gig::DimensionRegion::LFO3WaveForm);
519      connect(eLFO3Frequency, &gig::DimensionRegion::LFO3Frequency);      connect(eLFO3Frequency, &gig::DimensionRegion::LFO3Frequency);
520        connect(eLFO3Phase, &gig::DimensionRegion::LFO3Phase);
521      connect(eLFO3InternalDepth, &gig::DimensionRegion::LFO3InternalDepth);      connect(eLFO3InternalDepth, &gig::DimensionRegion::LFO3InternalDepth);
522      connect(eLFO3ControlDepth, &gig::DimensionRegion::LFO3ControlDepth);      connect(eLFO3ControlDepth, &gig::DimensionRegion::LFO3ControlDepth);
523      connect(eLFO3Controller, &gig::DimensionRegion::LFO3Controller);      connect(eLFO3Controller, &gig::DimensionRegion::LFO3Controller);
524        connect(eLFO3FlipPhase, &gig::DimensionRegion::LFO3FlipPhase);
525      connect(eLFO3Sync, &gig::DimensionRegion::LFO3Sync);      connect(eLFO3Sync, &gig::DimensionRegion::LFO3Sync);
526      connect(eVCFEnabled, &gig::DimensionRegion::VCFEnabled);      connect(eVCFEnabled, &gig::DimensionRegion::VCFEnabled);
527      connect(eVCFType, &gig::DimensionRegion::VCFType);      connect(eVCFType, &gig::DimensionRegion::VCFType);
# Line 196  DimRegionEdit::DimRegionEdit() : Line 557  DimRegionEdit::DimRegionEdit() :
557      connect(eCrossfade_out_start, &DimRegionEdit::set_Crossfade_out_start);      connect(eCrossfade_out_start, &DimRegionEdit::set_Crossfade_out_start);
558      connect(eCrossfade_out_end, &DimRegionEdit::set_Crossfade_out_end);      connect(eCrossfade_out_end, &DimRegionEdit::set_Crossfade_out_end);
559      connect(ePitchTrack, &gig::DimensionRegion::PitchTrack);      connect(ePitchTrack, &gig::DimensionRegion::PitchTrack);
560        connect(eSustainReleaseTrigger, &gig::DimensionRegion::SustainReleaseTrigger);
561        connect(eNoNoteOffReleaseTrigger, &gig::DimensionRegion::NoNoteOffReleaseTrigger);
562      connect(eDimensionBypass, &gig::DimensionRegion::DimensionBypass);      connect(eDimensionBypass, &gig::DimensionRegion::DimensionBypass);
563      connect(ePan, &gig::DimensionRegion::Pan);      connect(ePan, &gig::DimensionRegion::Pan);
564      connect(eSelfMask, &gig::DimensionRegion::SelfMask);      connect(eSelfMask, &gig::DimensionRegion::SelfMask);
# Line 219  DimRegionEdit::DimRegionEdit() : Line 582  DimRegionEdit::DimRegionEdit() :
582      connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength);      connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength);
583      connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite);      connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite);
584      connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount);      connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount);
585        buttonSelectSample.signal_clicked().connect(
586            sigc::mem_fun(*this, &DimRegionEdit::onButtonSelectSamplePressed)
587        );
588    
589      for (int i = 0 ; i < 7 ; i++) {      for (int i = 0 ; i < 9 ; i++) {
590    #if USE_GTKMM_GRID
591            table[i] = new Gtk::Grid;
592            table[i]->set_column_spacing(7);
593    #else
594          table[i] = new Gtk::Table(3, 1);          table[i] = new Gtk::Table(3, 1);
595          table[i]->set_col_spacings(7);          table[i]->set_col_spacings(7);
596    #endif
597    
598    // on Gtk 3 there is absolutely no margin by default
599    #if GTKMM_MAJOR_VERSION >= 3
600    # if GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION < 12
601            table[i]->set_margin_left(12);
602            table[i]->set_margin_right(12);
603    # else
604            table[i]->set_margin_start(12);
605            table[i]->set_margin_end(12);
606    # endif
607    #endif
608      }      }
609    
610      // set tooltips      // set tooltips
611      eUnityNote.set_tip(      eUnityNote.set_tip(
612          _("Note this sample is associated with (a.k.a. 'root note')")          _("Note this sample is associated with (a.k.a. 'root note')")
613      );      );
614        buttonSelectSample.set_tooltip_text(
615            _("Selects the sample of this dimension region on the left hand side's sample tree view.")
616        );
617      eSampleStartOffset.set_tip(_("Sample position at which playback should be started"));      eSampleStartOffset.set_tip(_("Sample position at which playback should be started"));
618      ePan.set_tip(_("Stereo balance (left/right)"));      ePan.set_tip(_("Stereo balance (left/right)"));
619      eChannelOffset.set_tip(      eChannelOffset.set_tip(
# Line 259  DimRegionEdit::DimRegionEdit() : Line 644  DimRegionEdit::DimRegionEdit() :
644            "Caution: this setting is stored on Sample side, thus is shared "            "Caution: this setting is stored on Sample side, thus is shared "
645            "among all dimension regions that use this sample!")            "among all dimension regions that use this sample!")
646      );      );
647        
648        eEG1PreAttack.set_tip(
649            "Very first level this EG starts with. It rises then in Attack Time "
650            "seconds from this initial level to 100%."
651        );
652        eEG1Attack.set_tip(
653            "Duration of the EG's Attack stage, which raises its level from "
654            "Pre-Attack Level to 100%."
655        );
656        eEG1Hold.set_tip(
657           "On looped sounds, enabling this will cause the Decay 1 stage not to "
658           "enter before the loop has been passed one time."
659        );
660        eAttenuationController.set_tip(_(
661            "If you are not using the 'Layer' dimension, then this controller "
662            "simply alters the volume. If you are using the 'Layer' dimension, "
663            "then this controller is controlling the crossfade between Layers in "
664            "real-time."
665        ));
666    
667        eLFO1Sync.set_tip(
668            "If not checked, every voice will use its own LFO instance, which "
669            "causes voices triggered at different points in time to have different "
670            "LFO levels. By enabling 'Sync' here the voices will instead use and "
671            "share one single LFO, causing all voices to have the same LFO level, "
672            "no matter when the individual notes have been triggered."
673        );
674        eLFO2Sync.set_tip(
675            "If not checked, every voice will use its own LFO instance, which "
676            "causes voices triggered at different points in time to have different "
677            "LFO levels. By enabling 'Sync' here the voices will instead use and "
678            "share one single LFO, causing all voices to have the same LFO level, "
679            "no matter when the individual notes have been triggered."
680        );
681        eLFO3Sync.set_tip(
682            "If not checked, every voice will use its own LFO instance, which "
683            "causes voices triggered at different points in time to have different "
684            "LFO levels. By enabling 'Sync' here the voices will instead use and "
685            "share one single LFO, causing all voices to have the same LFO level, "
686            "no matter when the individual notes have been triggered."
687        );
688        eLFO1FlipPhase.set_tip(
689           "Inverts the LFO's generated wave vertically."
690        );
691        eLFO2FlipPhase.set_tip(
692           "Inverts the LFO's generated wave vertically."
693        );
694        eLFO3FlipPhase.set_tip(
695           "Inverts the LFO's generated wave vertically."
696        );
697    
698      pageno = 0;      pageno = 0;
699      rowno = 0;      rowno = 0;
700      firstRowInBlock = 0;      firstRowInBlock = 0;
701    
702      addHeader(_("Mandatory Settings"));      addHeader(_("Mandatory Settings"));
703      addString(_("Sample"), lSample, wSample);      addString(_("Sample"), lSample, wSample, buttonNullSampleReference);
704        buttonNullSampleReference->set_label("X");
705        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."));
706        buttonNullSampleReference->signal_clicked().connect(
707            sigc::mem_fun(*this, &DimRegionEdit::nullOutSampleReference)
708        );
709      //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);
710  #ifdef OLD_TOOLTIPS  #ifdef OLD_TOOLTIPS
711      tooltips.set_tip(*wSample, _("Drop a sample here"));      tooltips.set_tip(*wSample, _("Drag & drop a sample here"));
712  #else  #else
713      wSample->set_tooltip_text(_("Drop a sample here"));      wSample->set_tooltip_text(_("Drag & drop a sample here"));
714  #endif  #endif
715      addProp(eUnityNote);      addProp(eUnityNote);
716        addProp(eSampleGroup);
717        addProp(eSampleFormatInfo);
718        addProp(eSampleID);
719        addProp(eChecksum);
720        addRightHandSide(buttonSelectSample);
721      addHeader(_("Optional Settings"));      addHeader(_("Optional Settings"));
722      addProp(eSampleStartOffset);      addProp(eSampleStartOffset);
723      addProp(eChannelOffset);      addProp(eChannelOffset);
# Line 302  DimRegionEdit::DimRegionEdit() : Line 747  DimRegionEdit::DimRegionEdit() :
747      addHeader(_("Amplitude Envelope (EG1)"));      addHeader(_("Amplitude Envelope (EG1)"));
748      addProp(eEG1PreAttack);      addProp(eEG1PreAttack);
749      addProp(eEG1Attack);      addProp(eEG1Attack);
750        addProp(eEG1Hold);
751      addProp(eEG1Decay1);      addProp(eEG1Decay1);
752      addProp(eEG1Decay2);      addProp(eEG1Decay2);
753      addProp(eEG1InfiniteSustain);      addProp(eEG1InfiniteSustain);
754      addProp(eEG1Sustain);      addProp(eEG1Sustain);
755      addProp(eEG1Release);      addProp(eEG1Release);
     addProp(eEG1Hold);  
756      addProp(eEG1Controller);      addProp(eEG1Controller);
757      addProp(eEG1ControllerInvert);      addProp(eEG1ControllerInvert);
758      addProp(eEG1ControllerAttackInfluence);      addProp(eEG1ControllerAttackInfluence);
759      addProp(eEG1ControllerDecayInfluence);      addProp(eEG1ControllerDecayInfluence);
760      addProp(eEG1ControllerReleaseInfluence);      addProp(eEG1ControllerReleaseInfluence);
761        addLine(eEG1StateOptions);
762    
763      nextPage();      nextPage();
764    
765      addHeader(_("Amplitude Oscillator (LFO1)"));      addHeader(_("Amplitude Oscillator (LFO1)"));
766        addProp(eLFO1Wave);
767      addProp(eLFO1Frequency);      addProp(eLFO1Frequency);
768        addProp(eLFO1Phase);
769      addProp(eLFO1InternalDepth);      addProp(eLFO1InternalDepth);
770      addProp(eLFO1ControlDepth);      addProp(eLFO1ControlDepth);
771      {      {
# Line 335  DimRegionEdit::DimRegionEdit() : Line 783  DimRegionEdit::DimRegionEdit() :
783      addProp(eLFO1Controller);      addProp(eLFO1Controller);
784      addProp(eLFO1FlipPhase);      addProp(eLFO1FlipPhase);
785      addProp(eLFO1Sync);      addProp(eLFO1Sync);
786        {
787            Gtk::Frame* frame = new Gtk::Frame;
788            frame->add(lfo1Graph);
789            // on Gtk 3 there is no margin at all by default
790    #if GTKMM_MAJOR_VERSION >= 3
791            frame->set_margin_top(12);
792            frame->set_margin_bottom(12);
793    #endif
794    #if USE_GTKMM_GRID
795            table[pageno]->attach(*frame, 1, rowno, 2);
796    #else
797            table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
798                                  Gtk::SHRINK, Gtk::SHRINK);
799    #endif
800            rowno++;
801        }
802        eLFO1Wave.signal_value_changed().connect(
803            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
804        );
805        eLFO1Frequency.signal_value_changed().connect(
806            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
807        );
808        eLFO1Phase.signal_value_changed().connect(
809            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
810        );
811        eLFO1InternalDepth.signal_value_changed().connect(
812            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
813        );
814        eLFO1ControlDepth.signal_value_changed().connect(
815            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
816        );
817        eLFO1Controller.signal_value_changed().connect(
818            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
819        );
820        eLFO1FlipPhase.signal_value_changed().connect(
821            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
822        );
823        eLFO1Sync.signal_value_changed().connect(
824            sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
825        );
826    
827        nextPage();
828    
829      addHeader(_("Crossfade"));      addHeader(_("Crossfade"));
830      addProp(eAttenuationController);      addProp(eAttenuationController);
831      addProp(eInvertAttenuationController);      addProp(eInvertAttenuationController);
# Line 344  DimRegionEdit::DimRegionEdit() : Line 835  DimRegionEdit::DimRegionEdit() :
835      addProp(eCrossfade_out_start);      addProp(eCrossfade_out_start);
836      addProp(eCrossfade_out_end);      addProp(eCrossfade_out_end);
837    
838        Gtk::Frame* frame = new Gtk::Frame;
839        frame->add(crossfade_curve);
840        // on Gtk 3 there is no margin at all by default
841    #if GTKMM_MAJOR_VERSION >= 3
842        frame->set_margin_top(12);
843        frame->set_margin_bottom(12);
844    #endif
845    #if USE_GTKMM_GRID
846        table[pageno]->attach(*frame, 1, rowno, 2);
847    #else
848        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
849                              Gtk::SHRINK, Gtk::SHRINK);
850    #endif
851        rowno++;
852    
853        eCrossfade_in_start.signal_value_changed().connect(
854            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
855        eCrossfade_in_end.signal_value_changed().connect(
856            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
857        eCrossfade_out_start.signal_value_changed().connect(
858            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
859        eCrossfade_out_end.signal_value_changed().connect(
860            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
861    
862      nextPage();      nextPage();
863    
864      addHeader(_("General Filter Settings"));      addHeader(_("General Filter Settings"));
# Line 394  DimRegionEdit::DimRegionEdit() : Line 909  DimRegionEdit::DimRegionEdit() :
909      addProp(eVCFVelocityCurve);      addProp(eVCFVelocityCurve);
910      addProp(eVCFVelocityScale);      addProp(eVCFVelocityScale);
911      addProp(eVCFVelocityDynamicRange);      addProp(eVCFVelocityDynamicRange);
912    
913        eVCFCutoffController.signal_value_changed().connect(
914            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
915        eVCFVelocityCurve.signal_value_changed().connect(
916            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
917        eVCFVelocityScale.signal_value_changed().connect(
918            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
919        eVCFVelocityDynamicRange.signal_value_changed().connect(
920            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
921    
922        frame = new Gtk::Frame;
923        frame->add(cutoff_curve);
924        // on Gtk 3 there is no margin at all by default
925    #if GTKMM_MAJOR_VERSION >= 3
926        frame->set_margin_top(12);
927        frame->set_margin_bottom(12);
928    #endif
929    #if USE_GTKMM_GRID
930        table[pageno]->attach(*frame, 1, rowno, 2);
931    #else
932        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
933                              Gtk::SHRINK, Gtk::SHRINK);
934    #endif
935        rowno++;
936    
937      addProp(eVCFResonance);      addProp(eVCFResonance);
938      addProp(eVCFResonanceDynamic);      addProp(eVCFResonanceDynamic);
939      {      {
# Line 427  DimRegionEdit::DimRegionEdit() : Line 967  DimRegionEdit::DimRegionEdit() :
967      addProp(eEG2ControllerAttackInfluence);      addProp(eEG2ControllerAttackInfluence);
968      addProp(eEG2ControllerDecayInfluence);      addProp(eEG2ControllerDecayInfluence);
969      addProp(eEG2ControllerReleaseInfluence);      addProp(eEG2ControllerReleaseInfluence);
970        addLine(eEG2StateOptions);
971    
972        nextPage();
973    
974      lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)"));      lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)"));
975        addProp(eLFO2Wave);
976      addProp(eLFO2Frequency);      addProp(eLFO2Frequency);
977        addProp(eLFO2Phase);
978      addProp(eLFO2InternalDepth);      addProp(eLFO2InternalDepth);
979      addProp(eLFO2ControlDepth);      addProp(eLFO2ControlDepth);
980      {      {
# Line 446  DimRegionEdit::DimRegionEdit() : Line 992  DimRegionEdit::DimRegionEdit() :
992      addProp(eLFO2Controller);      addProp(eLFO2Controller);
993      addProp(eLFO2FlipPhase);      addProp(eLFO2FlipPhase);
994      addProp(eLFO2Sync);      addProp(eLFO2Sync);
995        {
996            Gtk::Frame* frame = new Gtk::Frame;
997            frame->add(lfo2Graph);
998            // on Gtk 3 there is no margin at all by default
999    #if GTKMM_MAJOR_VERSION >= 3
1000            frame->set_margin_top(12);
1001            frame->set_margin_bottom(12);
1002    #endif
1003    #if USE_GTKMM_GRID
1004            table[pageno]->attach(*frame, 1, rowno, 2);
1005    #else
1006            table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
1007                                  Gtk::SHRINK, Gtk::SHRINK);
1008    #endif
1009            rowno++;
1010        }
1011        eLFO2Wave.signal_value_changed().connect(
1012            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1013        );
1014        eLFO2Frequency.signal_value_changed().connect(
1015            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1016        );
1017        eLFO2Phase.signal_value_changed().connect(
1018            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1019        );
1020        eLFO2InternalDepth.signal_value_changed().connect(
1021            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1022        );
1023        eLFO2ControlDepth.signal_value_changed().connect(
1024            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1025        );
1026        eLFO2Controller.signal_value_changed().connect(
1027            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1028        );
1029        eLFO2FlipPhase.signal_value_changed().connect(
1030            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1031        );
1032        eLFO2Sync.signal_value_changed().connect(
1033            sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1034        );
1035    
1036      nextPage();      nextPage();
1037    
# Line 456  DimRegionEdit::DimRegionEdit() : Line 1042  DimRegionEdit::DimRegionEdit() :
1042      addProp(eEG3Attack);      addProp(eEG3Attack);
1043      addProp(eEG3Depth);      addProp(eEG3Depth);
1044      addHeader(_("Pitch Oscillator (LFO3)"));      addHeader(_("Pitch Oscillator (LFO3)"));
1045        addProp(eLFO3Wave);
1046      addProp(eLFO3Frequency);      addProp(eLFO3Frequency);
1047        addProp(eLFO3Phase);
1048      addProp(eLFO3InternalDepth);      addProp(eLFO3InternalDepth);
1049      addProp(eLFO3ControlDepth);      addProp(eLFO3ControlDepth);
1050      {      {
# Line 472  DimRegionEdit::DimRegionEdit() : Line 1060  DimRegionEdit::DimRegionEdit() :
1060          eLFO3Controller.set_choices(choices, values);          eLFO3Controller.set_choices(choices, values);
1061      }      }
1062      addProp(eLFO3Controller);      addProp(eLFO3Controller);
1063        addProp(eLFO3FlipPhase);
1064      addProp(eLFO3Sync);      addProp(eLFO3Sync);
1065        {
1066            Gtk::Frame* frame = new Gtk::Frame;
1067            frame->add(lfo3Graph);
1068            // on Gtk 3 there is no margin at all by default
1069    #if GTKMM_MAJOR_VERSION >= 3
1070            frame->set_margin_top(12);
1071            frame->set_margin_bottom(12);
1072    #endif
1073    #if USE_GTKMM_GRID
1074            table[pageno]->attach(*frame, 1, rowno, 2);
1075    #else
1076            table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
1077                                  Gtk::SHRINK, Gtk::SHRINK);
1078    #endif
1079            rowno++;
1080        }
1081        eLFO3Wave.signal_value_changed().connect(
1082            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1083        );
1084        eLFO3Frequency.signal_value_changed().connect(
1085            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1086        );
1087        eLFO3Phase.signal_value_changed().connect(
1088            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1089        );
1090        eLFO3InternalDepth.signal_value_changed().connect(
1091            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1092        );
1093        eLFO3ControlDepth.signal_value_changed().connect(
1094            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1095        );
1096        eLFO3Controller.signal_value_changed().connect(
1097            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1098        );
1099        eLFO3FlipPhase.signal_value_changed().connect(
1100            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1101        );
1102        eLFO3Sync.signal_value_changed().connect(
1103            sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1104        );
1105    
1106      nextPage();      nextPage();
1107    
1108        addHeader(_("Velocity Response"));
1109      eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values);      eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values);
1110      addProp(eVelocityResponseCurve);      addProp(eVelocityResponseCurve);
1111      addProp(eVelocityResponseDepth);      addProp(eVelocityResponseDepth);
1112      addProp(eVelocityResponseCurveScaling);      addProp(eVelocityResponseCurveScaling);
1113    
1114        eVelocityResponseCurve.signal_value_changed().connect(
1115            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
1116        eVelocityResponseDepth.signal_value_changed().connect(
1117            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
1118        eVelocityResponseCurveScaling.signal_value_changed().connect(
1119            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
1120    
1121        frame = new Gtk::Frame;
1122        frame->add(velocity_curve);
1123        // on Gtk 3 there is no margin at all by default
1124    #if GTKMM_MAJOR_VERSION >= 3
1125        frame->set_margin_top(12);
1126        frame->set_margin_bottom(12);
1127    #endif
1128    #if USE_GTKMM_GRID
1129        table[pageno]->attach(*frame, 1, rowno, 2);
1130    #else
1131        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
1132                              Gtk::SHRINK, Gtk::SHRINK);
1133    #endif
1134        rowno++;
1135    
1136        addHeader(_("Release Velocity Response"));
1137      eReleaseVelocityResponseCurve.set_choices(curve_type_texts,      eReleaseVelocityResponseCurve.set_choices(curve_type_texts,
1138                                                curve_type_values);                                                curve_type_values);
1139      addProp(eReleaseVelocityResponseCurve);      addProp(eReleaseVelocityResponseCurve);
1140      addProp(eReleaseVelocityResponseDepth);      addProp(eReleaseVelocityResponseDepth);
1141    
1142        eReleaseVelocityResponseCurve.signal_value_changed().connect(
1143            sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));
1144        eReleaseVelocityResponseDepth.signal_value_changed().connect(
1145            sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));
1146        frame = new Gtk::Frame;
1147        frame->add(release_curve);
1148        // on Gtk 3 there is no margin at all by default
1149    #if GTKMM_MAJOR_VERSION >= 3
1150        frame->set_margin_top(12);
1151        frame->set_margin_bottom(12);
1152    #endif
1153    #if USE_GTKMM_GRID
1154        table[pageno]->attach(*frame, 1, rowno, 2);
1155    #else
1156        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
1157                              Gtk::SHRINK, Gtk::SHRINK);
1158    #endif
1159        rowno++;
1160    
1161      addProp(eReleaseTriggerDecay);      addProp(eReleaseTriggerDecay);
1162      {      {
1163            const char* choices[] = { _("off"), _("on (max. velocity)"), _("on (key velocity)"), 0 };
1164            static const gig::sust_rel_trg_t values[] = {
1165                gig::sust_rel_trg_none,
1166                gig::sust_rel_trg_maxvelocity,
1167                gig::sust_rel_trg_keyvelocity
1168            };
1169            eSustainReleaseTrigger.set_choices(choices, values);
1170        }
1171        eSustainReleaseTrigger.set_tip(_(
1172            "By default release trigger samples are played on note-off events only. "
1173            "This option allows to play release trigger sample on sustain pedal up "
1174            "events as well. NOTE: This is a format extension!"
1175        ));
1176        addProp(eSustainReleaseTrigger);
1177        {
1178          const char* choices[] = { _("none"), _("effect4depth"), _("effect5depth"), 0 };          const char* choices[] = { _("none"), _("effect4depth"), _("effect5depth"), 0 };
1179          static const gig::dim_bypass_ctrl_t values[] = {          static const gig::dim_bypass_ctrl_t values[] = {
1180              gig::dim_bypass_ctrl_none,              gig::dim_bypass_ctrl_none,
# Line 494  DimRegionEdit::DimRegionEdit() : Line 1183  DimRegionEdit::DimRegionEdit() :
1183          };          };
1184          eDimensionBypass.set_choices(choices, values);          eDimensionBypass.set_choices(choices, values);
1185      }      }
1186        eNoNoteOffReleaseTrigger.set_tip(_(
1187            "By default release trigger samples are played on note-off events only. "
1188            "If this option is checked, then no release trigger sample is played "
1189            "when releasing a note. NOTE: This is a format extension!"
1190        ));
1191        addProp(eNoNoteOffReleaseTrigger);
1192      addProp(eDimensionBypass);      addProp(eDimensionBypass);
1193        eSelfMask.widget.set_tooltip_text(_(
1194            "If enabled: new notes with higher velocity value will stop older "
1195            "notes with lower velocity values, that way you can save voices that "
1196            "would barely be audible. This is also useful for certain drum sounds."
1197        ));
1198      addProp(eSelfMask);      addProp(eSelfMask);
1199        eSustainDefeat.widget.set_tooltip_text(_(
1200            "If enabled: sustain pedal will not hold a note. This way you can use "
1201            "the sustain pedal for other purposes, for example to switch among "
1202            "dimension regions."
1203        ));
1204      addProp(eSustainDefeat);      addProp(eSustainDefeat);
1205        eMSDecode.widget.set_tooltip_text(_(
1206            "Defines if Mid/Side Recordings should be decoded. Mid/Side Recordings "
1207            "are an alternative way to record sounds in stereo. The sampler needs "
1208            "to decode such samples to actually make use of them. Note: this "
1209            "feature is currently not supported by LinuxSampler."
1210        ));
1211      addProp(eMSDecode);      addProp(eMSDecode);
1212    
1213      nextPage();      nextPage();
# Line 544  DimRegionEdit::DimRegionEdit() : Line 1255  DimRegionEdit::DimRegionEdit() :
1255          sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled));          sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled));
1256    
1257      append_page(*table[0], _("Sample"));      append_page(*table[0], _("Sample"));
1258      append_page(*table[1], _("Amplitude (1)"));      append_page(*table[1], _("Amp (1)"));
1259      append_page(*table[2], _("Amplitude (2)"));      append_page(*table[2], _("Amp (2)"));
1260      append_page(*table[3], _("Filter (1)"));      append_page(*table[3], _("Amp (3)"));
1261      append_page(*table[4], _("Filter (2)"));      append_page(*table[4], _("Filter (1)"));
1262      append_page(*table[5], _("Pitch"));      append_page(*table[5], _("Filter (2)"));
1263      append_page(*table[6], _("Misc"));      append_page(*table[6], _("Filter (3)"));
1264        append_page(*table[7], _("Pitch"));
1265        append_page(*table[8], _("Misc"));
1266    
1267        Settings::singleton()->showTooltips.get_proxy().signal_changed().connect(
1268            sigc::mem_fun(*this, &DimRegionEdit::on_show_tooltips_changed)
1269        );
1270    
1271        on_show_tooltips_changed();
1272  }  }
1273    
1274  DimRegionEdit::~DimRegionEdit()  DimRegionEdit::~DimRegionEdit()
# Line 560  void DimRegionEdit::addString(const char Line 1279  void DimRegionEdit::addString(const char
1279                                Gtk::Entry*& widget)                                Gtk::Entry*& widget)
1280  {  {
1281      label = new Gtk::Label(Glib::ustring(labelText) + ":");      label = new Gtk::Label(Glib::ustring(labelText) + ":");
1282      label->set_alignment(Gtk::ALIGN_LEFT);  #if HAS_GTKMM_ALIGNMENT
1283        label->set_alignment(Gtk::ALIGN_START);
1284    #else
1285        label->set_halign(Gtk::Align::START);
1286    #endif
1287    
1288    #if USE_GTKMM_GRID
1289        table[pageno]->attach(*label, 1, rowno);
1290    #else
1291      table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,      table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,
1292                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1293    #endif
1294    
1295      widget = new Gtk::Entry();      widget = new Gtk::Entry();
1296    
1297    #if USE_GTKMM_GRID
1298        table[pageno]->attach(*widget, 2, rowno);
1299    #else
1300      table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1,      table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1,
1301                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1302    #endif
1303    
1304        rowno++;
1305    }
1306    
1307    void DimRegionEdit::addString(const char* labelText, Gtk::Label*& label,
1308                                  Gtk::Entry*& widget, Gtk::Button*& button)
1309    {
1310        label = new Gtk::Label(Glib::ustring(labelText) + ":");
1311    #if HAS_GTKMM_ALIGNMENT
1312        label->set_alignment(Gtk::ALIGN_START);
1313    #else
1314        label->set_halign(Gtk::Align::START);
1315    #endif
1316    
1317    #if USE_GTKMM_GRID
1318        table[pageno]->attach(*label, 1, rowno);
1319    #else
1320        table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,
1321                              Gtk::FILL, Gtk::SHRINK);
1322    #endif
1323    
1324        widget = new Gtk::Entry();
1325        button = new Gtk::Button();
1326    
1327        HBox* hbox = new HBox;
1328        hbox->pack_start(*widget);
1329        hbox->pack_start(*button, Gtk::PACK_SHRINK);
1330    
1331    #if USE_GTKMM_GRID
1332        table[pageno]->attach(*hbox, 2, rowno);
1333    #else
1334        table[pageno]->attach(*hbox, 2, 3, rowno, rowno + 1,
1335                              Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1336    #endif
1337    
1338      rowno++;      rowno++;
1339  }  }
# Line 578  Gtk::Label* DimRegionEdit::addHeader(con Line 1343  Gtk::Label* DimRegionEdit::addHeader(con
1343      if (firstRowInBlock < rowno - 1)      if (firstRowInBlock < rowno - 1)
1344      {      {
1345          Gtk::Label* filler = new Gtk::Label("    ");          Gtk::Label* filler = new Gtk::Label("    ");
1346    #if USE_GTKMM_GRID
1347            table[pageno]->attach(*filler, 0, firstRowInBlock);
1348    #else
1349          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,
1350                                Gtk::FILL, Gtk::SHRINK);                                Gtk::FILL, Gtk::SHRINK);
1351    #endif
1352      }      }
1353      Glib::ustring str = "<b>";      Glib::ustring str = "<b>";
1354      str += text;      str += text;
1355      str += "</b>";      str += "</b>";
1356      Gtk::Label* label = new Gtk::Label(str);      Gtk::Label* label = new Gtk::Label(str);
1357      label->set_use_markup();      label->set_use_markup();
1358      label->set_alignment(Gtk::ALIGN_LEFT);  #if HAS_GTKMM_ALIGNMENT
1359        label->set_alignment(Gtk::ALIGN_START);
1360    #else
1361        label->set_halign(Gtk::Align::START);
1362    #endif
1363        // on GTKMM 3 there is absolutely no margin by default
1364    #if GTKMM_MAJOR_VERSION >= 3
1365        label->set_margin_top(18);
1366        label->set_margin_bottom(13);
1367    #endif
1368    #if USE_GTKMM_GRID
1369        table[pageno]->attach(*label, 0, rowno, 3);
1370    #else
1371      table[pageno]->attach(*label, 0, 3, rowno, rowno + 1,      table[pageno]->attach(*label, 0, 3, rowno, rowno + 1,
1372                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1373    #endif
1374      rowno++;      rowno++;
1375      firstRowInBlock = rowno;      firstRowInBlock = rowno;
1376      return label;      return label;
1377  }  }
1378    
1379    void DimRegionEdit::on_show_tooltips_changed() {
1380        const bool b = Settings::singleton()->showTooltips;
1381    
1382        buttonSelectSample.set_has_tooltip(b);
1383        buttonNullSampleReference->set_has_tooltip(b);
1384        wSample->set_has_tooltip(b);
1385    
1386        eEG1StateOptions.on_show_tooltips_changed();
1387        eEG2StateOptions.on_show_tooltips_changed();
1388    
1389        set_has_tooltip(b);
1390    }
1391    
1392  void DimRegionEdit::nextPage()  void DimRegionEdit::nextPage()
1393  {  {
1394      if (firstRowInBlock < rowno - 1)      if (firstRowInBlock < rowno - 1)
1395      {      {
1396          Gtk::Label* filler = new Gtk::Label("    ");          Gtk::Label* filler = new Gtk::Label("    ");
1397    #if USE_GTKMM_GRID
1398            table[pageno]->attach(*filler, 0, firstRowInBlock);
1399    #else
1400          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,
1401                                Gtk::FILL, Gtk::SHRINK);                                Gtk::FILL, Gtk::SHRINK);
1402    #endif
1403      }      }
1404      pageno++;      pageno++;
1405      rowno = 0;      rowno = 0;
# Line 609  void DimRegionEdit::nextPage() Line 1408  void DimRegionEdit::nextPage()
1408    
1409  void DimRegionEdit::addProp(BoolEntry& boolentry)  void DimRegionEdit::addProp(BoolEntry& boolentry)
1410  {  {
1411    #if USE_GTKMM_GRID
1412        table[pageno]->attach(boolentry.widget, 1, rowno, 2);
1413    #else
1414      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,
1415                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1416    #endif
1417      rowno++;      rowno++;
1418  }  }
1419    
1420  void DimRegionEdit::addProp(BoolEntryPlus6& boolentry)  void DimRegionEdit::addProp(BoolEntryPlus6& boolentry)
1421  {  {
1422    #if USE_GTKMM_GRID
1423        table[pageno]->attach(boolentry.widget, 1, rowno, 2);
1424    #else
1425      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,
1426                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1427    #endif
1428      rowno++;      rowno++;
1429  }  }
1430    
1431  void DimRegionEdit::addProp(LabelWidget& prop)  void DimRegionEdit::addProp(LabelWidget& prop)
1432  {  {
1433    #if USE_GTKMM_GRID
1434        table[pageno]->attach(prop.label, 1, rowno);
1435        table[pageno]->attach(prop.widget, 2, rowno);
1436    #else
1437      table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1,      table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1,
1438                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1439      table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1,      table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1,
1440                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1441    #endif
1442      rowno++;      rowno++;
1443  }  }
1444    
1445    void DimRegionEdit::addLine(HBox& line)
1446    {
1447    #if USE_GTKMM_GRID
1448        table[pageno]->attach(line, 1, rowno, 2);
1449    #else
1450        table[pageno]->attach(line, 1, 3, rowno, rowno + 1,
1451                              Gtk::FILL, Gtk::SHRINK);
1452    #endif
1453        rowno++;
1454    }
1455    
1456    void DimRegionEdit::addRightHandSide(Gtk::Widget& widget)
1457    {
1458    #if USE_GTKMM_GRID
1459        table[pageno]->attach(widget, 2, rowno);
1460    #else
1461        table[pageno]->attach(widget, 2, 3, rowno, rowno + 1,
1462                              Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1463    #endif
1464        rowno++;
1465    }
1466    
1467  void DimRegionEdit::set_dim_region(gig::DimensionRegion* d)  void DimRegionEdit::set_dim_region(gig::DimensionRegion* d)
1468  {  {
1469      dimregion = d;      dimregion = d;
1470        velocity_curve.set_dim_region(d);
1471        release_curve.set_dim_region(d);
1472        cutoff_curve.set_dim_region(d);
1473        crossfade_curve.set_dim_region(d);
1474        lfo1Graph.set_dim_region(d);
1475        lfo2Graph.set_dim_region(d);
1476        lfo3Graph.set_dim_region(d);
1477    
1478      set_sensitive(d);      set_sensitive(d);
1479      if (!d) return;      if (!d) return;
# Line 652  void DimRegionEdit::set_dim_region(gig:: Line 1492  void DimRegionEdit::set_dim_region(gig::
1492      eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence);      eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence);
1493      eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence);      eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence);
1494      eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence);      eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence);
1495        eEG1StateOptions.checkBoxAttack.set_value(d->EG1Options.AttackCancel);
1496        eEG1StateOptions.checkBoxAttackHold.set_value(d->EG1Options.AttackHoldCancel);
1497        eEG1StateOptions.checkBoxDecay1.set_value(d->EG1Options.Decay1Cancel);
1498        eEG1StateOptions.checkBoxDecay2.set_value(d->EG1Options.Decay2Cancel);
1499        eEG1StateOptions.checkBoxRelease.set_value(d->EG1Options.ReleaseCancel);
1500        eLFO1Wave.set_value(d->LFO1WaveForm);
1501      eLFO1Frequency.set_value(d->LFO1Frequency);      eLFO1Frequency.set_value(d->LFO1Frequency);
1502        eLFO1Phase.set_value(d->LFO1Phase);
1503      eLFO1InternalDepth.set_value(d->LFO1InternalDepth);      eLFO1InternalDepth.set_value(d->LFO1InternalDepth);
1504      eLFO1ControlDepth.set_value(d->LFO1ControlDepth);      eLFO1ControlDepth.set_value(d->LFO1ControlDepth);
1505      eLFO1Controller.set_value(d->LFO1Controller);      eLFO1Controller.set_value(d->LFO1Controller);
# Line 670  void DimRegionEdit::set_dim_region(gig:: Line 1517  void DimRegionEdit::set_dim_region(gig::
1517      eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence);      eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence);
1518      eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence);      eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence);
1519      eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence);      eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence);
1520        eEG2StateOptions.checkBoxAttack.set_value(d->EG2Options.AttackCancel);
1521        eEG2StateOptions.checkBoxAttackHold.set_value(d->EG2Options.AttackHoldCancel);
1522        eEG2StateOptions.checkBoxDecay1.set_value(d->EG2Options.Decay1Cancel);
1523        eEG2StateOptions.checkBoxDecay2.set_value(d->EG2Options.Decay2Cancel);
1524        eEG2StateOptions.checkBoxRelease.set_value(d->EG2Options.ReleaseCancel);
1525        eLFO2Wave.set_value(d->LFO2WaveForm);
1526      eLFO2Frequency.set_value(d->LFO2Frequency);      eLFO2Frequency.set_value(d->LFO2Frequency);
1527        eLFO2Phase.set_value(d->LFO2Phase);
1528      eLFO2InternalDepth.set_value(d->LFO2InternalDepth);      eLFO2InternalDepth.set_value(d->LFO2InternalDepth);
1529      eLFO2ControlDepth.set_value(d->LFO2ControlDepth);      eLFO2ControlDepth.set_value(d->LFO2ControlDepth);
1530      eLFO2Controller.set_value(d->LFO2Controller);      eLFO2Controller.set_value(d->LFO2Controller);
# Line 678  void DimRegionEdit::set_dim_region(gig:: Line 1532  void DimRegionEdit::set_dim_region(gig::
1532      eLFO2Sync.set_value(d->LFO2Sync);      eLFO2Sync.set_value(d->LFO2Sync);
1533      eEG3Attack.set_value(d->EG3Attack);      eEG3Attack.set_value(d->EG3Attack);
1534      eEG3Depth.set_value(d->EG3Depth);      eEG3Depth.set_value(d->EG3Depth);
1535        eLFO3Wave.set_value(d->LFO3WaveForm);
1536      eLFO3Frequency.set_value(d->LFO3Frequency);      eLFO3Frequency.set_value(d->LFO3Frequency);
1537        eLFO3Phase.set_value(d->LFO3Phase);
1538      eLFO3InternalDepth.set_value(d->LFO3InternalDepth);      eLFO3InternalDepth.set_value(d->LFO3InternalDepth);
1539      eLFO3ControlDepth.set_value(d->LFO3ControlDepth);      eLFO3ControlDepth.set_value(d->LFO3ControlDepth);
1540      eLFO3Controller.set_value(d->LFO3Controller);      eLFO3Controller.set_value(d->LFO3Controller);
1541        eLFO3FlipPhase.set_value(d->LFO3FlipPhase);
1542      eLFO3Sync.set_value(d->LFO3Sync);      eLFO3Sync.set_value(d->LFO3Sync);
1543      eVCFEnabled.set_value(d->VCFEnabled);      eVCFEnabled.set_value(d->VCFEnabled);
1544      eVCFType.set_value(d->VCFType);      eVCFType.set_value(d->VCFType);
# Line 707  void DimRegionEdit::set_dim_region(gig:: Line 1564  void DimRegionEdit::set_dim_region(gig::
1564      eCrossfade_out_start.set_value(d->Crossfade.out_start);      eCrossfade_out_start.set_value(d->Crossfade.out_start);
1565      eCrossfade_out_end.set_value(d->Crossfade.out_end);      eCrossfade_out_end.set_value(d->Crossfade.out_end);
1566      ePitchTrack.set_value(d->PitchTrack);      ePitchTrack.set_value(d->PitchTrack);
1567        eSustainReleaseTrigger.set_value(d->SustainReleaseTrigger);
1568        eNoNoteOffReleaseTrigger.set_value(d->NoNoteOffReleaseTrigger);
1569      eDimensionBypass.set_value(d->DimensionBypass);      eDimensionBypass.set_value(d->DimensionBypass);
1570      ePan.set_value(d->Pan);      ePan.set_value(d->Pan);
1571      eSelfMask.set_value(d->SelfMask);      eSelfMask.set_value(d->SelfMask);
# Line 718  void DimRegionEdit::set_dim_region(gig:: Line 1577  void DimRegionEdit::set_dim_region(gig::
1577      eMSDecode.set_value(d->MSDecode);      eMSDecode.set_value(d->MSDecode);
1578      eSampleStartOffset.set_value(d->SampleStartOffset);      eSampleStartOffset.set_value(d->SampleStartOffset);
1579      eUnityNote.set_value(d->UnityNote);      eUnityNote.set_value(d->UnityNote);
1580        // show sample group name
1581        {
1582            Glib::ustring s = "---";
1583            if (d->pSample && d->pSample->GetGroup())
1584                s = d->pSample->GetGroup()->Name;
1585            eSampleGroup.text.set_text(s);
1586        }
1587        // assemble sample format info string
1588        {
1589            Glib::ustring s;
1590            if (d->pSample) {
1591                switch (d->pSample->Channels) {
1592                    case 1: s = _("Mono"); break;
1593                    case 2: s = _("Stereo"); break;
1594                    default:
1595                        s = ToString(d->pSample->Channels) + _(" audio channels");
1596                        break;
1597                }
1598                s += " " + ToString(d->pSample->BitDepth) + " Bits";
1599                s += " " + ToString(d->pSample->SamplesPerSecond/1000) + "."
1600                          + ToString((d->pSample->SamplesPerSecond%1000)/100) + " kHz";
1601            } else {
1602                s = _("No sample assigned to this dimension region.");
1603            }
1604            eSampleFormatInfo.text.set_text(s);
1605        }
1606        // generate sample's memory address pointer string
1607        {
1608            Glib::ustring s;
1609            if (d->pSample) {
1610                char buf[64] = {};
1611                snprintf(buf, sizeof(buf), "%p", d->pSample);
1612                s = buf;
1613            } else {
1614                s = "---";
1615            }
1616            eSampleID.text.set_text(s);
1617        }
1618        // generate raw wave form data CRC-32 checksum string
1619        {
1620            Glib::ustring s = "---";
1621            if (d->pSample) {
1622                char buf[64] = {};
1623                snprintf(buf, sizeof(buf), "%x", d->pSample->GetWaveDataCRC32Checksum());
1624                s = buf;
1625            }
1626            eChecksum.text.set_text(s);
1627        }
1628        buttonSelectSample.set_sensitive(d && d->pSample);
1629      eFineTune.set_value(d->FineTune);      eFineTune.set_value(d->FineTune);
1630      eGain.set_value(d->Gain);      eGain.set_value(d->Gain);
1631      eGainPlus6.set_value(d->Gain);      eGainPlus6.set_value(d->Gain);
# Line 734  void DimRegionEdit::set_dim_region(gig:: Line 1642  void DimRegionEdit::set_dim_region(gig::
1642          d->pSample ? d->pSample->LoopPlayCount : 0);          d->pSample ? d->pSample->LoopPlayCount : 0);
1643      update_model--;      update_model--;
1644    
1645      wSample->set_text(d->pSample ? d->pSample->pInfo->Name.c_str() : _("NULL"));      wSample->set_text(d->pSample ? gig_to_utf8(d->pSample->pInfo->Name) :
1646                          _("NULL"));
1647    
1648      update_loop_elements();      update_loop_elements();
1649      VCFEnabled_toggled();      VCFEnabled_toggled();
# Line 749  void DimRegionEdit::VCFEnabled_toggled() Line 1658  void DimRegionEdit::VCFEnabled_toggled()
1658      eVCFVelocityCurve.set_sensitive(sensitive);      eVCFVelocityCurve.set_sensitive(sensitive);
1659      eVCFVelocityScale.set_sensitive(sensitive);      eVCFVelocityScale.set_sensitive(sensitive);
1660      eVCFVelocityDynamicRange.set_sensitive(sensitive);      eVCFVelocityDynamicRange.set_sensitive(sensitive);
1661        cutoff_curve.set_sensitive(sensitive);
1662      eVCFResonance.set_sensitive(sensitive);      eVCFResonance.set_sensitive(sensitive);
1663      eVCFResonanceController.set_sensitive(sensitive);      eVCFResonanceController.set_sensitive(sensitive);
1664      eVCFKeyboardTracking.set_sensitive(sensitive);      eVCFKeyboardTracking.set_sensitive(sensitive);
# Line 764  void DimRegionEdit::VCFEnabled_toggled() Line 1674  void DimRegionEdit::VCFEnabled_toggled()
1674      eEG2ControllerAttackInfluence.set_sensitive(sensitive);      eEG2ControllerAttackInfluence.set_sensitive(sensitive);
1675      eEG2ControllerDecayInfluence.set_sensitive(sensitive);      eEG2ControllerDecayInfluence.set_sensitive(sensitive);
1676      eEG2ControllerReleaseInfluence.set_sensitive(sensitive);      eEG2ControllerReleaseInfluence.set_sensitive(sensitive);
1677        eEG2StateOptions.set_sensitive(sensitive);
1678      lLFO2->set_sensitive(sensitive);      lLFO2->set_sensitive(sensitive);
1679        eLFO2Wave.set_sensitive(sensitive);
1680      eLFO2Frequency.set_sensitive(sensitive);      eLFO2Frequency.set_sensitive(sensitive);
1681        eLFO2Phase.set_sensitive(sensitive);
1682      eLFO2InternalDepth.set_sensitive(sensitive);      eLFO2InternalDepth.set_sensitive(sensitive);
1683      eLFO2ControlDepth.set_sensitive(sensitive);      eLFO2ControlDepth.set_sensitive(sensitive);
1684      eLFO2Controller.set_sensitive(sensitive);      eLFO2Controller.set_sensitive(sensitive);
1685      eLFO2FlipPhase.set_sensitive(sensitive);      eLFO2FlipPhase.set_sensitive(sensitive);
1686      eLFO2Sync.set_sensitive(sensitive);      eLFO2Sync.set_sensitive(sensitive);
1687        lfo2Graph.set_sensitive(sensitive);
1688      if (sensitive) {      if (sensitive) {
1689          VCFCutoffController_changed();          VCFCutoffController_changed();
1690          VCFResonanceController_changed();          VCFResonanceController_changed();
# Line 841  void DimRegionEdit::AttenuationControlle Line 1755  void DimRegionEdit::AttenuationControlle
1755      eCrossfade_in_end.set_sensitive(hasController);      eCrossfade_in_end.set_sensitive(hasController);
1756      eCrossfade_out_start.set_sensitive(hasController);      eCrossfade_out_start.set_sensitive(hasController);
1757      eCrossfade_out_end.set_sensitive(hasController);      eCrossfade_out_end.set_sensitive(hasController);
1758        crossfade_curve.set_sensitive(hasController);
1759  }  }
1760    
1761  void DimRegionEdit::LFO1Controller_changed()  void DimRegionEdit::LFO1Controller_changed()
# Line 954  void DimRegionEdit::loop_infinite_toggle Line 1869  void DimRegionEdit::loop_infinite_toggle
1869      update_model--;      update_model--;
1870  }  }
1871    
1872  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)
1873    {
1874        bool result = false;
1875        for (std::set<gig::DimensionRegion*>::iterator itDimReg = dimregs.begin();
1876             itDimReg != dimregs.end(); ++itDimReg)
1877        {
1878            result |= set_sample(*itDimReg, sample, copy_sample_unity, copy_sample_tune, copy_sample_loop);
1879        }
1880        return result;
1881    }
1882    
1883    bool DimRegionEdit::set_sample(gig::DimensionRegion* dimreg, gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop)
1884  {  {
1885      if (dimregion) {      if (dimreg) {
1886          //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
1887    
1888          // 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()
1889          //dimreg_to_be_changed_signal.emit(dimregion);          //DimRegionChangeGuard(this, dimregion);
1890    
1891          // make sure stereo samples always are the same in both          // make sure stereo samples always are the same in both
1892          // dimregs in the samplechannel dimension          // dimregs in the samplechannel dimension
1893          int nbDimregs = 1;          int nbDimregs = 1;
1894          gig::DimensionRegion* d[2] = { dimregion, 0 };          gig::DimensionRegion* d[2] = { dimreg, 0 };
1895          if (sample->Channels == 2) {          if (sample->Channels == 2) {
1896              gig::Region* region = dimregion->GetParent();              gig::Region* region = dimreg->GetParent();
1897    
1898              int bitcount = 0;              int bitcount = 0;
1899              int stereo_bit = 0;              int stereo_bit = 0;
# Line 982  bool DimRegionEdit::set_sample(gig::Samp Line 1908  bool DimRegionEdit::set_sample(gig::Samp
1908              if (stereo_bit) {              if (stereo_bit) {
1909                  int dimregno;                  int dimregno;
1910                  for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) {                  for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) {
1911                      if (region->pDimensionRegions[dimregno] == dimregion) {                      if (region->pDimensionRegions[dimregno] == dimreg) {
1912                          break;                          break;
1913                      }                      }
1914                  }                  }
# Line 992  bool DimRegionEdit::set_sample(gig::Samp Line 1918  bool DimRegionEdit::set_sample(gig::Samp
1918              }              }
1919          }          }
1920    
1921          gig::Sample* oldref = dimregion->pSample;          gig::Sample* oldref = dimreg->pSample;
1922    
1923          for (int i = 0 ; i < nbDimregs ; i++) {          for (int i = 0 ; i < nbDimregs ; i++) {
1924              d[i]->pSample = sample;              d[i]->pSample = sample;
1925    
1926              // copy sample information from Sample to DimensionRegion              // copy sample information from Sample to DimensionRegion
1927                if (copy_sample_unity)
1928              d[i]->UnityNote = sample->MIDIUnityNote;                  d[i]->UnityNote = sample->MIDIUnityNote;
1929              d[i]->FineTune = sample->FineTune;              if (copy_sample_tune)
1930                    d[i]->FineTune = sample->FineTune;
1931              int loops = sample->Loops ? 1 : 0;              if (copy_sample_loop) {
1932              while (d[i]->SampleLoops > loops) {                  int loops = sample->Loops ? 1 : 0;
1933                  d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]);                  while (d[i]->SampleLoops > loops) {
1934              }                      d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]);
1935              while (d[i]->SampleLoops < sample->Loops) {                  }
1936                  DLS::sample_loop_t loop;                  while (d[i]->SampleLoops < sample->Loops) {
1937                  d[i]->AddSampleLoop(&loop);                      DLS::sample_loop_t loop;
1938              }                      d[i]->AddSampleLoop(&loop);
1939              if (loops) {                  }
1940                  d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t);                  if (loops) {
1941                  d[i]->pSampleLoops[0].LoopType = sample->LoopType;                      d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t);
1942                  d[i]->pSampleLoops[0].LoopStart = sample->LoopStart;                      d[i]->pSampleLoops[0].LoopType = sample->LoopType;
1943                  d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1;                      d[i]->pSampleLoops[0].LoopStart = sample->LoopStart;
1944                        d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1;
1945                    }
1946              }              }
1947          }          }
1948    
1949          // update ui          // update ui
1950          update_model++;          update_model++;
1951          wSample->set_text(dimregion->pSample->pInfo->Name);          wSample->set_text(gig_to_utf8(dimreg->pSample->pInfo->Name));
1952          eUnityNote.set_value(dimregion->UnityNote);          eUnityNote.set_value(dimreg->UnityNote);
1953          eFineTune.set_value(dimregion->FineTune);          eFineTune.set_value(dimreg->FineTune);
1954          eSampleLoopEnabled.set_value(dimregion->SampleLoops);          eSampleLoopEnabled.set_value(dimreg->SampleLoops);
1955          update_loop_elements();          update_loop_elements();
1956          update_model--;          update_model--;
1957    
1958          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);  
1959          return true;          return true;
1960      }      }
1961      return false;      return false;
# Line 1048  sigc::signal<void, gig::Sample*/*old*/, Line 1974  sigc::signal<void, gig::Sample*/*old*/,
1974  }  }
1975    
1976    
1977  void DimRegionEdit::set_UnityNote(gig::DimensionRegion* d, uint8_t value)  void DimRegionEdit::set_UnityNote(gig::DimensionRegion& d, uint8_t value)
1978  {  {
1979      d->UnityNote = value;      d.UnityNote = value;
1980  }  }
1981    
1982  void DimRegionEdit::set_FineTune(gig::DimensionRegion* d, int16_t value)  void DimRegionEdit::set_FineTune(gig::DimensionRegion& d, int16_t value)
1983  {  {
1984      d->FineTune = value;      d.FineTune = value;
1985  }  }
1986    
1987  void DimRegionEdit::set_Crossfade_in_start(gig::DimensionRegion* d,  void DimRegionEdit::set_Crossfade_in_start(gig::DimensionRegion& d,
1988                                             uint8_t value)                                             uint8_t value)
1989  {  {
1990      d->Crossfade.in_start = value;      d.Crossfade.in_start = value;
1991      if (d->Crossfade.in_end < value) set_Crossfade_in_end(d, value);      if (d.Crossfade.in_end < value) set_Crossfade_in_end(d, value);
1992  }  }
1993    
1994  void DimRegionEdit::set_Crossfade_in_end(gig::DimensionRegion* d,  void DimRegionEdit::set_Crossfade_in_end(gig::DimensionRegion& d,
1995                                           uint8_t value)                                           uint8_t value)
1996  {  {
1997      d->Crossfade.in_end = value;      d.Crossfade.in_end = value;
1998      if (value < d->Crossfade.in_start) set_Crossfade_in_start(d, value);      if (value < d.Crossfade.in_start) set_Crossfade_in_start(d, 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_Crossfade_out_start(gig::DimensionRegion* d,  void DimRegionEdit::set_Crossfade_out_start(gig::DimensionRegion& d,
2003                                              uint8_t value)                                              uint8_t value)
2004  {  {
2005      d->Crossfade.out_start = value;      d.Crossfade.out_start = value;
2006      if (value < d->Crossfade.in_end) set_Crossfade_in_end(d, value);      if (value < d.Crossfade.in_end) set_Crossfade_in_end(d, value);
2007      if (value > d->Crossfade.out_end) set_Crossfade_out_end(d, value);      if (value > d.Crossfade.out_end) set_Crossfade_out_end(d, value);
2008  }  }
2009    
2010  void DimRegionEdit::set_Crossfade_out_end(gig::DimensionRegion* d,  void DimRegionEdit::set_Crossfade_out_end(gig::DimensionRegion& d,
2011                                            uint8_t value)                                            uint8_t value)
2012  {  {
2013      d->Crossfade.out_end = value;      d.Crossfade.out_end = value;
2014      if (value < d->Crossfade.out_start) set_Crossfade_out_start(d, value);      if (value < d.Crossfade.out_start) set_Crossfade_out_start(d, value);
2015  }  }
2016    
2017  void DimRegionEdit::set_Gain(gig::DimensionRegion* d, int32_t value)  void DimRegionEdit::set_Gain(gig::DimensionRegion& d, int32_t value)
2018  {  {
2019      d->SetGain(value);      d.SetGain(value);
2020  }  }
2021    
2022  void DimRegionEdit::set_LoopEnabled(gig::DimensionRegion* d, bool value)  void DimRegionEdit::set_LoopEnabled(gig::DimensionRegion& d, bool value)
2023  {  {
2024      if (value) {      if (value) {
2025          // create a new sample loop in case there is none yet          // create a new sample loop in case there is none yet
2026          if (!d->SampleLoops) {          if (!d.SampleLoops) {
2027                DimRegionChangeGuard(this, &d);
2028    
2029              DLS::sample_loop_t loop;              DLS::sample_loop_t loop;
2030              loop.LoopType = gig::loop_type_normal;              loop.LoopType = gig::loop_type_normal;
2031              // loop the whole sample by default              // loop the whole sample by default
2032              loop.LoopStart  = 0;              loop.LoopStart  = 0;
2033              loop.LoopLength =              loop.LoopLength =
2034                  (d->pSample) ? d->pSample->SamplesTotal : 0;                  (d.pSample) ? d.pSample->SamplesTotal : 0;
2035              dimreg_to_be_changed_signal.emit(d);              d.AddSampleLoop(&loop);
             d->AddSampleLoop(&loop);  
             dimreg_changed_signal.emit(d);  
2036          }          }
2037      } else {      } else {
2038          if (d->SampleLoops) {          if (d.SampleLoops) {
2039              dimreg_to_be_changed_signal.emit(d);              DimRegionChangeGuard(this, &d);
2040    
2041              // delete ALL existing sample loops              // delete ALL existing sample loops
2042              while (d->SampleLoops) {              while (d.SampleLoops) {
2043                  d->DeleteSampleLoop(&d->pSampleLoops[0]);                  d.DeleteSampleLoop(&d.pSampleLoops[0]);
2044              }              }
             dimreg_changed_signal.emit(d);  
2045          }          }
2046      }      }
2047  }  }
2048    
2049  void DimRegionEdit::set_LoopType(gig::DimensionRegion* d, uint32_t value)  void DimRegionEdit::set_LoopType(gig::DimensionRegion& d, uint32_t value)
2050  {  {
2051      if (d->SampleLoops) d->pSampleLoops[0].LoopType = value;      if (d.SampleLoops) d.pSampleLoops[0].LoopType = value;
2052  }  }
2053    
2054  void DimRegionEdit::set_LoopStart(gig::DimensionRegion* d, uint32_t value)  void DimRegionEdit::set_LoopStart(gig::DimensionRegion& d, uint32_t value)
2055  {  {
2056      if (d->SampleLoops) {      if (d.SampleLoops) {
2057          d->pSampleLoops[0].LoopStart =          d.pSampleLoops[0].LoopStart =
2058              d->pSample ?              d.pSample ?
2059              std::min(value, uint32_t(d->pSample->SamplesTotal -              std::min(value, uint32_t(d.pSample->SamplesTotal -
2060                                       d->pSampleLoops[0].LoopLength)) :                                       d.pSampleLoops[0].LoopLength)) :
2061              0;              0;
2062      }      }
2063  }  }
2064    
2065  void DimRegionEdit::set_LoopLength(gig::DimensionRegion* d, uint32_t value)  void DimRegionEdit::set_LoopLength(gig::DimensionRegion& d, uint32_t value)
2066  {  {
2067      if (d->SampleLoops) {      if (d.SampleLoops) {
2068          d->pSampleLoops[0].LoopLength =          d.pSampleLoops[0].LoopLength =
2069              d->pSample ?              d.pSample ?
2070              std::min(value, uint32_t(d->pSample->SamplesTotal -              std::min(value, uint32_t(d.pSample->SamplesTotal -
2071                                       d->pSampleLoops[0].LoopStart)) :                                       d.pSampleLoops[0].LoopStart)) :
2072              0;              0;
2073      }      }
2074  }  }
2075    
2076  void DimRegionEdit::set_LoopInfinite(gig::DimensionRegion* d, bool value)  void DimRegionEdit::set_LoopInfinite(gig::DimensionRegion& d, bool value)
2077  {  {
2078      if (d->pSample) {      if (d.pSample) {
2079          if (value) d->pSample->LoopPlayCount = 0;          if (value) d.pSample->LoopPlayCount = 0;
2080          else if (d->pSample->LoopPlayCount == 0) d->pSample->LoopPlayCount = 1;          else if (d.pSample->LoopPlayCount == 0) d.pSample->LoopPlayCount = 1;
2081      }      }
2082  }  }
2083    
2084  void DimRegionEdit::set_LoopPlayCount(gig::DimensionRegion* d, uint32_t value)  void DimRegionEdit::set_LoopPlayCount(gig::DimensionRegion& d, uint32_t value)
2085  {  {
2086      if (d->pSample) d->pSample->LoopPlayCount = value;      if (d.pSample) d.pSample->LoopPlayCount = value;
2087    }
2088    
2089    void DimRegionEdit::nullOutSampleReference() {
2090        if (!dimregion) return;
2091        gig::Sample* oldref = dimregion->pSample;
2092        if (!oldref) return;
2093    
2094        DimRegionChangeGuard(this, dimregion);
2095    
2096        // in case currently assigned sample is a stereo one, then remove both
2097        // references (expected to be due to a "stereo dimension")
2098        gig::DimensionRegion* d[2] = { dimregion, NULL };
2099        if (oldref->Channels == 2) {
2100            gig::Region* region = dimregion->GetParent();
2101            {
2102                int stereo_bit = 0;
2103                int bitcount = 0;
2104                for (int dim = 0 ; dim < region->Dimensions ; dim++) {
2105                    if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) {
2106                        stereo_bit = 1 << bitcount;
2107                        break;
2108                    }
2109                    bitcount += region->pDimensionDefinitions[dim].bits;
2110                }
2111    
2112                if (stereo_bit) {
2113                    int dimregno;
2114                    for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) {
2115                        if (region->pDimensionRegions[dimregno] == dimregion) {
2116                            break;
2117                        }
2118                    }
2119                    d[0] = region->pDimensionRegions[dimregno & ~stereo_bit];
2120                    d[1] = region->pDimensionRegions[dimregno | stereo_bit];
2121                }
2122            }
2123        }
2124    
2125        if (d[0]) d[0]->pSample = NULL;
2126        if (d[1]) d[1]->pSample = NULL;
2127    
2128        // update UI elements
2129        set_dim_region(dimregion);
2130    
2131        sample_ref_changed_signal.emit(oldref, NULL);
2132    }
2133    
2134    void DimRegionEdit::onButtonSelectSamplePressed() {
2135        if (!dimregion) return;
2136        if (!dimregion->pSample) return;
2137        select_sample_signal.emit(dimregion->pSample);
2138    }
2139    
2140    sigc::signal<void, gig::Sample*>& DimRegionEdit::signal_select_sample() {
2141        return select_sample_signal;
2142  }  }

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

  ViewVC Help
Powered by ViewVC