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

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

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

revision 1533 by persson, Sat Dec 1 10:21:07 2007 UTC revision 3408 by schoenebeck, Fri Jan 19 19:17:41 2018 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006, 2007 Andreas Persson   * Copyright (C) 2006-2017 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    VelocityCurve::VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t)) :
32        getter(getter), dimreg(0) {
33        set_size_request(80, 80);
34    }
35    
36    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
37    bool VelocityCurve::on_expose_event(GdkEventExpose* e) {
38        const Cairo::RefPtr<Cairo::Context>& cr =
39            get_window()->create_cairo_context();
40    #if 0
41    }
42    #endif
43    #else
44    bool VelocityCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) {
45    #endif
46        if (dimreg) {
47            int w = get_width();
48            int h = get_height();
49    
50            for (int pass = 0 ; pass < 2 ; pass++) {
51                for (double x = 0 ; x <= w ; x++) {
52                    int vel = int(x * (127 - 1e-10) / w + 1);
53                    double y = (1 - (dimreg->*getter)(vel)) * (h - 3) + 1.5;
54    
55                    if (x < 1e-10) {
56                        cr->move_to(x, y);
57                    } else {
58                        cr->line_to(x, y);
59                    }
60                }
61                if (pass == 0) {
62                    cr->line_to(w, h);
63                    cr->line_to(0, h);
64                    cr->set_source_rgba(0.5, 0.44, 1.0, is_sensitive() ? 0.2 : 0.1);
65                    cr->fill();
66                } else {
67                    cr->set_line_width(3);
68                    cr->set_source_rgba(0.5, 0.44, 1.0, is_sensitive() ? 1.0 : 0.3);
69                    cr->stroke();
70                }
71            }
72        }
73        return true;
74    }
75    
76    
77    CrossfadeCurve::CrossfadeCurve() : dimreg(0) {
78        set_size_request(280, 80);
79    }
80    
81    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
82    bool CrossfadeCurve::on_expose_event(GdkEventExpose* e) {
83        const Cairo::RefPtr<Cairo::Context>& cr =
84            get_window()->create_cairo_context();
85    #if 0
86    }
87    #endif
88    #else
89    bool CrossfadeCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) {
90    #endif
91        if (dimreg) {
92            cr->translate(1.5, 0);
93    
94            // first, draw curves for the other layers
95            gig::Region* region = dimreg->GetParent();
96            int dimregno;
97            for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) {
98                if (region->pDimensionRegions[dimregno] == dimreg) {
99                    break;
100                }
101            }
102            int bitcount = 0;
103            for (int dim = 0 ; dim < region->Dimensions ; dim++) {
104                if (region->pDimensionDefinitions[dim].dimension ==
105                    gig::dimension_layer) {
106                    int mask =
107                        ~(((1 << region->pDimensionDefinitions[dim].bits) - 1) <<
108                          bitcount);
109                    int c = dimregno & mask; // mask away the layer dimension
110    
111                    for (int i = 0 ; i < region->pDimensionDefinitions[dim].zones ;
112                         i++) {
113                        gig::DimensionRegion* d =
114                            region->pDimensionRegions[c + (i << bitcount)];
115                        if (d != dimreg) {
116                            draw_one_curve(cr, d, false);
117                        }
118                    }
119                    break;
120                }
121                bitcount += region->pDimensionDefinitions[dim].bits;
122            }
123    
124            // then, draw the currently selected layer
125            draw_one_curve(cr, dimreg, is_sensitive());
126        }
127        return true;
128    }
129    
130    void CrossfadeCurve::draw_one_curve(const Cairo::RefPtr<Cairo::Context>& cr,
131                                        const gig::DimensionRegion* d,
132                                        bool sensitive) {
133        int w = get_width();
134        int h = get_height();
135    
136        if (d->Crossfade.out_end) {
137            for (int pass = 0 ; pass < 2 ; pass++) {
138                cr->move_to(d->Crossfade.in_start / 127.0 * (w - 3), h);
139                cr->line_to(d->Crossfade.in_end / 127.0 * (w - 3), 1.5);
140                cr->line_to(d->Crossfade.out_start / 127.0 * (w - 3), 1.5);
141                cr->line_to(d->Crossfade.out_end / 127.0 * (w - 3), h);
142    
143                if (pass == 0) {
144                    cr->set_source_rgba(0.5, 0.44, 1.0, sensitive ? 0.2 : 0.1);
145                    cr->fill();
146                } else {
147                    cr->set_line_width(3);
148                    cr->set_source_rgba(0.5, 0.44, 1.0, sensitive ? 1.0 : 0.3);
149                    cr->stroke();
150                }
151            }
152        }
153    }
154    
155    
156    EGStateOptions::EGStateOptions() : HBox(),
157        label(_("May be cancelled: ")),
158        checkBoxAttack(_("Attack")),
159        checkBoxAttackHold(_("Attack Hold")),
160        checkBoxDecay1(_("Decay 1")),
161        checkBoxDecay2(_("Decay 2")),
162        checkBoxRelease(_("Release"))
163    {
164        set_spacing(6);
165    
166        pack_start(label);
167        pack_start(checkBoxAttack, Gtk::PACK_SHRINK);
168        pack_start(checkBoxAttackHold, Gtk::PACK_SHRINK);
169        pack_start(checkBoxDecay1, Gtk::PACK_SHRINK);
170        pack_start(checkBoxDecay2, Gtk::PACK_SHRINK);
171        pack_start(checkBoxRelease, Gtk::PACK_SHRINK);
172    
173        checkBoxAttack.set_tooltip_text(_(
174            "If checked: a note-off aborts the 'attack' stage."
175        ));
176        checkBoxAttackHold.set_tooltip_text(_(
177            "If checked: a note-off aborts the 'attack hold' stage."
178        ));
179        checkBoxDecay1.set_tooltip_text(_(
180            "If checked: a note-off aborts the 'decay 1' stage."
181        ));
182        checkBoxDecay2.set_tooltip_text(_(
183            "If checked: a note-off aborts the 'decay 2' stage."
184        ));
185        checkBoxRelease.set_tooltip_text(_(
186            "If checked: a note-on reverts back from the 'release' stage."
187        ));
188    }
189    
190    
191  DimRegionEdit::DimRegionEdit() :  DimRegionEdit::DimRegionEdit() :
192      eEG1PreAttack("Pre-attack", 0, 100, 2),      velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation),
193      eEG1Attack("Attack", 0, 60, 3),      release_curve(&gig::DimensionRegion::GetVelocityRelease),
194      eEG1Decay1("Decay 1", 0.005, 60, 3),      cutoff_curve(&gig::DimensionRegion::GetVelocityCutoff),
195      eEG1Decay2("Decay 2", 0, 60, 3),      eEG1PreAttack(_("Pre-attack Level (%)"), 0, 100, 2),
196      eEG1InfiniteSustain("Infinite sustain"),      eEG1Attack(_("Attack Time (seconds)"), 0, 60, 3),
197      eEG1Sustain("Sustain", 0, 100, 2),      eEG1Decay1(_("Decay 1 Time (seconds)"), 0.005, 60, 3),
198      eEG1Release("Release", 0, 60, 3),      eEG1Decay2(_("Decay 2 Time (seconds)"), 0, 60, 3),
199      eEG1Hold("Hold"),      eEG1InfiniteSustain(_("Infinite sustain")),
200      eEG1Controller("Controller"),      eEG1Sustain(_("Sustain Level (%)"), 0, 100, 2),
201      eEG1ControllerInvert("Controller invert"),      eEG1Release(_("Release Time (seconds)"), 0, 60, 3),
202      eEG1ControllerAttackInfluence("Controller attack influence", 0, 3),      eEG1Hold(_("Hold Attack Stage until Loop End")),
203      eEG1ControllerDecayInfluence("Controller decay influence", 0, 3),      eEG1Controller(_("Controller")),
204      eEG1ControllerReleaseInfluence("Controller release influence", 0, 3),      eEG1ControllerInvert(_("Controller invert")),
205      eLFO1Frequency("Frequency", 0.1, 10, 2),      eEG1ControllerAttackInfluence(_("Controller attack influence"), 0, 3),
206      eLFO1InternalDepth("Internal depth", 0, 1200),      eEG1ControllerDecayInfluence(_("Controller decay influence"), 0, 3),
207      eLFO1ControlDepth("Control depth", 0, 1200),      eEG1ControllerReleaseInfluence(_("Controller release influence"), 0, 3),
208      eLFO1Controller("Controller"),      eLFO1Frequency(_("Frequency"), 0.1, 10, 2),
209      eLFO1FlipPhase("Flip phase"),      eLFO1InternalDepth(_("Internal depth"), 0, 1200),
210      eLFO1Sync("Sync"),      eLFO1ControlDepth(_("Control depth"), 0, 1200),
211      eEG2PreAttack("Pre-attack", 0, 100, 2),      eLFO1Controller(_("Controller")),
212      eEG2Attack("Attack", 0, 60, 3),      eLFO1FlipPhase(_("Flip phase")),
213      eEG2Decay1("Decay 1", 0.005, 60, 3),      eLFO1Sync(_("Sync")),
214      eEG2Decay2("Decay 2", 0, 60, 3),      eEG2PreAttack(_("Pre-attack Level (%)"), 0, 100, 2),
215      eEG2InfiniteSustain("Infinite sustain"),      eEG2Attack(_("Attack Time (seconds)"), 0, 60, 3),
216      eEG2Sustain("Sustain", 0, 100, 2),      eEG2Decay1(_("Decay 1 Time (seconds)"), 0.005, 60, 3),
217      eEG2Release("Release", 0, 60, 3),      eEG2Decay2(_("Decay 2 Time (seconds)"), 0, 60, 3),
218      eEG2Controller("Controller"),      eEG2InfiniteSustain(_("Infinite sustain")),
219      eEG2ControllerInvert("Controller invert"),      eEG2Sustain(_("Sustain Level (%)"), 0, 100, 2),
220      eEG2ControllerAttackInfluence("Controller attack influence", 0, 3),      eEG2Release(_("Release Time (seconds)"), 0, 60, 3),
221      eEG2ControllerDecayInfluence("Controller decay influence", 0, 3),      eEG2Controller(_("Controller")),
222      eEG2ControllerReleaseInfluence("Controller release influence", 0, 3),      eEG2ControllerInvert(_("Controller invert")),
223      eLFO2Frequency("Frequency", 0.1, 10, 2),      eEG2ControllerAttackInfluence(_("Controller attack influence"), 0, 3),
224      eLFO2InternalDepth("Internal depth", 0, 1200),      eEG2ControllerDecayInfluence(_("Controller decay influence"), 0, 3),
225      eLFO2ControlDepth("Control depth", 0, 1200),      eEG2ControllerReleaseInfluence(_("Controller release influence"), 0, 3),
226      eLFO2Controller("Controller"),      eLFO2Frequency(_("Frequency"), 0.1, 10, 2),
227      eLFO2FlipPhase("Flip phase"),      eLFO2InternalDepth(_("Internal depth"), 0, 1200),
228      eLFO2Sync("Sync"),      eLFO2ControlDepth(_("Control depth"), 0, 1200),
229      eEG3Attack("Attack", 0, 10, 3),      eLFO2Controller(_("Controller")),
230      eEG3Depth("Depth", -1200, 1200),      eLFO2FlipPhase(_("Flip phase")),
231      eLFO3Frequency("Frequency", 0.1, 10, 2),      eLFO2Sync(_("Sync")),
232      eLFO3InternalDepth("Internal depth", 0, 1200),      eEG3Attack(_("Attack"), 0, 10, 3),
233      eLFO3ControlDepth("Control depth", 0, 1200),      eEG3Depth(_("Depth"), -1200, 1200),
234      eLFO3Controller("Controller"),      eLFO3Frequency(_("Frequency"), 0.1, 10, 2),
235      eLFO3Sync("Sync"),      eLFO3InternalDepth(_("Internal depth"), 0, 1200),
236      eVCFEnabled("Enabled"),      eLFO3ControlDepth(_("Control depth"), 0, 1200),
237      eVCFType("Type"),      eLFO3Controller(_("Controller")),
238      eVCFCutoffController("Cutoff controller"),      eLFO3Sync(_("Sync")),
239      eVCFCutoffControllerInvert("Cutoff controller invert"),      eVCFEnabled(_("Enabled")),
240      eVCFCutoff("Cutoff"),      eVCFType(_("Type")),
241      eVCFVelocityCurve("Velocity curve"),      eVCFCutoffController(_("Cutoff controller")),
242      eVCFVelocityScale("Velocity scale"),      eVCFCutoffControllerInvert(_("Cutoff controller invert")),
243      eVCFVelocityDynamicRange("Velocity dynamic range", 0, 4),      eVCFCutoff(_("Cutoff")),
244      eVCFResonance("Resonance"),      eVCFVelocityCurve(_("Velocity curve")),
245      eVCFResonanceDynamic("Resonance dynamic"),      eVCFVelocityScale(_("Velocity scale")),
246      eVCFResonanceController("Resonance controller"),      eVCFVelocityDynamicRange(_("Velocity dynamic range"), 0, 4),
247      eVCFKeyboardTracking("Keyboard tracking"),      eVCFResonance(_("Resonance")),
248      eVCFKeyboardTrackingBreakpoint("Keyboard tracking breakpoint"),      eVCFResonanceDynamic(_("Resonance dynamic")),
249      eVelocityResponseCurve("Velocity response curve"),      eVCFResonanceController(_("Resonance controller")),
250      eVelocityResponseDepth("Velocity response depth", 0, 4),      eVCFKeyboardTracking(_("Keyboard tracking")),
251      eVelocityResponseCurveScaling("Velocity response curve scaling"),      eVCFKeyboardTrackingBreakpoint(_("Keyboard tracking breakpoint")),
252      eReleaseVelocityResponseCurve("Release velocity response curve"),      eVelocityResponseCurve(_("Velocity response curve")),
253      eReleaseVelocityResponseDepth("Release velocity response depth", 0, 4),      eVelocityResponseDepth(_("Velocity response depth"), 0, 4),
254      eReleaseTriggerDecay("Release trigger decay", 0, 8),      eVelocityResponseCurveScaling(_("Velocity response curve scaling")),
255      eCrossfade_in_start("Crossfade-in start"),      eReleaseVelocityResponseCurve(_("Release velocity response curve")),
256      eCrossfade_in_end("Crossfade-in end"),      eReleaseVelocityResponseDepth(_("Release velocity response depth"), 0, 4),
257      eCrossfade_out_start("Crossfade-out start"),      eReleaseTriggerDecay(_("Release trigger decay"), 0, 8),
258      eCrossfade_out_end("Crossfade-out end"),      eCrossfade_in_start(_("Crossfade-in start")),
259      ePitchTrack("Pitch track"),      eCrossfade_in_end(_("Crossfade-in end")),
260      eDimensionBypass("Dimension bypass"),      eCrossfade_out_start(_("Crossfade-out start")),
261      ePan("Pan", -64, 63),      eCrossfade_out_end(_("Crossfade-out end")),
262      eSelfMask("Self mask"),      ePitchTrack(_("Pitch track")),
263      eAttenuationController("Attenuation controller"),      eDimensionBypass(_("Dimension bypass")),
264      eInvertAttenuationController("Invert attenuation controller"),      ePan(_("Pan"), -64, 63),
265      eAttenuationControllerThreshold("Attenuation controller threshold"),      eSelfMask(_("Kill lower velocity voices (a.k.a \"Self mask\")")),
266      eChannelOffset("Channel offset", 0, 9),      eAttenuationController(_("Attenuation controller")),
267      eSustainDefeat("Sustain defeat"),      eInvertAttenuationController(_("Invert attenuation controller")),
268      eMSDecode("MS decode"),      eAttenuationControllerThreshold(_("Attenuation controller threshold")),
269      eSampleStartOffset("Sample start offset", 0, 2000),      eChannelOffset(_("Channel offset"), 0, 9),
270      eUnityNote("Unity note"),      eSustainDefeat(_("Ignore Hold Pedal (a.k.a. \"Sustain defeat\")")),
271      eFineTune("Fine tune", -49, 50),      eMSDecode(_("Decode Mid/Side Recordings")),
272      eGain("Gain", -96, 0, 2, -655360),      eSampleStartOffset(_("Sample start offset"), 0, 2000),
273      eGainPlus6("Gain +6dB", eGain, 6 * -655360),      eUnityNote(_("Unity note")),
274      eSampleLoopEnabled("Enabled"),      eSampleGroup(_("Sample Group")),
275      eSampleLoopStart("Loop start positon"),      eSampleFormatInfo(_("Sample Format")),
276      eSampleLoopLength("Loop size"),      eSampleID("Sample ID"),
277      eSampleLoopType("Loop type"),      eChecksum("Wave Data CRC-32"),
278      eSampleLoopInfinite("Infinite loop"),      eFineTune(_("Fine tune"), -49, 50),
279      eSampleLoopPlayCount("Playback count", 1),      eGain(_("Gain"), -96, 0, 2, -655360),
280        eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360),
281        eSampleLoopEnabled(_("Enabled")),
282        eSampleLoopStart(_("Loop start position")),
283        eSampleLoopLength(_("Loop size")),
284        eSampleLoopType(_("Loop type")),
285        eSampleLoopInfinite(_("Infinite loop")),
286        eSampleLoopPlayCount(_("Playback count"), 1),
287        buttonSelectSample(UNICODE_LEFT_ARROW + "  " + _("Select Sample")),
288      update_model(0)      update_model(0)
289  {  {
290        // make synthesis parameter page tabs scrollable
291        // (workaround for GTK3: default theme uses huge tabs which breaks layout)
292        set_scrollable();
293    
294      connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack);      connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack);
295      connect(eEG1Attack, &gig::DimensionRegion::EG1Attack);      connect(eEG1Attack, &gig::DimensionRegion::EG1Attack);
296      connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1);      connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1);
# Line 128  DimRegionEdit::DimRegionEdit() : Line 307  DimRegionEdit::DimRegionEdit() :
307              &gig::DimensionRegion::EG1ControllerDecayInfluence);              &gig::DimensionRegion::EG1ControllerDecayInfluence);
308      connect(eEG1ControllerReleaseInfluence,      connect(eEG1ControllerReleaseInfluence,
309              &gig::DimensionRegion::EG1ControllerReleaseInfluence);              &gig::DimensionRegion::EG1ControllerReleaseInfluence);
310        {
311            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.AttackCancel));
312            connect(eEG1StateOptions.checkBoxAttack, mp.pmember);
313        }
314        {
315            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.AttackHoldCancel));
316            connect(eEG1StateOptions.checkBoxAttackHold, mp.pmember);
317        }
318        {
319            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.Decay1Cancel));
320            connect(eEG1StateOptions.checkBoxDecay1, mp.pmember);
321        }
322        {
323            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.Decay2Cancel));
324            connect(eEG1StateOptions.checkBoxDecay2, mp.pmember);
325        }
326        {
327            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.ReleaseCancel));
328            connect(eEG1StateOptions.checkBoxRelease, mp.pmember);
329        }
330      connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency);      connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency);
331      connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth);      connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth);
332      connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth);      connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth);
# Line 149  DimRegionEdit::DimRegionEdit() : Line 348  DimRegionEdit::DimRegionEdit() :
348              &gig::DimensionRegion::EG2ControllerDecayInfluence);              &gig::DimensionRegion::EG2ControllerDecayInfluence);
349      connect(eEG2ControllerReleaseInfluence,      connect(eEG2ControllerReleaseInfluence,
350              &gig::DimensionRegion::EG2ControllerReleaseInfluence);              &gig::DimensionRegion::EG2ControllerReleaseInfluence);
351        {
352            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.AttackCancel));
353            connect(eEG2StateOptions.checkBoxAttack, mp.pmember);
354        }
355        {
356            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.AttackHoldCancel));
357            connect(eEG2StateOptions.checkBoxAttackHold, mp.pmember);
358        }
359        {
360            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.Decay1Cancel));
361            connect(eEG2StateOptions.checkBoxDecay1, mp.pmember);
362        }
363        {
364            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.Decay2Cancel));
365            connect(eEG2StateOptions.checkBoxDecay2, mp.pmember);
366        }
367        {
368            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.ReleaseCancel));
369            connect(eEG2StateOptions.checkBoxRelease, mp.pmember);
370        }
371      connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency);      connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency);
372      connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth);      connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth);
373      connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth);      connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth);
# Line 219  DimRegionEdit::DimRegionEdit() : Line 438  DimRegionEdit::DimRegionEdit() :
438      connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength);      connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength);
439      connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite);      connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite);
440      connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount);      connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount);
441        buttonSelectSample.signal_clicked().connect(
442            sigc::mem_fun(*this, &DimRegionEdit::onButtonSelectSamplePressed)
443        );
444    
445      for (int i = 0 ; i < 7 ; i++) {      for (int i = 0 ; i < 7 ; i++) {
446    #if USE_GTKMM_GRID
447            table[i] = new Gtk::Grid;
448            table[i]->set_column_spacing(7);
449    #else
450          table[i] = new Gtk::Table(3, 1);          table[i] = new Gtk::Table(3, 1);
451          table[i]->set_col_spacings(7);          table[i]->set_col_spacings(7);
452    #endif
453    
454    // on Gtk 3 there is absolutely no margin by default
455    #if GTKMM_MAJOR_VERSION >= 3
456    # if GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION < 12
457            table[i]->set_margin_left(12);
458            table[i]->set_margin_right(12);
459    # else
460            table[i]->set_margin_start(12);
461            table[i]->set_margin_end(12);
462    # endif
463    #endif
464      }      }
465    
466      // set tooltips      // set tooltips
467      eUnityNote.set_tip(      eUnityNote.set_tip(
468          _("Note this sample is associated with (a.k.a. 'root note')")          _("Note this sample is associated with (a.k.a. 'root note')")
469      );      );
470        buttonSelectSample.set_tooltip_text(
471            _("Selects the sample of this dimension region on the left hand side's sample tree view.")
472        );
473      eSampleStartOffset.set_tip(_("Sample position at which playback should be started"));      eSampleStartOffset.set_tip(_("Sample position at which playback should be started"));
474      ePan.set_tip(_("Stereo balance (left/right)"));      ePan.set_tip(_("Stereo balance (left/right)"));
475      eChannelOffset.set_tip(      eChannelOffset.set_tip(
# Line 259  DimRegionEdit::DimRegionEdit() : Line 500  DimRegionEdit::DimRegionEdit() :
500            "Caution: this setting is stored on Sample side, thus is shared "            "Caution: this setting is stored on Sample side, thus is shared "
501            "among all dimension regions that use this sample!")            "among all dimension regions that use this sample!")
502      );      );
503        
504        eEG1PreAttack.set_tip(
505            "Very first level this EG starts with. It rises then in Attack Time "
506            "seconds from this initial level to 100%."
507        );
508        eEG1Attack.set_tip(
509            "Duration of the EG's Attack stage, which raises its level from "
510            "Pre-Attack Level to 100%."
511        );
512        eEG1Hold.set_tip(
513           "On looped sounds, enabling this will cause the Decay 1 stage not to "
514           "enter before the loop has been passed one time."
515        );
516        eAttenuationController.set_tip(_(
517            "If you are not using the 'Layer' dimension, then this controller "
518            "simply alters the volume. If you are using the 'Layer' dimension, "
519            "then this controller is controlling the crossfade between Layers in "
520            "real-time."
521        ));
522    
523        eLFO1Sync.set_tip(
524            "If not checked, every voice will use its own LFO instance, which "
525            "causes voices triggered at different points in time to have different "
526            "LFO levels. By enabling 'Sync' here the voices will instead use and "
527            "share one single LFO, causing all voices to have the same LFO level, "
528            "no matter when the individual notes have been triggered."
529        );
530        eLFO2Sync.set_tip(
531            "If not checked, every voice will use its own LFO instance, which "
532            "causes voices triggered at different points in time to have different "
533            "LFO levels. By enabling 'Sync' here the voices will instead use and "
534            "share one single LFO, causing all voices to have the same LFO level, "
535            "no matter when the individual notes have been triggered."
536        );
537        eLFO3Sync.set_tip(
538            "If not checked, every voice will use its own LFO instance, which "
539            "causes voices triggered at different points in time to have different "
540            "LFO levels. By enabling 'Sync' here the voices will instead use and "
541            "share one single LFO, causing all voices to have the same LFO level, "
542            "no matter when the individual notes have been triggered."
543        );
544        eLFO1FlipPhase.set_tip(
545           "Inverts the LFO's generated wave vertically."
546        );
547        eLFO2FlipPhase.set_tip(
548           "Inverts the LFO's generated wave vertically."
549        );
550    
551      pageno = 0;      pageno = 0;
552      rowno = 0;      rowno = 0;
553      firstRowInBlock = 0;      firstRowInBlock = 0;
554    
555      addHeader(_("Mandatory Settings"));      addHeader(_("Mandatory Settings"));
556      addString("Sample", lSample, wSample);      addString(_("Sample"), lSample, wSample, buttonNullSampleReference);
557        buttonNullSampleReference->set_label("X");
558        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."));
559        buttonNullSampleReference->signal_clicked().connect(
560            sigc::mem_fun(*this, &DimRegionEdit::nullOutSampleReference)
561        );
562      //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);
563      tooltips.set_tip(*wSample, _("Drop a sample here"));  #ifdef OLD_TOOLTIPS
564        tooltips.set_tip(*wSample, _("Drag & drop a sample here"));
565    #else
566        wSample->set_tooltip_text(_("Drag & drop a sample here"));
567    #endif
568      addProp(eUnityNote);      addProp(eUnityNote);
569        addProp(eSampleGroup);
570        addProp(eSampleFormatInfo);
571        addProp(eSampleID);
572        addProp(eChecksum);
573        addRightHandSide(buttonSelectSample);
574      addHeader(_("Optional Settings"));      addHeader(_("Optional Settings"));
575      addProp(eSampleStartOffset);      addProp(eSampleStartOffset);
576      addProp(eChannelOffset);      addProp(eChannelOffset);
577      addHeader("Loops");      addHeader(_("Loops"));
578      addProp(eSampleLoopEnabled);      addProp(eSampleLoopEnabled);
579      addProp(eSampleLoopStart);      addProp(eSampleLoopStart);
580      addProp(eSampleLoopLength);      addProp(eSampleLoopLength);
581      {      {
582          const char* choices[] = { "normal", "bidirectional", "backward", 0 };          const char* choices[] = { _("normal"), _("bidirectional"), _("backward"), 0 };
583          static const uint32_t values[] = {          static const uint32_t values[] = {
584              gig::loop_type_normal,              gig::loop_type_normal,
585              gig::loop_type_bidirectional,              gig::loop_type_bidirectional,
# Line 298  DimRegionEdit::DimRegionEdit() : Line 600  DimRegionEdit::DimRegionEdit() :
600      addHeader(_("Amplitude Envelope (EG1)"));      addHeader(_("Amplitude Envelope (EG1)"));
601      addProp(eEG1PreAttack);      addProp(eEG1PreAttack);
602      addProp(eEG1Attack);      addProp(eEG1Attack);
603        addProp(eEG1Hold);
604      addProp(eEG1Decay1);      addProp(eEG1Decay1);
605      addProp(eEG1Decay2);      addProp(eEG1Decay2);
606      addProp(eEG1InfiniteSustain);      addProp(eEG1InfiniteSustain);
607      addProp(eEG1Sustain);      addProp(eEG1Sustain);
608      addProp(eEG1Release);      addProp(eEG1Release);
     addProp(eEG1Hold);  
609      addProp(eEG1Controller);      addProp(eEG1Controller);
610      addProp(eEG1ControllerInvert);      addProp(eEG1ControllerInvert);
611      addProp(eEG1ControllerAttackInfluence);      addProp(eEG1ControllerAttackInfluence);
612      addProp(eEG1ControllerDecayInfluence);      addProp(eEG1ControllerDecayInfluence);
613      addProp(eEG1ControllerReleaseInfluence);      addProp(eEG1ControllerReleaseInfluence);
614        addLine(eEG1StateOptions);
615    
616      nextPage();      nextPage();
617    
# Line 317  DimRegionEdit::DimRegionEdit() : Line 620  DimRegionEdit::DimRegionEdit() :
620      addProp(eLFO1InternalDepth);      addProp(eLFO1InternalDepth);
621      addProp(eLFO1ControlDepth);      addProp(eLFO1ControlDepth);
622      {      {
623          const char* choices[] = { "internal", "modwheel", "breath",          const char* choices[] = { _("internal"), _("modwheel"), _("breath"),
624                                    "internal+modwheel", "internal+breath", 0 };                                    _("internal+modwheel"), _("internal+breath"), 0 };
625          static const gig::lfo1_ctrl_t values[] = {          static const gig::lfo1_ctrl_t values[] = {
626              gig::lfo1_ctrl_internal,              gig::lfo1_ctrl_internal,
627              gig::lfo1_ctrl_modwheel,              gig::lfo1_ctrl_modwheel,
# Line 331  DimRegionEdit::DimRegionEdit() : Line 634  DimRegionEdit::DimRegionEdit() :
634      addProp(eLFO1Controller);      addProp(eLFO1Controller);
635      addProp(eLFO1FlipPhase);      addProp(eLFO1FlipPhase);
636      addProp(eLFO1Sync);      addProp(eLFO1Sync);
637      addHeader("Crossfade");      addHeader(_("Crossfade"));
638      addProp(eAttenuationController);      addProp(eAttenuationController);
639      addProp(eInvertAttenuationController);      addProp(eInvertAttenuationController);
640      addProp(eAttenuationControllerThreshold);      addProp(eAttenuationControllerThreshold);
# Line 340  DimRegionEdit::DimRegionEdit() : Line 643  DimRegionEdit::DimRegionEdit() :
643      addProp(eCrossfade_out_start);      addProp(eCrossfade_out_start);
644      addProp(eCrossfade_out_end);      addProp(eCrossfade_out_end);
645    
646        Gtk::Frame* frame = new Gtk::Frame;
647        frame->add(crossfade_curve);
648        // on Gtk 3 there is no margin at all by default
649    #if GTKMM_MAJOR_VERSION >= 3
650        frame->set_margin_top(12);
651        frame->set_margin_bottom(12);
652    #endif
653    #if USE_GTKMM_GRID
654        table[pageno]->attach(*frame, 1, rowno, 2);
655    #else
656        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
657                              Gtk::SHRINK, Gtk::SHRINK);
658    #endif
659        rowno++;
660    
661        eCrossfade_in_start.signal_value_changed().connect(
662            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
663        eCrossfade_in_end.signal_value_changed().connect(
664            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
665        eCrossfade_out_start.signal_value_changed().connect(
666            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
667        eCrossfade_out_end.signal_value_changed().connect(
668            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
669    
670      nextPage();      nextPage();
671    
672      addHeader(_("General Filter Settings"));      addHeader(_("General Filter Settings"));
673      addProp(eVCFEnabled);      addProp(eVCFEnabled);
674      {      {
675          const char* choices[] = { "lowpass", "lowpassturbo", "bandpass",          const char* choices[] = { _("lowpass"), _("lowpassturbo"), _("bandpass"),
676                                    "highpass", "bandreject", 0 };                                    _("highpass"), _("bandreject"), 0 };
677          static const gig::vcf_type_t values[] = {          static const gig::vcf_type_t values[] = {
678              gig::vcf_type_lowpass,              gig::vcf_type_lowpass,
679              gig::vcf_type_lowpassturbo,              gig::vcf_type_lowpassturbo,
# Line 358  DimRegionEdit::DimRegionEdit() : Line 685  DimRegionEdit::DimRegionEdit() :
685      }      }
686      addProp(eVCFType);      addProp(eVCFType);
687      {      {
688          const char* choices[] = { "none", "none2", "modwheel", "effect1", "effect2",          const char* choices[] = { _("none"), _("none2"), _("modwheel"), _("effect1"), _("effect2"),
689                                    "breath", "foot", "sustainpedal", "softpedal",                                    _("breath"), _("foot"), _("sustainpedal"), _("softpedal"),
690                                    "genpurpose7", "genpurpose8", "aftertouch", 0 };                                    _("genpurpose7"), _("genpurpose8"), _("aftertouch"), 0 };
691          static const gig::vcf_cutoff_ctrl_t values[] = {          static const gig::vcf_cutoff_ctrl_t values[] = {
692              gig::vcf_cutoff_ctrl_none,              gig::vcf_cutoff_ctrl_none,
693              gig::vcf_cutoff_ctrl_none2,              gig::vcf_cutoff_ctrl_none2,
# Line 380  DimRegionEdit::DimRegionEdit() : Line 707  DimRegionEdit::DimRegionEdit() :
707      addProp(eVCFCutoffController);      addProp(eVCFCutoffController);
708      addProp(eVCFCutoffControllerInvert);      addProp(eVCFCutoffControllerInvert);
709      addProp(eVCFCutoff);      addProp(eVCFCutoff);
710      const char* curve_type_texts[] = { "nonlinear", "linear", "special", 0 };      const char* curve_type_texts[] = { _("nonlinear"), _("linear"), _("special"), 0 };
711      static const gig::curve_type_t curve_type_values[] = {      static const gig::curve_type_t curve_type_values[] = {
712          gig::curve_type_nonlinear,          gig::curve_type_nonlinear,
713          gig::curve_type_linear,          gig::curve_type_linear,
# Line 390  DimRegionEdit::DimRegionEdit() : Line 717  DimRegionEdit::DimRegionEdit() :
717      addProp(eVCFVelocityCurve);      addProp(eVCFVelocityCurve);
718      addProp(eVCFVelocityScale);      addProp(eVCFVelocityScale);
719      addProp(eVCFVelocityDynamicRange);      addProp(eVCFVelocityDynamicRange);
720    
721        eVCFCutoffController.signal_value_changed().connect(
722            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
723        eVCFVelocityCurve.signal_value_changed().connect(
724            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
725        eVCFVelocityScale.signal_value_changed().connect(
726            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
727        eVCFVelocityDynamicRange.signal_value_changed().connect(
728            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
729    
730        frame = new Gtk::Frame;
731        frame->add(cutoff_curve);
732        // on Gtk 3 there is no margin at all by default
733    #if GTKMM_MAJOR_VERSION >= 3
734        frame->set_margin_top(12);
735        frame->set_margin_bottom(12);
736    #endif
737    #if USE_GTKMM_GRID
738        table[pageno]->attach(*frame, 1, rowno, 2);
739    #else
740        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
741                              Gtk::SHRINK, Gtk::SHRINK);
742    #endif
743        rowno++;
744    
745      addProp(eVCFResonance);      addProp(eVCFResonance);
746      addProp(eVCFResonanceDynamic);      addProp(eVCFResonanceDynamic);
747      {      {
748          const char* choices[] = { "none", "genpurpose3", "genpurpose4",          const char* choices[] = { _("none"), _("genpurpose3"), _("genpurpose4"),
749                                    "genpurpose5", "genpurpose6", 0 };                                    _("genpurpose5"), _("genpurpose6"), 0 };
750          static const gig::vcf_res_ctrl_t values[] = {          static const gig::vcf_res_ctrl_t values[] = {
751              gig::vcf_res_ctrl_none,              gig::vcf_res_ctrl_none,
752              gig::vcf_res_ctrl_genpurpose3,              gig::vcf_res_ctrl_genpurpose3,
# Line 410  DimRegionEdit::DimRegionEdit() : Line 762  DimRegionEdit::DimRegionEdit() :
762    
763      nextPage();      nextPage();
764    
765      addHeader(_("Filter Cutoff Envelope (EG2)"));      lEG2 = addHeader(_("Filter Cutoff Envelope (EG2)"));
766      addProp(eEG2PreAttack);      addProp(eEG2PreAttack);
767      addProp(eEG2Attack);      addProp(eEG2Attack);
768      addProp(eEG2Decay1);      addProp(eEG2Decay1);
# Line 423  DimRegionEdit::DimRegionEdit() : Line 775  DimRegionEdit::DimRegionEdit() :
775      addProp(eEG2ControllerAttackInfluence);      addProp(eEG2ControllerAttackInfluence);
776      addProp(eEG2ControllerDecayInfluence);      addProp(eEG2ControllerDecayInfluence);
777      addProp(eEG2ControllerReleaseInfluence);      addProp(eEG2ControllerReleaseInfluence);
778      addHeader(_("Filter Cutoff Oscillator (LFO2)"));      addLine(eEG2StateOptions);
779        lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)"));
780      addProp(eLFO2Frequency);      addProp(eLFO2Frequency);
781      addProp(eLFO2InternalDepth);      addProp(eLFO2InternalDepth);
782      addProp(eLFO2ControlDepth);      addProp(eLFO2ControlDepth);
783      {      {
784          const char* choices[] = { "internal", "modwheel", "foot",          const char* choices[] = { _("internal"), _("modwheel"), _("foot"),
785                                    "internal+modwheel", "internal+foot", 0 };                                    _("internal+modwheel"), _("internal+foot"), 0 };
786          static const gig::lfo2_ctrl_t values[] = {          static const gig::lfo2_ctrl_t values[] = {
787              gig::lfo2_ctrl_internal,              gig::lfo2_ctrl_internal,
788              gig::lfo2_ctrl_modwheel,              gig::lfo2_ctrl_modwheel,
# Line 456  DimRegionEdit::DimRegionEdit() : Line 809  DimRegionEdit::DimRegionEdit() :
809      addProp(eLFO3InternalDepth);      addProp(eLFO3InternalDepth);
810      addProp(eLFO3ControlDepth);      addProp(eLFO3ControlDepth);
811      {      {
812          const char* choices[] = { "internal", "modwheel", "aftertouch",          const char* choices[] = { _("internal"), _("modwheel"), _("aftertouch"),
813                                    "internal+modwheel", "internal+aftertouch", 0 };                                    _("internal+modwheel"), _("internal+aftertouch"), 0 };
814          static const gig::lfo3_ctrl_t values[] = {          static const gig::lfo3_ctrl_t values[] = {
815              gig::lfo3_ctrl_internal,              gig::lfo3_ctrl_internal,
816              gig::lfo3_ctrl_modwheel,              gig::lfo3_ctrl_modwheel,
# Line 472  DimRegionEdit::DimRegionEdit() : Line 825  DimRegionEdit::DimRegionEdit() :
825    
826      nextPage();      nextPage();
827    
828        addHeader(_("Velocity Response"));
829      eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values);      eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values);
830      addProp(eVelocityResponseCurve);      addProp(eVelocityResponseCurve);
831      addProp(eVelocityResponseDepth);      addProp(eVelocityResponseDepth);
832      addProp(eVelocityResponseCurveScaling);      addProp(eVelocityResponseCurveScaling);
833    
834        eVelocityResponseCurve.signal_value_changed().connect(
835            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
836        eVelocityResponseDepth.signal_value_changed().connect(
837            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
838        eVelocityResponseCurveScaling.signal_value_changed().connect(
839            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
840    
841        frame = new Gtk::Frame;
842        frame->add(velocity_curve);
843        // on Gtk 3 there is no margin at all by default
844    #if GTKMM_MAJOR_VERSION >= 3
845        frame->set_margin_top(12);
846        frame->set_margin_bottom(12);
847    #endif
848    #if USE_GTKMM_GRID
849        table[pageno]->attach(*frame, 1, rowno, 2);
850    #else
851        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
852                              Gtk::SHRINK, Gtk::SHRINK);
853    #endif
854        rowno++;
855    
856        addHeader(_("Release Velocity Response"));
857      eReleaseVelocityResponseCurve.set_choices(curve_type_texts,      eReleaseVelocityResponseCurve.set_choices(curve_type_texts,
858                                                curve_type_values);                                                curve_type_values);
859      addProp(eReleaseVelocityResponseCurve);      addProp(eReleaseVelocityResponseCurve);
860      addProp(eReleaseVelocityResponseDepth);      addProp(eReleaseVelocityResponseDepth);
861    
862        eReleaseVelocityResponseCurve.signal_value_changed().connect(
863            sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));
864        eReleaseVelocityResponseDepth.signal_value_changed().connect(
865            sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));
866        frame = new Gtk::Frame;
867        frame->add(release_curve);
868        // on Gtk 3 there is no margin at all by default
869    #if GTKMM_MAJOR_VERSION >= 3
870        frame->set_margin_top(12);
871        frame->set_margin_bottom(12);
872    #endif
873    #if USE_GTKMM_GRID
874        table[pageno]->attach(*frame, 1, rowno, 2);
875    #else
876        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
877                              Gtk::SHRINK, Gtk::SHRINK);
878    #endif
879        rowno++;
880    
881      addProp(eReleaseTriggerDecay);      addProp(eReleaseTriggerDecay);
882      {      {
883          const char* choices[] = { "none", "effect4depth", "effect5depth", 0 };          const char* choices[] = { _("none"), _("effect4depth"), _("effect5depth"), 0 };
884          static const gig::dim_bypass_ctrl_t values[] = {          static const gig::dim_bypass_ctrl_t values[] = {
885              gig::dim_bypass_ctrl_none,              gig::dim_bypass_ctrl_none,
886              gig::dim_bypass_ctrl_94,              gig::dim_bypass_ctrl_94,
# Line 491  DimRegionEdit::DimRegionEdit() : Line 889  DimRegionEdit::DimRegionEdit() :
889          eDimensionBypass.set_choices(choices, values);          eDimensionBypass.set_choices(choices, values);
890      }      }
891      addProp(eDimensionBypass);      addProp(eDimensionBypass);
892        eSelfMask.widget.set_tooltip_text(_(
893            "If enabled: new notes with higher velocity value will stop older "
894            "notes with lower velocity values, that way you can save voices that "
895            "would barely be audible. This is also useful for certain drum sounds."
896        ));
897      addProp(eSelfMask);      addProp(eSelfMask);
898        eSustainDefeat.widget.set_tooltip_text(_(
899            "If enabled: sustain pedal will not hold a note. This way you can use "
900            "the sustain pedal for other purposes, for example to switch among "
901            "dimension regions."
902        ));
903      addProp(eSustainDefeat);      addProp(eSustainDefeat);
904        eMSDecode.widget.set_tooltip_text(_(
905            "Defines if Mid/Side Recordings should be decoded. Mid/Side Recordings "
906            "are an alternative way to record sounds in stereo. The sampler needs "
907            "to decode such samples to actually make use of them. Note: this "
908            "feature is currently not supported by LinuxSampler."
909        ));
910      addProp(eMSDecode);      addProp(eMSDecode);
911    
912      nextPage();      nextPage();
# Line 539  DimRegionEdit::DimRegionEdit() : Line 953  DimRegionEdit::DimRegionEdit() :
953      eSampleLoopInfinite.signal_value_changed().connect(      eSampleLoopInfinite.signal_value_changed().connect(
954          sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled));          sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled));
955    
956      append_page(*table[0], "Sample");      append_page(*table[0], _("Sample"));
957      append_page(*table[1], "Amplitude (1)");      append_page(*table[1], _("Amplitude (1)"));
958      append_page(*table[2], "Amplitude (2)");      append_page(*table[2], _("Amplitude (2)"));
959      append_page(*table[3], "Filter (1)");      append_page(*table[3], _("Filter (1)"));
960      append_page(*table[4], "Filter (2)");      append_page(*table[4], _("Filter (2)"));
961      append_page(*table[5], "Pitch");      append_page(*table[5], _("Pitch"));
962      append_page(*table[6], "Misc");      append_page(*table[6], _("Misc"));
963  }  }
964    
965  DimRegionEdit::~DimRegionEdit()  DimRegionEdit::~DimRegionEdit()
# Line 556  void DimRegionEdit::addString(const char Line 970  void DimRegionEdit::addString(const char
970                                Gtk::Entry*& widget)                                Gtk::Entry*& widget)
971  {  {
972      label = new Gtk::Label(Glib::ustring(labelText) + ":");      label = new Gtk::Label(Glib::ustring(labelText) + ":");
973      label->set_alignment(Gtk::ALIGN_LEFT);  #if HAS_GTKMM_ALIGNMENT
974        label->set_alignment(Gtk::ALIGN_START);
975    #else
976        label->set_halign(Gtk::Align::START);
977    #endif
978    
979    #if USE_GTKMM_GRID
980        table[pageno]->attach(*label, 1, rowno);
981    #else
982      table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,      table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,
983                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
984    #endif
985    
986      widget = new Gtk::Entry();      widget = new Gtk::Entry();
987    
988    #if USE_GTKMM_GRID
989        table[pageno]->attach(*widget, 2, rowno);
990    #else
991      table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1,      table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1,
992                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
993    #endif
994    
995      rowno++;      rowno++;
996  }  }
997    
998  void DimRegionEdit::addHeader(const char* text)  void DimRegionEdit::addString(const char* labelText, Gtk::Label*& label,
999                                  Gtk::Entry*& widget, Gtk::Button*& button)
1000    {
1001        label = new Gtk::Label(Glib::ustring(labelText) + ":");
1002    #if HAS_GTKMM_ALIGNMENT
1003        label->set_alignment(Gtk::ALIGN_START);
1004    #else
1005        label->set_halign(Gtk::Align::START);
1006    #endif
1007    
1008    #if USE_GTKMM_GRID
1009        table[pageno]->attach(*label, 1, rowno);
1010    #else
1011        table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,
1012                              Gtk::FILL, Gtk::SHRINK);
1013    #endif
1014    
1015        widget = new Gtk::Entry();
1016        button = new Gtk::Button();
1017    
1018        HBox* hbox = new HBox;
1019        hbox->pack_start(*widget);
1020        hbox->pack_start(*button, Gtk::PACK_SHRINK);
1021    
1022    #if USE_GTKMM_GRID
1023        table[pageno]->attach(*hbox, 2, rowno);
1024    #else
1025        table[pageno]->attach(*hbox, 2, 3, rowno, rowno + 1,
1026                              Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1027    #endif
1028    
1029        rowno++;
1030    }
1031    
1032    Gtk::Label* DimRegionEdit::addHeader(const char* text)
1033  {  {
1034      if (firstRowInBlock < rowno - 1)      if (firstRowInBlock < rowno - 1)
1035      {      {
1036          Gtk::Label* filler = new Gtk::Label("    ");          Gtk::Label* filler = new Gtk::Label("    ");
1037    #if USE_GTKMM_GRID
1038            table[pageno]->attach(*filler, 0, firstRowInBlock);
1039    #else
1040          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,
1041                                Gtk::FILL, Gtk::SHRINK);                                Gtk::FILL, Gtk::SHRINK);
1042    #endif
1043      }      }
1044      Glib::ustring str = "<b>";      Glib::ustring str = "<b>";
1045      str += text;      str += text;
1046      str += "</b>";      str += "</b>";
1047      Gtk::Label* label = new Gtk::Label(str);      Gtk::Label* label = new Gtk::Label(str);
1048      label->set_use_markup();      label->set_use_markup();
1049      label->set_alignment(Gtk::ALIGN_LEFT);  #if HAS_GTKMM_ALIGNMENT
1050        label->set_alignment(Gtk::ALIGN_START);
1051    #else
1052        label->set_halign(Gtk::Align::START);
1053    #endif
1054        // on GTKMM 3 there is absolutely no margin by default
1055    #if GTKMM_MAJOR_VERSION >= 3
1056        label->set_margin_top(18);
1057        label->set_margin_bottom(13);
1058    #endif
1059    #if USE_GTKMM_GRID
1060        table[pageno]->attach(*label, 0, rowno, 3);
1061    #else
1062      table[pageno]->attach(*label, 0, 3, rowno, rowno + 1,      table[pageno]->attach(*label, 0, 3, rowno, rowno + 1,
1063                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1064    #endif
1065      rowno++;      rowno++;
1066      firstRowInBlock = rowno;      firstRowInBlock = rowno;
1067        return label;
1068  }  }
1069    
1070  void DimRegionEdit::nextPage()  void DimRegionEdit::nextPage()
# Line 594  void DimRegionEdit::nextPage() Line 1072  void DimRegionEdit::nextPage()
1072      if (firstRowInBlock < rowno - 1)      if (firstRowInBlock < rowno - 1)
1073      {      {
1074          Gtk::Label* filler = new Gtk::Label("    ");          Gtk::Label* filler = new Gtk::Label("    ");
1075    #if USE_GTKMM_GRID
1076            table[pageno]->attach(*filler, 0, firstRowInBlock);
1077    #else
1078          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,
1079                                Gtk::FILL, Gtk::SHRINK);                                Gtk::FILL, Gtk::SHRINK);
1080    #endif
1081      }      }
1082      pageno++;      pageno++;
1083      rowno = 0;      rowno = 0;
# Line 604  void DimRegionEdit::nextPage() Line 1086  void DimRegionEdit::nextPage()
1086    
1087  void DimRegionEdit::addProp(BoolEntry& boolentry)  void DimRegionEdit::addProp(BoolEntry& boolentry)
1088  {  {
1089    #if USE_GTKMM_GRID
1090        table[pageno]->attach(boolentry.widget, 1, rowno, 2);
1091    #else
1092      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,
1093                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1094    #endif
1095      rowno++;      rowno++;
1096  }  }
1097    
1098  void DimRegionEdit::addProp(BoolEntryPlus6& boolentry)  void DimRegionEdit::addProp(BoolEntryPlus6& boolentry)
1099  {  {
1100    #if USE_GTKMM_GRID
1101        table[pageno]->attach(boolentry.widget, 1, rowno, 2);
1102    #else
1103      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,
1104                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1105    #endif
1106      rowno++;      rowno++;
1107  }  }
1108    
1109  void DimRegionEdit::addProp(LabelWidget& prop)  void DimRegionEdit::addProp(LabelWidget& prop)
1110  {  {
1111    #if USE_GTKMM_GRID
1112        table[pageno]->attach(prop.label, 1, rowno);
1113        table[pageno]->attach(prop.widget, 2, rowno);
1114    #else
1115      table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1,      table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1,
1116                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1117      table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1,      table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1,
1118                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1119    #endif
1120      rowno++;      rowno++;
1121  }  }
1122    
1123    void DimRegionEdit::addLine(HBox& line)
1124    {
1125    #if USE_GTKMM_GRID
1126        table[pageno]->attach(line, 1, rowno, 2);
1127    #else
1128        table[pageno]->attach(line, 1, 3, rowno, rowno + 1,
1129                              Gtk::FILL, Gtk::SHRINK);
1130    #endif
1131        rowno++;
1132    }
1133    
1134    void DimRegionEdit::addRightHandSide(Gtk::Widget& widget)
1135    {
1136    #if USE_GTKMM_GRID
1137        table[pageno]->attach(widget, 2, rowno);
1138    #else
1139        table[pageno]->attach(widget, 2, 3, rowno, rowno + 1,
1140                              Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1141    #endif
1142        rowno++;
1143    }
1144    
1145  void DimRegionEdit::set_dim_region(gig::DimensionRegion* d)  void DimRegionEdit::set_dim_region(gig::DimensionRegion* d)
1146  {  {
1147      dimregion = d;      dimregion = d;
1148        velocity_curve.set_dim_region(d);
1149        release_curve.set_dim_region(d);
1150        cutoff_curve.set_dim_region(d);
1151        crossfade_curve.set_dim_region(d);
1152    
1153      set_sensitive(d);      set_sensitive(d);
1154      if (!d) return;      if (!d) return;
# Line 647  void DimRegionEdit::set_dim_region(gig:: Line 1167  void DimRegionEdit::set_dim_region(gig::
1167      eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence);      eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence);
1168      eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence);      eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence);
1169      eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence);      eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence);
1170        eEG1StateOptions.checkBoxAttack.set_value(d->EG1Options.AttackCancel);
1171        eEG1StateOptions.checkBoxAttackHold.set_value(d->EG1Options.AttackHoldCancel);
1172        eEG1StateOptions.checkBoxDecay1.set_value(d->EG1Options.Decay1Cancel);
1173        eEG1StateOptions.checkBoxDecay2.set_value(d->EG1Options.Decay2Cancel);
1174        eEG1StateOptions.checkBoxRelease.set_value(d->EG1Options.ReleaseCancel);
1175      eLFO1Frequency.set_value(d->LFO1Frequency);      eLFO1Frequency.set_value(d->LFO1Frequency);
1176      eLFO1InternalDepth.set_value(d->LFO1InternalDepth);      eLFO1InternalDepth.set_value(d->LFO1InternalDepth);
1177      eLFO1ControlDepth.set_value(d->LFO1ControlDepth);      eLFO1ControlDepth.set_value(d->LFO1ControlDepth);
# Line 665  void DimRegionEdit::set_dim_region(gig:: Line 1190  void DimRegionEdit::set_dim_region(gig::
1190      eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence);      eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence);
1191      eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence);      eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence);
1192      eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence);      eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence);
1193        eEG2StateOptions.checkBoxAttack.set_value(d->EG2Options.AttackCancel);
1194        eEG2StateOptions.checkBoxAttackHold.set_value(d->EG2Options.AttackHoldCancel);
1195        eEG2StateOptions.checkBoxDecay1.set_value(d->EG2Options.Decay1Cancel);
1196        eEG2StateOptions.checkBoxDecay2.set_value(d->EG2Options.Decay2Cancel);
1197        eEG2StateOptions.checkBoxRelease.set_value(d->EG2Options.ReleaseCancel);
1198      eLFO2Frequency.set_value(d->LFO2Frequency);      eLFO2Frequency.set_value(d->LFO2Frequency);
1199      eLFO2InternalDepth.set_value(d->LFO2InternalDepth);      eLFO2InternalDepth.set_value(d->LFO2InternalDepth);
1200      eLFO2ControlDepth.set_value(d->LFO2ControlDepth);      eLFO2ControlDepth.set_value(d->LFO2ControlDepth);
# Line 713  void DimRegionEdit::set_dim_region(gig:: Line 1243  void DimRegionEdit::set_dim_region(gig::
1243      eMSDecode.set_value(d->MSDecode);      eMSDecode.set_value(d->MSDecode);
1244      eSampleStartOffset.set_value(d->SampleStartOffset);      eSampleStartOffset.set_value(d->SampleStartOffset);
1245      eUnityNote.set_value(d->UnityNote);      eUnityNote.set_value(d->UnityNote);
1246        // show sample group name
1247        {
1248            Glib::ustring s = "---";
1249            if (d->pSample && d->pSample->GetGroup())
1250                s = d->pSample->GetGroup()->Name;
1251            eSampleGroup.text.set_text(s);
1252        }
1253        // assemble sample format info string
1254        {
1255            Glib::ustring s;
1256            if (d->pSample) {
1257                switch (d->pSample->Channels) {
1258                    case 1: s = _("Mono"); break;
1259                    case 2: s = _("Stereo"); break;
1260                    default:
1261                        s = ToString(d->pSample->Channels) + _(" audio channels");
1262                        break;
1263                }
1264                s += " " + ToString(d->pSample->BitDepth) + " Bits";
1265                s += " " + ToString(d->pSample->SamplesPerSecond/1000) + "."
1266                          + ToString((d->pSample->SamplesPerSecond%1000)/100) + " kHz";
1267            } else {
1268                s = _("No sample assigned to this dimension region.");
1269            }
1270            eSampleFormatInfo.text.set_text(s);
1271        }
1272        // generate sample's memory address pointer string
1273        {
1274            Glib::ustring s;
1275            if (d->pSample) {
1276                char buf[64] = {};
1277                snprintf(buf, sizeof(buf), "%p", d->pSample);
1278                s = buf;
1279            } else {
1280                s = "---";
1281            }
1282            eSampleID.text.set_text(s);
1283        }
1284        // generate raw wave form data CRC-32 checksum string
1285        {
1286            Glib::ustring s = "---";
1287            if (d->pSample) {
1288                char buf[64] = {};
1289                snprintf(buf, sizeof(buf), "%x", d->pSample->GetWaveDataCRC32Checksum());
1290                s = buf;
1291            }
1292            eChecksum.text.set_text(s);
1293        }
1294        buttonSelectSample.set_sensitive(d && d->pSample);
1295      eFineTune.set_value(d->FineTune);      eFineTune.set_value(d->FineTune);
1296      eGain.set_value(d->Gain);      eGain.set_value(d->Gain);
1297      eGainPlus6.set_value(d->Gain);      eGainPlus6.set_value(d->Gain);
# Line 729  void DimRegionEdit::set_dim_region(gig:: Line 1308  void DimRegionEdit::set_dim_region(gig::
1308          d->pSample ? d->pSample->LoopPlayCount : 0);          d->pSample ? d->pSample->LoopPlayCount : 0);
1309      update_model--;      update_model--;
1310    
1311      wSample->set_text(d->pSample ? d->pSample->pInfo->Name.c_str() : "NULL");      wSample->set_text(d->pSample ? gig_to_utf8(d->pSample->pInfo->Name) :
1312                          _("NULL"));
1313    
1314      update_loop_elements();      update_loop_elements();
1315      VCFEnabled_toggled();      VCFEnabled_toggled();
# Line 744  void DimRegionEdit::VCFEnabled_toggled() Line 1324  void DimRegionEdit::VCFEnabled_toggled()
1324      eVCFVelocityCurve.set_sensitive(sensitive);      eVCFVelocityCurve.set_sensitive(sensitive);
1325      eVCFVelocityScale.set_sensitive(sensitive);      eVCFVelocityScale.set_sensitive(sensitive);
1326      eVCFVelocityDynamicRange.set_sensitive(sensitive);      eVCFVelocityDynamicRange.set_sensitive(sensitive);
1327        cutoff_curve.set_sensitive(sensitive);
1328      eVCFResonance.set_sensitive(sensitive);      eVCFResonance.set_sensitive(sensitive);
1329      eVCFResonanceController.set_sensitive(sensitive);      eVCFResonanceController.set_sensitive(sensitive);
1330      eVCFKeyboardTracking.set_sensitive(sensitive);      eVCFKeyboardTracking.set_sensitive(sensitive);
1331      eVCFKeyboardTrackingBreakpoint.set_sensitive(sensitive);      eVCFKeyboardTrackingBreakpoint.set_sensitive(sensitive);
1332        lEG2->set_sensitive(sensitive);
1333      eEG2PreAttack.set_sensitive(sensitive);      eEG2PreAttack.set_sensitive(sensitive);
1334      eEG2Attack.set_sensitive(sensitive);      eEG2Attack.set_sensitive(sensitive);
1335      eEG2Decay1.set_sensitive(sensitive);      eEG2Decay1.set_sensitive(sensitive);
# Line 758  void DimRegionEdit::VCFEnabled_toggled() Line 1340  void DimRegionEdit::VCFEnabled_toggled()
1340      eEG2ControllerAttackInfluence.set_sensitive(sensitive);      eEG2ControllerAttackInfluence.set_sensitive(sensitive);
1341      eEG2ControllerDecayInfluence.set_sensitive(sensitive);      eEG2ControllerDecayInfluence.set_sensitive(sensitive);
1342      eEG2ControllerReleaseInfluence.set_sensitive(sensitive);      eEG2ControllerReleaseInfluence.set_sensitive(sensitive);
1343        eEG2StateOptions.set_sensitive(sensitive);
1344        lLFO2->set_sensitive(sensitive);
1345      eLFO2Frequency.set_sensitive(sensitive);      eLFO2Frequency.set_sensitive(sensitive);
1346      eLFO2InternalDepth.set_sensitive(sensitive);      eLFO2InternalDepth.set_sensitive(sensitive);
1347      eLFO2ControlDepth.set_sensitive(sensitive);      eLFO2ControlDepth.set_sensitive(sensitive);
# Line 790  void DimRegionEdit::VCFCutoffController_ Line 1374  void DimRegionEdit::VCFCutoffController_
1374      eVCFCutoffControllerInvert.set_sensitive(hasController);      eVCFCutoffControllerInvert.set_sensitive(hasController);
1375      eVCFCutoff.set_sensitive(!hasController);      eVCFCutoff.set_sensitive(!hasController);
1376      eVCFResonanceDynamic.set_sensitive(!hasController);      eVCFResonanceDynamic.set_sensitive(!hasController);
1377      eVCFVelocityScale.label.set_text(hasController ? "Minimum cutoff:" :      eVCFVelocityScale.label.set_text(hasController ? _("Minimum cutoff:") :
1378                                       "Velocity scale:");                                       _("Velocity scale:"));
1379  }  }
1380    
1381  void DimRegionEdit::VCFResonanceController_changed()  void DimRegionEdit::VCFResonanceController_changed()
# Line 834  void DimRegionEdit::AttenuationControlle Line 1418  void DimRegionEdit::AttenuationControlle
1418      eCrossfade_in_end.set_sensitive(hasController);      eCrossfade_in_end.set_sensitive(hasController);
1419      eCrossfade_out_start.set_sensitive(hasController);      eCrossfade_out_start.set_sensitive(hasController);
1420      eCrossfade_out_end.set_sensitive(hasController);      eCrossfade_out_end.set_sensitive(hasController);
1421        crossfade_curve.set_sensitive(hasController);
1422  }  }
1423    
1424  void DimRegionEdit::LFO1Controller_changed()  void DimRegionEdit::LFO1Controller_changed()
# Line 947  void DimRegionEdit::loop_infinite_toggle Line 1532  void DimRegionEdit::loop_infinite_toggle
1532      update_model--;      update_model--;
1533  }  }
1534    
1535  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)
1536    {
1537        bool result = false;
1538        for (std::set<gig::DimensionRegion*>::iterator itDimReg = dimregs.begin();
1539             itDimReg != dimregs.end(); ++itDimReg)
1540        {
1541            result |= set_sample(*itDimReg, sample, copy_sample_unity, copy_sample_tune, copy_sample_loop);
1542        }
1543        return result;
1544    }
1545    
1546    bool DimRegionEdit::set_sample(gig::DimensionRegion* dimreg, gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop)
1547  {  {
1548      if (dimregion) {      if (dimreg) {
1549          //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
1550    
1551          // 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()
1552          //dimreg_to_be_changed_signal.emit(dimregion);          //DimRegionChangeGuard(this, dimregion);
1553    
1554          gig::Sample* oldref = dimregion->pSample;          // make sure stereo samples always are the same in both
1555          dimregion->pSample = sample;          // dimregs in the samplechannel dimension
1556            int nbDimregs = 1;
1557            gig::DimensionRegion* d[2] = { dimreg, 0 };
1558            if (sample->Channels == 2) {
1559                gig::Region* region = dimreg->GetParent();
1560    
1561                int bitcount = 0;
1562                int stereo_bit = 0;
1563                for (int dim = 0 ; dim < region->Dimensions ; dim++) {
1564                    if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) {
1565                        stereo_bit = 1 << bitcount;
1566                        break;
1567                    }
1568                    bitcount += region->pDimensionDefinitions[dim].bits;
1569                }
1570    
1571          // copy sample information from Sample to DimensionRegion              if (stereo_bit) {
1572                    int dimregno;
1573                    for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) {
1574                        if (region->pDimensionRegions[dimregno] == dimreg) {
1575                            break;
1576                        }
1577                    }
1578                    d[0] = region->pDimensionRegions[dimregno & ~stereo_bit];
1579                    d[1] = region->pDimensionRegions[dimregno | stereo_bit];
1580                    nbDimregs = 2;
1581                }
1582            }
1583    
1584          dimregion->UnityNote = sample->MIDIUnityNote;          gig::Sample* oldref = dimreg->pSample;
         dimregion->FineTune = sample->FineTune;  
1585    
1586          int loops = sample->Loops ? 1 : 0;          for (int i = 0 ; i < nbDimregs ; i++) {
1587          while (dimregion->SampleLoops > loops) {              d[i]->pSample = sample;
1588              dimregion->DeleteSampleLoop(&dimregion->pSampleLoops[0]);  
1589          }              // copy sample information from Sample to DimensionRegion
1590          while (dimregion->SampleLoops < sample->Loops) {              if (copy_sample_unity)
1591              DLS::sample_loop_t loop;                  d[i]->UnityNote = sample->MIDIUnityNote;
1592              dimregion->AddSampleLoop(&loop);              if (copy_sample_tune)
1593          }                  d[i]->FineTune = sample->FineTune;
1594          if (loops) {              if (copy_sample_loop) {
1595              dimregion->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t);                  int loops = sample->Loops ? 1 : 0;
1596              dimregion->pSampleLoops[0].LoopType = sample->LoopType;                  while (d[i]->SampleLoops > loops) {
1597              dimregion->pSampleLoops[0].LoopStart = sample->LoopStart;                      d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]);
1598              dimregion->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1;                  }
1599                    while (d[i]->SampleLoops < sample->Loops) {
1600                        DLS::sample_loop_t loop;
1601                        d[i]->AddSampleLoop(&loop);
1602                    }
1603                    if (loops) {
1604                        d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t);
1605                        d[i]->pSampleLoops[0].LoopType = sample->LoopType;
1606                        d[i]->pSampleLoops[0].LoopStart = sample->LoopStart;
1607                        d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1;
1608                    }
1609                }
1610          }          }
1611    
1612          // update ui          // update ui
1613          update_model++;          update_model++;
1614          wSample->set_text(dimregion->pSample->pInfo->Name);          wSample->set_text(gig_to_utf8(dimreg->pSample->pInfo->Name));
1615          eUnityNote.set_value(dimregion->UnityNote);          eUnityNote.set_value(dimreg->UnityNote);
1616          eFineTune.set_value(dimregion->FineTune);          eFineTune.set_value(dimreg->FineTune);
1617          eSampleLoopEnabled.set_value(dimregion->SampleLoops);          eSampleLoopEnabled.set_value(dimreg->SampleLoops);
1618          update_loop_elements();          update_loop_elements();
1619          update_model--;          update_model--;
1620    
1621          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);  
1622          return true;          return true;
1623      }      }
1624      return false;      return false;
# Line 1058  void DimRegionEdit::set_LoopEnabled(gig: Line 1687  void DimRegionEdit::set_LoopEnabled(gig:
1687      if (value) {      if (value) {
1688          // create a new sample loop in case there is none yet          // create a new sample loop in case there is none yet
1689          if (!d->SampleLoops) {          if (!d->SampleLoops) {
1690                DimRegionChangeGuard(this, d);
1691    
1692              DLS::sample_loop_t loop;              DLS::sample_loop_t loop;
1693              loop.LoopType = gig::loop_type_normal;              loop.LoopType = gig::loop_type_normal;
1694              // loop the whole sample by default              // loop the whole sample by default
1695              loop.LoopStart  = 0;              loop.LoopStart  = 0;
1696              loop.LoopLength =              loop.LoopLength =
1697                  (d->pSample) ? d->pSample->SamplesTotal : 0;                  (d->pSample) ? d->pSample->SamplesTotal : 0;
             dimreg_to_be_changed_signal.emit(d);  
1698              d->AddSampleLoop(&loop);              d->AddSampleLoop(&loop);
             dimreg_changed_signal.emit(d);  
1699          }          }
1700      } else {      } else {
1701          if (d->SampleLoops) {          if (d->SampleLoops) {
1702              dimreg_to_be_changed_signal.emit(d);              DimRegionChangeGuard(this, d);
1703    
1704              // delete ALL existing sample loops              // delete ALL existing sample loops
1705              while (d->SampleLoops) {              while (d->SampleLoops) {
1706                  d->DeleteSampleLoop(&d->pSampleLoops[0]);                  d->DeleteSampleLoop(&d->pSampleLoops[0]);
1707              }              }
             dimreg_changed_signal.emit(d);  
1708          }          }
1709      }      }
1710  }  }
# Line 1119  void DimRegionEdit::set_LoopPlayCount(gi Line 1748  void DimRegionEdit::set_LoopPlayCount(gi
1748  {  {
1749      if (d->pSample) d->pSample->LoopPlayCount = value;      if (d->pSample) d->pSample->LoopPlayCount = value;
1750  }  }
1751    
1752    void DimRegionEdit::nullOutSampleReference() {
1753        if (!dimregion) return;
1754        gig::Sample* oldref = dimregion->pSample;
1755        if (!oldref) return;
1756    
1757        DimRegionChangeGuard(this, dimregion);
1758    
1759        // in case currently assigned sample is a stereo one, then remove both
1760        // references (expected to be due to a "stereo dimension")
1761        gig::DimensionRegion* d[2] = { dimregion, NULL };
1762        if (oldref->Channels == 2) {
1763            gig::Region* region = dimregion->GetParent();
1764            {
1765                int stereo_bit = 0;
1766                int bitcount = 0;
1767                for (int dim = 0 ; dim < region->Dimensions ; dim++) {
1768                    if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) {
1769                        stereo_bit = 1 << bitcount;
1770                        break;
1771                    }
1772                    bitcount += region->pDimensionDefinitions[dim].bits;
1773                }
1774    
1775                if (stereo_bit) {
1776                    int dimregno;
1777                    for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) {
1778                        if (region->pDimensionRegions[dimregno] == dimregion) {
1779                            break;
1780                        }
1781                    }
1782                    d[0] = region->pDimensionRegions[dimregno & ~stereo_bit];
1783                    d[1] = region->pDimensionRegions[dimregno | stereo_bit];
1784                }
1785            }
1786        }
1787    
1788        if (d[0]) d[0]->pSample = NULL;
1789        if (d[1]) d[1]->pSample = NULL;
1790    
1791        // update UI elements
1792        set_dim_region(dimregion);
1793    
1794        sample_ref_changed_signal.emit(oldref, NULL);
1795    }
1796    
1797    void DimRegionEdit::onButtonSelectSamplePressed() {
1798        if (!dimregion) return;
1799        if (!dimregion->pSample) return;
1800        select_sample_signal.emit(dimregion->pSample);
1801    }
1802    
1803    sigc::signal<void, gig::Sample*>& DimRegionEdit::signal_select_sample() {
1804        return select_sample_signal;
1805    }

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

  ViewVC Help
Powered by ViewVC