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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3795 - (show annotations) (download)
Thu Jun 25 15:21:44 2020 UTC (3 years, 9 months ago) by schoenebeck
File size: 83922 byte(s)
* When removing sample reference by clicking the NULL button, do that
  actually for the appropriate set of all dimension regions currently
  being selected by user.

* Bumped version (1.1.1.svn21).

1 /*
2 * Copyright (C) 2006-2019 Andreas Persson
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with program; see the file COPYING. If not, write to the Free
16 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17 * 02110-1301 USA.
18 */
19
20 #include "global.h"
21 #include "dimregionedit.h"
22
23 #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() :
338 velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation),
339 release_curve(&gig::DimensionRegion::GetVelocityRelease),
340 cutoff_curve(&gig::DimensionRegion::GetVelocityCutoff),
341 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")),
346 eEG1Sustain(_("Sustain Level (%)"), 0, 100, 2),
347 eEG1Release(_("Release Time (seconds)"), 0, 60, 3),
348 eEG1Hold(_("Hold Attack Stage until Loop End")),
349 eEG1Controller(_("Controller")),
350 eEG1ControllerInvert(_("Controller invert")),
351 eEG1ControllerAttackInfluence(_("Controller attack influence"), 0, 3),
352 eEG1ControllerDecayInfluence(_("Controller decay influence"), 0, 3),
353 eEG1ControllerReleaseInfluence(_("Controller release influence"), 0, 3),
354 eLFO1Wave(_("Wave Form")),
355 eLFO1Frequency(_("Frequency"), 0.1, 10, 2),
356 eLFO1Phase(_("Phase"), 0.0, 360.0, 2),
357 eLFO1InternalDepth(_("Internal depth"), 0, 1200),
358 eLFO1ControlDepth(_("Control depth"), 0, 1200),
359 eLFO1Controller(_("Controller")),
360 eLFO1FlipPhase(_("Flip phase")),
361 eLFO1Sync(_("Sync")),
362 eEG2PreAttack(_("Pre-attack Level (%)"), 0, 100, 2),
363 eEG2Attack(_("Attack Time (seconds)"), 0, 60, 3),
364 eEG2Decay1(_("Decay 1 Time (seconds)"), 0.005, 60, 3),
365 eEG2Decay2(_("Decay 2 Time (seconds)"), 0, 60, 3),
366 eEG2InfiniteSustain(_("Infinite sustain")),
367 eEG2Sustain(_("Sustain Level (%)"), 0, 100, 2),
368 eEG2Release(_("Release Time (seconds)"), 0, 60, 3),
369 eEG2Controller(_("Controller")),
370 eEG2ControllerInvert(_("Controller invert")),
371 eEG2ControllerAttackInfluence(_("Controller attack influence"), 0, 3),
372 eEG2ControllerDecayInfluence(_("Controller decay influence"), 0, 3),
373 eEG2ControllerReleaseInfluence(_("Controller release influence"), 0, 3),
374 eLFO2Wave(_("Wave Form")),
375 eLFO2Frequency(_("Frequency"), 0.1, 10, 2),
376 eLFO2Phase(_("Phase"), 0.0, 360.0, 2),
377 eLFO2InternalDepth(_("Internal depth"), 0, 1200),
378 eLFO2ControlDepth(_("Control depth"), 0, 1200),
379 eLFO2Controller(_("Controller")),
380 eLFO2FlipPhase(_("Flip phase")),
381 eLFO2Sync(_("Sync")),
382 eEG3Attack(_("Attack"), 0, 10, 3),
383 eEG3Depth(_("Depth"), -1200, 1200),
384 eLFO3Wave(_("Wave Form")),
385 eLFO3Frequency(_("Frequency"), 0.1, 10, 2),
386 eLFO3Phase(_("Phase"), 0.0, 360.0, 2),
387 eLFO3InternalDepth(_("Internal depth"), 0, 1200),
388 eLFO3ControlDepth(_("Control depth"), 0, 1200),
389 eLFO3Controller(_("Controller")),
390 eLFO3FlipPhase(_("Flip phase")),
391 eLFO3Sync(_("Sync")),
392 eVCFEnabled(_("Enabled")),
393 eVCFType(_("Type")),
394 eVCFCutoffController(_("Cutoff controller")),
395 eVCFCutoffControllerInvert(_("Cutoff controller invert")),
396 eVCFCutoff(_("Cutoff")),
397 eVCFVelocityCurve(_("Velocity curve")),
398 eVCFVelocityScale(_("Velocity scale")),
399 eVCFVelocityDynamicRange(_("Velocity dynamic range"), 0, 4),
400 eVCFResonance(_("Resonance")),
401 eVCFResonanceDynamic(_("Resonance dynamic")),
402 eVCFResonanceController(_("Resonance controller")),
403 eVCFKeyboardTracking(_("Keyboard tracking")),
404 eVCFKeyboardTrackingBreakpoint(_("Keyboard tracking breakpoint")),
405 eVelocityResponseCurve(_("Velocity response curve")),
406 eVelocityResponseDepth(_("Velocity response depth"), 0, 4),
407 eVelocityResponseCurveScaling(_("Velocity response curve scaling")),
408 eReleaseVelocityResponseCurve(_("Release velocity response curve")),
409 eReleaseVelocityResponseDepth(_("Release velocity response depth"), 0, 4),
410 eReleaseTriggerDecay(_("Release trigger decay"), 0, 8),
411 eCrossfade_in_start(_("Crossfade-in start")),
412 eCrossfade_in_end(_("Crossfade-in end")),
413 eCrossfade_out_start(_("Crossfade-out start")),
414 eCrossfade_out_end(_("Crossfade-out end")),
415 ePitchTrack(_("Pitch track")),
416 eSustainReleaseTrigger(_("Sustain Release Trigger")),
417 eNoNoteOffReleaseTrigger(_("No note-off release trigger")),
418 eDimensionBypass(_("Dimension bypass")),
419 ePan(_("Pan"), -64, 63),
420 eSelfMask(_("Kill lower velocity voices (a.k.a \"Self mask\")")),
421 eAttenuationController(_("Attenuation controller")),
422 eInvertAttenuationController(_("Invert attenuation controller")),
423 eAttenuationControllerThreshold(_("Attenuation controller threshold")),
424 eChannelOffset(_("Channel offset"), 0, 9),
425 eSustainDefeat(_("Ignore Hold Pedal (a.k.a. \"Sustain defeat\")")),
426 eMSDecode(_("Decode Mid/Side Recordings")),
427 eSampleStartOffset(_("Sample start offset"), 0, 2000),
428 eUnityNote(_("Unity note")),
429 eSampleGroup(_("Sample Group")),
430 eSampleFormatInfo(_("Sample Format")),
431 eSampleID("Sample ID"),
432 eChecksum("Wave Data CRC-32"),
433 eFineTune(_("Fine tune"), -49, 50),
434 eGain(_("Gain (dB)"), -96, +96, 2, -655360),
435 eSampleLoopEnabled(_("Enabled")),
436 eSampleLoopStart(_("Loop start position")),
437 eSampleLoopLength(_("Loop size")),
438 eSampleLoopType(_("Loop type")),
439 eSampleLoopInfinite(_("Infinite loop")),
440 eSampleLoopPlayCount(_("Playback count"), 1),
441 buttonSelectSample(UNICODE_LEFT_ARROW + " " + _("Select Sample")),
442 editScriptSlotsButton(_("Edit Slots ...")),
443 dimregion(NULL),
444 update_model(0)
445 {
446 // make synthesis parameter page tabs scrollable
447 // (workaround for GTK3: default theme uses huge tabs which breaks layout)
448 set_scrollable();
449
450 // use more appropriate increment/decrement steps for these spinboxes
451 eEG1PreAttack.set_increments(0.1, 5.0);
452 eEG2PreAttack.set_increments(0.1, 5.0);
453 eEG1Sustain.set_increments(0.1, 5.0);
454 eEG2Sustain.set_increments(0.1, 5.0);
455 eLFO1Frequency.set_increments(0.02, 0.2);
456 eLFO2Frequency.set_increments(0.02, 0.2);
457 eLFO3Frequency.set_increments(0.02, 0.2);
458 eLFO1Phase.set_increments(1.0, 10.0);
459 eLFO2Phase.set_increments(1.0, 10.0);
460 eLFO3Phase.set_increments(1.0, 10.0);
461
462 connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack);
463 connect(eEG1Attack, &gig::DimensionRegion::EG1Attack);
464 connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1);
465 connect(eEG1Decay2, &gig::DimensionRegion::EG1Decay2);
466 connect(eEG1InfiniteSustain, &gig::DimensionRegion::EG1InfiniteSustain);
467 connect(eEG1Sustain, &gig::DimensionRegion::EG1Sustain);
468 connect(eEG1Release, &gig::DimensionRegion::EG1Release);
469 connect(eEG1Hold, &gig::DimensionRegion::EG1Hold);
470 connect(eEG1Controller, &gig::DimensionRegion::EG1Controller);
471 connect(eEG1ControllerInvert, &gig::DimensionRegion::EG1ControllerInvert);
472 connect(eEG1ControllerAttackInfluence,
473 &gig::DimensionRegion::EG1ControllerAttackInfluence);
474 connect(eEG1ControllerDecayInfluence,
475 &gig::DimensionRegion::EG1ControllerDecayInfluence);
476 connect(eEG1ControllerReleaseInfluence,
477 &gig::DimensionRegion::EG1ControllerReleaseInfluence);
478 connect(eEG1StateOptions.checkBoxAttack, &gig::DimensionRegion::EG1Options,
479 &gig::eg_opt_t::AttackCancel);
480 connect(eEG1StateOptions.checkBoxAttackHold, &gig::DimensionRegion::EG1Options,
481 &gig::eg_opt_t::AttackHoldCancel);
482 connect(eEG1StateOptions.checkBoxDecay1, &gig::DimensionRegion::EG1Options,
483 &gig::eg_opt_t::Decay1Cancel);
484 connect(eEG1StateOptions.checkBoxDecay2, &gig::DimensionRegion::EG1Options,
485 &gig::eg_opt_t::Decay2Cancel);
486 connect(eEG1StateOptions.checkBoxRelease, &gig::DimensionRegion::EG1Options,
487 &gig::eg_opt_t::ReleaseCancel);
488 connect(eLFO1Wave, &gig::DimensionRegion::LFO1WaveForm);
489 connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency);
490 connect(eLFO1Phase, &gig::DimensionRegion::LFO1Phase);
491 connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth);
492 connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth);
493 connect(eLFO1Controller, &gig::DimensionRegion::LFO1Controller);
494 connect(eLFO1FlipPhase, &gig::DimensionRegion::LFO1FlipPhase);
495 connect(eLFO1Sync, &gig::DimensionRegion::LFO1Sync);
496 connect(eEG2PreAttack, &gig::DimensionRegion::EG2PreAttack);
497 connect(eEG2Attack, &gig::DimensionRegion::EG2Attack);
498 connect(eEG2Decay1, &gig::DimensionRegion::EG2Decay1);
499 connect(eEG2Decay2, &gig::DimensionRegion::EG2Decay2);
500 connect(eEG2InfiniteSustain, &gig::DimensionRegion::EG2InfiniteSustain);
501 connect(eEG2Sustain, &gig::DimensionRegion::EG2Sustain);
502 connect(eEG2Release, &gig::DimensionRegion::EG2Release);
503 connect(eEG2Controller, &gig::DimensionRegion::EG2Controller);
504 connect(eEG2ControllerInvert, &gig::DimensionRegion::EG2ControllerInvert);
505 connect(eEG2ControllerAttackInfluence,
506 &gig::DimensionRegion::EG2ControllerAttackInfluence);
507 connect(eEG2ControllerDecayInfluence,
508 &gig::DimensionRegion::EG2ControllerDecayInfluence);
509 connect(eEG2ControllerReleaseInfluence,
510 &gig::DimensionRegion::EG2ControllerReleaseInfluence);
511 connect(eEG2StateOptions.checkBoxAttack, &gig::DimensionRegion::EG2Options,
512 &gig::eg_opt_t::AttackCancel);
513 connect(eEG2StateOptions.checkBoxAttackHold, &gig::DimensionRegion::EG2Options,
514 &gig::eg_opt_t::AttackHoldCancel);
515 connect(eEG2StateOptions.checkBoxDecay1, &gig::DimensionRegion::EG2Options,
516 &gig::eg_opt_t::Decay1Cancel);
517 connect(eEG2StateOptions.checkBoxDecay2, &gig::DimensionRegion::EG2Options,
518 &gig::eg_opt_t::Decay2Cancel);
519 connect(eEG2StateOptions.checkBoxRelease, &gig::DimensionRegion::EG2Options,
520 &gig::eg_opt_t::ReleaseCancel);
521 connect(eLFO2Wave, &gig::DimensionRegion::LFO2WaveForm);
522 connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency);
523 connect(eLFO2Phase, &gig::DimensionRegion::LFO2Phase);
524 connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth);
525 connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth);
526 connect(eLFO2Controller, &gig::DimensionRegion::LFO2Controller);
527 connect(eLFO2FlipPhase, &gig::DimensionRegion::LFO2FlipPhase);
528 connect(eLFO2Sync, &gig::DimensionRegion::LFO2Sync);
529 connect(eEG3Attack, &gig::DimensionRegion::EG3Attack);
530 connect(eEG3Depth, &gig::DimensionRegion::EG3Depth);
531 connect(eLFO3Wave, &gig::DimensionRegion::LFO3WaveForm);
532 connect(eLFO3Frequency, &gig::DimensionRegion::LFO3Frequency);
533 connect(eLFO3Phase, &gig::DimensionRegion::LFO3Phase);
534 connect(eLFO3InternalDepth, &gig::DimensionRegion::LFO3InternalDepth);
535 connect(eLFO3ControlDepth, &gig::DimensionRegion::LFO3ControlDepth);
536 connect(eLFO3Controller, &gig::DimensionRegion::LFO3Controller);
537 connect(eLFO3FlipPhase, &gig::DimensionRegion::LFO3FlipPhase);
538 connect(eLFO3Sync, &gig::DimensionRegion::LFO3Sync);
539 connect(eVCFEnabled, &gig::DimensionRegion::VCFEnabled);
540 connect(eVCFType, &gig::DimensionRegion::VCFType);
541 connect(eVCFCutoffController,
542 &gig::DimensionRegion::SetVCFCutoffController);
543 connect(eVCFCutoffControllerInvert,
544 &gig::DimensionRegion::VCFCutoffControllerInvert);
545 connect(eVCFCutoff, &gig::DimensionRegion::VCFCutoff);
546 connect(eVCFVelocityCurve, &gig::DimensionRegion::SetVCFVelocityCurve);
547 connect(eVCFVelocityScale, &gig::DimensionRegion::SetVCFVelocityScale);
548 connect(eVCFVelocityDynamicRange,
549 &gig::DimensionRegion::SetVCFVelocityDynamicRange);
550 connect(eVCFResonance, &gig::DimensionRegion::VCFResonance);
551 connect(eVCFResonanceDynamic, &gig::DimensionRegion::VCFResonanceDynamic);
552 connect(eVCFResonanceController,
553 &gig::DimensionRegion::VCFResonanceController);
554 connect(eVCFKeyboardTracking, &gig::DimensionRegion::VCFKeyboardTracking);
555 connect(eVCFKeyboardTrackingBreakpoint,
556 &gig::DimensionRegion::VCFKeyboardTrackingBreakpoint);
557 connect(eVelocityResponseCurve,
558 &gig::DimensionRegion::SetVelocityResponseCurve);
559 connect(eVelocityResponseDepth,
560 &gig::DimensionRegion::SetVelocityResponseDepth);
561 connect(eVelocityResponseCurveScaling,
562 &gig::DimensionRegion::SetVelocityResponseCurveScaling);
563 connect(eReleaseVelocityResponseCurve,
564 &gig::DimensionRegion::SetReleaseVelocityResponseCurve);
565 connect(eReleaseVelocityResponseDepth,
566 &gig::DimensionRegion::SetReleaseVelocityResponseDepth);
567 connect(eReleaseTriggerDecay, &gig::DimensionRegion::ReleaseTriggerDecay);
568 connect(eCrossfade_in_start, &DimRegionEdit::set_Crossfade_in_start);
569 connect(eCrossfade_in_end, &DimRegionEdit::set_Crossfade_in_end);
570 connect(eCrossfade_out_start, &DimRegionEdit::set_Crossfade_out_start);
571 connect(eCrossfade_out_end, &DimRegionEdit::set_Crossfade_out_end);
572 connect(ePitchTrack, &gig::DimensionRegion::PitchTrack);
573 connect(eSustainReleaseTrigger, &gig::DimensionRegion::SustainReleaseTrigger);
574 connect(eNoNoteOffReleaseTrigger, &gig::DimensionRegion::NoNoteOffReleaseTrigger);
575 connect(eDimensionBypass, &gig::DimensionRegion::DimensionBypass);
576 connect(ePan, &gig::DimensionRegion::Pan);
577 connect(eSelfMask, &gig::DimensionRegion::SelfMask);
578 connect(eAttenuationController,
579 &gig::DimensionRegion::AttenuationController);
580 connect(eInvertAttenuationController,
581 &gig::DimensionRegion::InvertAttenuationController);
582 connect(eAttenuationControllerThreshold,
583 &gig::DimensionRegion::AttenuationControllerThreshold);
584 connect(eChannelOffset, &gig::DimensionRegion::ChannelOffset);
585 connect(eSustainDefeat, &gig::DimensionRegion::SustainDefeat);
586 connect(eMSDecode, &gig::DimensionRegion::MSDecode);
587 connect(eSampleStartOffset, &gig::DimensionRegion::SampleStartOffset);
588 connect(eUnityNote, &DimRegionEdit::set_UnityNote);
589 connect(eFineTune, &DimRegionEdit::set_FineTune);
590 connect(eGain, &DimRegionEdit::set_Gain);
591 connect(eSampleLoopEnabled, &DimRegionEdit::set_LoopEnabled);
592 connect(eSampleLoopType, &DimRegionEdit::set_LoopType);
593 connect(eSampleLoopStart, &DimRegionEdit::set_LoopStart);
594 connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength);
595 connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite);
596 connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount);
597 buttonSelectSample.signal_clicked().connect(
598 sigc::mem_fun(*this, &DimRegionEdit::onButtonSelectSamplePressed)
599 );
600
601 for (int i = 0; i < tableSize; i++) {
602 #if USE_GTKMM_GRID
603 table[i] = new Gtk::Grid;
604 table[i]->set_column_spacing(7);
605 #else
606 table[i] = new Gtk::Table(3, 1);
607 table[i]->set_col_spacings(7);
608 #endif
609
610 // on Gtk 3 there is absolutely no margin by default
611 #if GTKMM_MAJOR_VERSION >= 3
612 # if GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION < 12
613 table[i]->set_margin_left(12);
614 table[i]->set_margin_right(12);
615 # else
616 table[i]->set_margin_start(12);
617 table[i]->set_margin_end(12);
618 # endif
619 #endif
620 }
621
622 // set tooltips
623 eUnityNote.set_tip(
624 _("Note this sample is associated with (a.k.a. 'root note')")
625 );
626 buttonSelectSample.set_tooltip_text(
627 _("Selects the sample of this dimension region on the left hand side's sample tree view.")
628 );
629 eSampleStartOffset.set_tip(_("Sample position at which playback should be started"));
630 ePan.set_tip(_("Stereo balance (left/right)"));
631 eChannelOffset.set_tip(
632 _("Output channel where the audio signal should be routed to (0 - 9)")
633 );
634 ePitchTrack.set_tip(
635 _("If true: sample will be pitched according to the key position "
636 "(this would be disabled for drums for example)")
637 );
638 eSampleLoopEnabled.set_tip(_("If enabled: repeats to playback the sample"));
639 eSampleLoopStart.set_tip(
640 _("Start position within the sample (in sample points) of the area to "
641 "be looped")
642 );
643 eSampleLoopLength.set_tip(
644 _("Duration (in sample points) of the area to be looped")
645 );
646 eSampleLoopType.set_tip(
647 _("Direction in which the loop area in the sample should be played back")
648 );
649 eSampleLoopInfinite.set_tip(
650 _("Whether the loop area should be played back forever\n"
651 "Caution: this setting is stored on Sample side, thus is shared "
652 "among all dimension regions that use this sample!")
653 );
654 eSampleLoopPlayCount.set_tip(
655 _("How many times the loop area should be played back\n"
656 "Caution: this setting is stored on Sample side, thus is shared "
657 "among all dimension regions that use this sample!")
658 );
659
660 eEG1PreAttack.set_tip(
661 "Very first level this EG starts with. It rises then in Attack Time "
662 "seconds from this initial level to 100%."
663 );
664 eEG1Attack.set_tip(
665 "Duration of the EG's Attack stage, which raises its level from "
666 "Pre-Attack Level to 100%."
667 );
668 eEG1Hold.set_tip(
669 "On looped sounds, enabling this will cause the Decay 1 stage not to "
670 "enter before the loop has been passed one time."
671 );
672 eAttenuationController.set_tip(_(
673 "If you are not using the 'Layer' dimension, then this controller "
674 "simply alters the volume. If you are using the 'Layer' dimension, "
675 "then this controller is controlling the crossfade between Layers in "
676 "real-time."
677 ));
678
679 eLFO1Sync.set_tip(
680 "If not checked, every voice will use its own LFO instance, which "
681 "causes voices triggered at different points in time to have different "
682 "LFO levels. By enabling 'Sync' here the voices will instead use and "
683 "share one single LFO, causing all voices to have the same LFO level, "
684 "no matter when the individual notes have been triggered."
685 );
686 eLFO2Sync.set_tip(
687 "If not checked, every voice will use its own LFO instance, which "
688 "causes voices triggered at different points in time to have different "
689 "LFO levels. By enabling 'Sync' here the voices will instead use and "
690 "share one single LFO, causing all voices to have the same LFO level, "
691 "no matter when the individual notes have been triggered."
692 );
693 eLFO3Sync.set_tip(
694 "If not checked, every voice will use its own LFO instance, which "
695 "causes voices triggered at different points in time to have different "
696 "LFO levels. By enabling 'Sync' here the voices will instead use and "
697 "share one single LFO, causing all voices to have the same LFO level, "
698 "no matter when the individual notes have been triggered."
699 );
700 eLFO1FlipPhase.set_tip(
701 "Inverts the LFO's generated wave vertically."
702 );
703 eLFO2FlipPhase.set_tip(
704 "Inverts the LFO's generated wave vertically."
705 );
706 eLFO3FlipPhase.set_tip(
707 "Inverts the LFO's generated wave vertically."
708 );
709
710 pageno = 0;
711 rowno = 0;
712 firstRowInBlock = 0;
713
714 addHeader(_("Mandatory Settings"));
715 addString(_("Sample"), lSample, wSample, buttonNullSampleReference);
716 buttonNullSampleReference->set_label("X");
717 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."));
718 buttonNullSampleReference->signal_clicked().connect(
719 sigc::mem_fun(*this, &DimRegionEdit::nullOutSampleReference)
720 );
721 //TODO: the following would break drag&drop: wSample->property_editable().set_value(false); or this: wSample->set_editable(false);
722 #ifdef OLD_TOOLTIPS
723 tooltips.set_tip(*wSample, _("Drag & drop a sample here"));
724 #else
725 wSample->set_tooltip_text(_("Drag & drop a sample here"));
726 #endif
727 addProp(eUnityNote);
728 addProp(eSampleGroup);
729 addProp(eSampleFormatInfo);
730 addProp(eSampleID);
731 addProp(eChecksum);
732 addRightHandSide(buttonSelectSample);
733 addHeader(_("Optional Settings"));
734 addProp(eSampleStartOffset);
735 addProp(eChannelOffset);
736 addHeader(_("Loops"));
737 addProp(eSampleLoopEnabled);
738 addProp(eSampleLoopStart);
739 addProp(eSampleLoopLength);
740 {
741 const char* choices[] = { _("normal"), _("bidirectional"), _("backward"), 0 };
742 static const uint32_t values[] = {
743 gig::loop_type_normal,
744 gig::loop_type_bidirectional,
745 gig::loop_type_backward
746 };
747 eSampleLoopType.set_choices(choices, values);
748 }
749 addProp(eSampleLoopType);
750 addProp(eSampleLoopInfinite);
751 addProp(eSampleLoopPlayCount);
752
753 nextPage();
754
755 addHeader(_("General Amplitude Settings"));
756 addProp(eGain);
757 addProp(ePan);
758 addHeader(_("Amplitude Envelope (EG1)"));
759 addProp(eEG1PreAttack);
760 addProp(eEG1Attack);
761 addProp(eEG1Hold);
762 addProp(eEG1Decay1);
763 addProp(eEG1Decay2);
764 addProp(eEG1InfiniteSustain);
765 addProp(eEG1Sustain);
766 addProp(eEG1Release);
767 addProp(eEG1Controller);
768 addProp(eEG1ControllerInvert);
769 addProp(eEG1ControllerAttackInfluence);
770 addProp(eEG1ControllerDecayInfluence);
771 addProp(eEG1ControllerReleaseInfluence);
772 addLine(eEG1StateOptions);
773
774 nextPage();
775
776 addHeader(_("Amplitude Oscillator (LFO1)"));
777 addProp(eLFO1Wave);
778 addProp(eLFO1Frequency);
779 addProp(eLFO1Phase);
780 addProp(eLFO1InternalDepth);
781 addProp(eLFO1ControlDepth);
782 {
783 const char* choices[] = { _("internal"), _("modwheel"), _("breath"),
784 _("internal+modwheel"), _("internal+breath"), 0 };
785 static const gig::lfo1_ctrl_t values[] = {
786 gig::lfo1_ctrl_internal,
787 gig::lfo1_ctrl_modwheel,
788 gig::lfo1_ctrl_breath,
789 gig::lfo1_ctrl_internal_modwheel,
790 gig::lfo1_ctrl_internal_breath
791 };
792 eLFO1Controller.set_choices(choices, values);
793 }
794 addProp(eLFO1Controller);
795 addProp(eLFO1FlipPhase);
796 addProp(eLFO1Sync);
797 {
798 Gtk::Frame* frame = new Gtk::Frame;
799 frame->add(lfo1Graph);
800 // on Gtk 3 there is no margin at all by default
801 #if GTKMM_MAJOR_VERSION >= 3
802 frame->set_margin_top(12);
803 frame->set_margin_bottom(12);
804 #endif
805 #if USE_GTKMM_GRID
806 table[pageno]->attach(*frame, 1, rowno, 2);
807 #else
808 table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
809 Gtk::SHRINK, Gtk::SHRINK);
810 #endif
811 rowno++;
812 }
813 eLFO1Wave.signal_value_changed().connect(
814 sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
815 );
816 eLFO1Frequency.signal_value_changed().connect(
817 sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
818 );
819 eLFO1Phase.signal_value_changed().connect(
820 sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
821 );
822 eLFO1InternalDepth.signal_value_changed().connect(
823 sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
824 );
825 eLFO1ControlDepth.signal_value_changed().connect(
826 sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
827 );
828 eLFO1Controller.signal_value_changed().connect(
829 sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
830 );
831 eLFO1FlipPhase.signal_value_changed().connect(
832 sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
833 );
834 eLFO1Sync.signal_value_changed().connect(
835 sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw)
836 );
837
838 nextPage();
839
840 addHeader(_("Crossfade"));
841 addProp(eAttenuationController);
842 addProp(eInvertAttenuationController);
843 addProp(eAttenuationControllerThreshold);
844 addProp(eCrossfade_in_start);
845 addProp(eCrossfade_in_end);
846 addProp(eCrossfade_out_start);
847 addProp(eCrossfade_out_end);
848
849 Gtk::Frame* frame = new Gtk::Frame;
850 frame->add(crossfade_curve);
851 // on Gtk 3 there is no margin at all by default
852 #if GTKMM_MAJOR_VERSION >= 3
853 frame->set_margin_top(12);
854 frame->set_margin_bottom(12);
855 #endif
856 #if USE_GTKMM_GRID
857 table[pageno]->attach(*frame, 1, rowno, 2);
858 #else
859 table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
860 Gtk::SHRINK, Gtk::SHRINK);
861 #endif
862 rowno++;
863
864 eCrossfade_in_start.signal_value_changed().connect(
865 sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
866 eCrossfade_in_end.signal_value_changed().connect(
867 sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
868 eCrossfade_out_start.signal_value_changed().connect(
869 sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
870 eCrossfade_out_end.signal_value_changed().connect(
871 sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
872
873 nextPage();
874
875 addHeader(_("General Filter Settings"));
876 addProp(eVCFEnabled);
877 {
878 const char* choices[] = {
879 _("lowpass"), _("lowpassturbo"), _("bandpass"), _("highpass"),
880 _("bandreject"),
881 _("lowpass 1-pole [EXT]"),
882 _("lowpass 2-pole [EXT]"),
883 _("lowpass 4-pole [EXT]"),
884 _("lowpass 6-pole [EXT]"),
885 _("highpass 1-pole [EXT]"),
886 _("highpass 2-pole [EXT]"),
887 _("highpass 4-pole [EXT]"),
888 _("highpass 6-pole [EXT]"),
889 _("bandpass 2-pole [EXT]"),
890 _("bandreject 2-pole [EXT]"),
891 NULL
892 };
893 static const gig::vcf_type_t values[] = {
894 // GigaStudio original filter types
895 gig::vcf_type_lowpass,
896 gig::vcf_type_lowpassturbo,
897 gig::vcf_type_bandpass,
898 gig::vcf_type_highpass,
899 gig::vcf_type_bandreject,
900 // LinuxSampler filter types (as gig format extension)
901 gig::vcf_type_lowpass_1p,
902 gig::vcf_type_lowpass_2p,
903 gig::vcf_type_lowpass_4p,
904 gig::vcf_type_lowpass_6p,
905 gig::vcf_type_highpass_1p,
906 gig::vcf_type_highpass_2p,
907 gig::vcf_type_highpass_4p,
908 gig::vcf_type_highpass_6p,
909 gig::vcf_type_bandpass_2p,
910 gig::vcf_type_bandreject_2p,
911 };
912 eVCFType.set_choices(choices, values);
913 }
914 addProp(eVCFType);
915 {
916 const char* choices[] = { _("none"), _("none2"), _("modwheel"), _("effect1"), _("effect2"),
917 _("breath"), _("foot"), _("sustainpedal"), _("softpedal"),
918 _("genpurpose7"), _("genpurpose8"), _("aftertouch"), 0 };
919 static const gig::vcf_cutoff_ctrl_t values[] = {
920 gig::vcf_cutoff_ctrl_none,
921 gig::vcf_cutoff_ctrl_none2,
922 gig::vcf_cutoff_ctrl_modwheel,
923 gig::vcf_cutoff_ctrl_effect1,
924 gig::vcf_cutoff_ctrl_effect2,
925 gig::vcf_cutoff_ctrl_breath,
926 gig::vcf_cutoff_ctrl_foot,
927 gig::vcf_cutoff_ctrl_sustainpedal,
928 gig::vcf_cutoff_ctrl_softpedal,
929 gig::vcf_cutoff_ctrl_genpurpose7,
930 gig::vcf_cutoff_ctrl_genpurpose8,
931 gig::vcf_cutoff_ctrl_aftertouch
932 };
933 eVCFCutoffController.set_choices(choices, values);
934 }
935 addProp(eVCFCutoffController);
936 addProp(eVCFCutoffControllerInvert);
937 addProp(eVCFCutoff);
938 const char* curve_type_texts[] = { _("nonlinear"), _("linear"), _("special"), 0 };
939 static const gig::curve_type_t curve_type_values[] = {
940 gig::curve_type_nonlinear,
941 gig::curve_type_linear,
942 gig::curve_type_special
943 };
944 eVCFVelocityCurve.set_choices(curve_type_texts, curve_type_values);
945 addProp(eVCFVelocityCurve);
946 addProp(eVCFVelocityScale);
947 addProp(eVCFVelocityDynamicRange);
948
949 eVCFCutoffController.signal_value_changed().connect(
950 sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
951 eVCFVelocityCurve.signal_value_changed().connect(
952 sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
953 eVCFVelocityScale.signal_value_changed().connect(
954 sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
955 eVCFVelocityDynamicRange.signal_value_changed().connect(
956 sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
957
958 frame = new Gtk::Frame;
959 frame->add(cutoff_curve);
960 // on Gtk 3 there is no margin at all by default
961 #if GTKMM_MAJOR_VERSION >= 3
962 frame->set_margin_top(12);
963 frame->set_margin_bottom(12);
964 #endif
965 #if USE_GTKMM_GRID
966 table[pageno]->attach(*frame, 1, rowno, 2);
967 #else
968 table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
969 Gtk::SHRINK, Gtk::SHRINK);
970 #endif
971 rowno++;
972
973 addProp(eVCFResonance);
974 addProp(eVCFResonanceDynamic);
975 {
976 const char* choices[] = { _("none"), _("genpurpose3"), _("genpurpose4"),
977 _("genpurpose5"), _("genpurpose6"), 0 };
978 static const gig::vcf_res_ctrl_t values[] = {
979 gig::vcf_res_ctrl_none,
980 gig::vcf_res_ctrl_genpurpose3,
981 gig::vcf_res_ctrl_genpurpose4,
982 gig::vcf_res_ctrl_genpurpose5,
983 gig::vcf_res_ctrl_genpurpose6
984 };
985 eVCFResonanceController.set_choices(choices, values);
986 }
987 addProp(eVCFResonanceController);
988 addProp(eVCFKeyboardTracking);
989 addProp(eVCFKeyboardTrackingBreakpoint);
990
991 nextPage();
992
993 lEG2 = addHeader(_("Filter Cutoff Envelope (EG2)"));
994 addProp(eEG2PreAttack);
995 addProp(eEG2Attack);
996 addProp(eEG2Decay1);
997 addProp(eEG2Decay2);
998 addProp(eEG2InfiniteSustain);
999 addProp(eEG2Sustain);
1000 addProp(eEG2Release);
1001 addProp(eEG2Controller);
1002 addProp(eEG2ControllerInvert);
1003 addProp(eEG2ControllerAttackInfluence);
1004 addProp(eEG2ControllerDecayInfluence);
1005 addProp(eEG2ControllerReleaseInfluence);
1006 addLine(eEG2StateOptions);
1007
1008 nextPage();
1009
1010 lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)"));
1011 addProp(eLFO2Wave);
1012 addProp(eLFO2Frequency);
1013 addProp(eLFO2Phase);
1014 addProp(eLFO2InternalDepth);
1015 addProp(eLFO2ControlDepth);
1016 {
1017 const char* choices[] = { _("internal"), _("modwheel"), _("foot"),
1018 _("internal+modwheel"), _("internal+foot"), 0 };
1019 static const gig::lfo2_ctrl_t values[] = {
1020 gig::lfo2_ctrl_internal,
1021 gig::lfo2_ctrl_modwheel,
1022 gig::lfo2_ctrl_foot,
1023 gig::lfo2_ctrl_internal_modwheel,
1024 gig::lfo2_ctrl_internal_foot
1025 };
1026 eLFO2Controller.set_choices(choices, values);
1027 }
1028 addProp(eLFO2Controller);
1029 addProp(eLFO2FlipPhase);
1030 addProp(eLFO2Sync);
1031 {
1032 Gtk::Frame* frame = new Gtk::Frame;
1033 frame->add(lfo2Graph);
1034 // on Gtk 3 there is no margin at all by default
1035 #if GTKMM_MAJOR_VERSION >= 3
1036 frame->set_margin_top(12);
1037 frame->set_margin_bottom(12);
1038 #endif
1039 #if USE_GTKMM_GRID
1040 table[pageno]->attach(*frame, 1, rowno, 2);
1041 #else
1042 table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
1043 Gtk::SHRINK, Gtk::SHRINK);
1044 #endif
1045 rowno++;
1046 }
1047 eLFO2Wave.signal_value_changed().connect(
1048 sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1049 );
1050 eLFO2Frequency.signal_value_changed().connect(
1051 sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1052 );
1053 eLFO2Phase.signal_value_changed().connect(
1054 sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1055 );
1056 eLFO2InternalDepth.signal_value_changed().connect(
1057 sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1058 );
1059 eLFO2ControlDepth.signal_value_changed().connect(
1060 sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1061 );
1062 eLFO2Controller.signal_value_changed().connect(
1063 sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1064 );
1065 eLFO2FlipPhase.signal_value_changed().connect(
1066 sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1067 );
1068 eLFO2Sync.signal_value_changed().connect(
1069 sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw)
1070 );
1071
1072 nextPage();
1073
1074 addHeader(_("General Pitch Settings"));
1075 addProp(eFineTune);
1076 addProp(ePitchTrack);
1077 addHeader(_("Pitch Envelope (EG3)"));
1078 addProp(eEG3Attack);
1079 addProp(eEG3Depth);
1080 addHeader(_("Pitch Oscillator (LFO3)"));
1081 addProp(eLFO3Wave);
1082 addProp(eLFO3Frequency);
1083 addProp(eLFO3Phase);
1084 addProp(eLFO3InternalDepth);
1085 addProp(eLFO3ControlDepth);
1086 {
1087 const char* choices[] = { _("internal"), _("modwheel"), _("aftertouch"),
1088 _("internal+modwheel"), _("internal+aftertouch"), 0 };
1089 static const gig::lfo3_ctrl_t values[] = {
1090 gig::lfo3_ctrl_internal,
1091 gig::lfo3_ctrl_modwheel,
1092 gig::lfo3_ctrl_aftertouch,
1093 gig::lfo3_ctrl_internal_modwheel,
1094 gig::lfo3_ctrl_internal_aftertouch
1095 };
1096 eLFO3Controller.set_choices(choices, values);
1097 }
1098 addProp(eLFO3Controller);
1099 addProp(eLFO3FlipPhase);
1100 addProp(eLFO3Sync);
1101 {
1102 Gtk::Frame* frame = new Gtk::Frame;
1103 frame->add(lfo3Graph);
1104 // on Gtk 3 there is no margin at all by default
1105 #if GTKMM_MAJOR_VERSION >= 3
1106 frame->set_margin_top(12);
1107 frame->set_margin_bottom(12);
1108 #endif
1109 #if USE_GTKMM_GRID
1110 table[pageno]->attach(*frame, 1, rowno, 2);
1111 #else
1112 table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
1113 Gtk::SHRINK, Gtk::SHRINK);
1114 #endif
1115 rowno++;
1116 }
1117 eLFO3Wave.signal_value_changed().connect(
1118 sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1119 );
1120 eLFO3Frequency.signal_value_changed().connect(
1121 sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1122 );
1123 eLFO3Phase.signal_value_changed().connect(
1124 sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1125 );
1126 eLFO3InternalDepth.signal_value_changed().connect(
1127 sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1128 );
1129 eLFO3ControlDepth.signal_value_changed().connect(
1130 sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1131 );
1132 eLFO3Controller.signal_value_changed().connect(
1133 sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1134 );
1135 eLFO3FlipPhase.signal_value_changed().connect(
1136 sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1137 );
1138 eLFO3Sync.signal_value_changed().connect(
1139 sigc::mem_fun(lfo3Graph, &LFOGraph::queue_draw)
1140 );
1141
1142 nextPage();
1143
1144 addHeader(_("Velocity Response"));
1145 eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values);
1146 addProp(eVelocityResponseCurve);
1147 addProp(eVelocityResponseDepth);
1148 addProp(eVelocityResponseCurveScaling);
1149
1150 eVelocityResponseCurve.signal_value_changed().connect(
1151 sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
1152 eVelocityResponseDepth.signal_value_changed().connect(
1153 sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
1154 eVelocityResponseCurveScaling.signal_value_changed().connect(
1155 sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
1156
1157 frame = new Gtk::Frame;
1158 frame->add(velocity_curve);
1159 // on Gtk 3 there is no margin at all by default
1160 #if GTKMM_MAJOR_VERSION >= 3
1161 frame->set_margin_top(12);
1162 frame->set_margin_bottom(12);
1163 #endif
1164 #if USE_GTKMM_GRID
1165 table[pageno]->attach(*frame, 1, rowno, 2);
1166 #else
1167 table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
1168 Gtk::SHRINK, Gtk::SHRINK);
1169 #endif
1170 rowno++;
1171
1172 addHeader(_("Release Velocity Response"));
1173 eReleaseVelocityResponseCurve.set_choices(curve_type_texts,
1174 curve_type_values);
1175 addProp(eReleaseVelocityResponseCurve);
1176 addProp(eReleaseVelocityResponseDepth);
1177
1178 eReleaseVelocityResponseCurve.signal_value_changed().connect(
1179 sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));
1180 eReleaseVelocityResponseDepth.signal_value_changed().connect(
1181 sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));
1182 frame = new Gtk::Frame;
1183 frame->add(release_curve);
1184 // on Gtk 3 there is no margin at all by default
1185 #if GTKMM_MAJOR_VERSION >= 3
1186 frame->set_margin_top(12);
1187 frame->set_margin_bottom(12);
1188 #endif
1189 #if USE_GTKMM_GRID
1190 table[pageno]->attach(*frame, 1, rowno, 2);
1191 #else
1192 table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
1193 Gtk::SHRINK, Gtk::SHRINK);
1194 #endif
1195 rowno++;
1196
1197 addProp(eReleaseTriggerDecay);
1198 {
1199 const char* choices[] = { _("off"), _("on (max. velocity)"), _("on (key velocity)"), 0 };
1200 static const gig::sust_rel_trg_t values[] = {
1201 gig::sust_rel_trg_none,
1202 gig::sust_rel_trg_maxvelocity,
1203 gig::sust_rel_trg_keyvelocity
1204 };
1205 eSustainReleaseTrigger.set_choices(choices, values);
1206 }
1207 eSustainReleaseTrigger.set_tip(_(
1208 "By default release trigger samples are played on note-off events only. "
1209 "This option allows to play release trigger sample on sustain pedal up "
1210 "events as well. NOTE: This is a format extension!"
1211 ));
1212 addProp(eSustainReleaseTrigger);
1213 {
1214 const char* choices[] = { _("none"), _("effect4depth"), _("effect5depth"), 0 };
1215 static const gig::dim_bypass_ctrl_t values[] = {
1216 gig::dim_bypass_ctrl_none,
1217 gig::dim_bypass_ctrl_94,
1218 gig::dim_bypass_ctrl_95
1219 };
1220 eDimensionBypass.set_choices(choices, values);
1221 }
1222 eNoNoteOffReleaseTrigger.set_tip(_(
1223 "By default release trigger samples are played on note-off events only. "
1224 "If this option is checked, then no release trigger sample is played "
1225 "when releasing a note. NOTE: This is a format extension!"
1226 ));
1227 addProp(eNoNoteOffReleaseTrigger);
1228 addProp(eDimensionBypass);
1229 eSelfMask.widget.set_tooltip_text(_(
1230 "If enabled: new notes with higher velocity value will stop older "
1231 "notes with lower velocity values, that way you can save voices that "
1232 "would barely be audible. This is also useful for certain drum sounds."
1233 ));
1234 addProp(eSelfMask);
1235 eSustainDefeat.widget.set_tooltip_text(_(
1236 "If enabled: sustain pedal will not hold a note. This way you can use "
1237 "the sustain pedal for other purposes, for example to switch among "
1238 "dimension regions."
1239 ));
1240 addProp(eSustainDefeat);
1241 eMSDecode.widget.set_tooltip_text(_(
1242 "Defines if Mid/Side Recordings should be decoded. Mid/Side Recordings "
1243 "are an alternative way to record sounds in stereo. The sampler needs "
1244 "to decode such samples to actually make use of them. Note: this "
1245 "feature is currently not supported by LinuxSampler."
1246 ));
1247 addProp(eMSDecode);
1248
1249 nextPage();
1250
1251
1252 eEG1InfiniteSustain.signal_value_changed().connect(
1253 sigc::mem_fun(*this, &DimRegionEdit::EG1InfiniteSustain_toggled));
1254 eEG2InfiniteSustain.signal_value_changed().connect(
1255 sigc::mem_fun(*this, &DimRegionEdit::EG2InfiniteSustain_toggled));
1256 eEG1Controller.signal_value_changed().connect(
1257 sigc::mem_fun(*this, &DimRegionEdit::EG1Controller_changed));
1258 eEG2Controller.signal_value_changed().connect(
1259 sigc::mem_fun(*this, &DimRegionEdit::EG2Controller_changed));
1260 eLFO1Controller.signal_value_changed().connect(
1261 sigc::mem_fun(*this, &DimRegionEdit::LFO1Controller_changed));
1262 eLFO2Controller.signal_value_changed().connect(
1263 sigc::mem_fun(*this, &DimRegionEdit::LFO2Controller_changed));
1264 eLFO3Controller.signal_value_changed().connect(
1265 sigc::mem_fun(*this, &DimRegionEdit::LFO3Controller_changed));
1266 eAttenuationController.signal_value_changed().connect(
1267 sigc::mem_fun(*this, &DimRegionEdit::AttenuationController_changed));
1268 eVCFEnabled.signal_value_changed().connect(
1269 sigc::mem_fun(*this, &DimRegionEdit::VCFEnabled_toggled));
1270 eVCFCutoffController.signal_value_changed().connect(
1271 sigc::mem_fun(*this, &DimRegionEdit::VCFCutoffController_changed));
1272 eVCFResonanceController.signal_value_changed().connect(
1273 sigc::mem_fun(*this, &DimRegionEdit::VCFResonanceController_changed));
1274
1275 eCrossfade_in_start.signal_value_changed().connect(
1276 sigc::mem_fun(*this, &DimRegionEdit::crossfade1_changed));
1277 eCrossfade_in_end.signal_value_changed().connect(
1278 sigc::mem_fun(*this, &DimRegionEdit::crossfade2_changed));
1279 eCrossfade_out_start.signal_value_changed().connect(
1280 sigc::mem_fun(*this, &DimRegionEdit::crossfade3_changed));
1281 eCrossfade_out_end.signal_value_changed().connect(
1282 sigc::mem_fun(*this, &DimRegionEdit::crossfade4_changed));
1283
1284 eSampleLoopEnabled.signal_value_changed().connect(
1285 sigc::mem_fun(*this, &DimRegionEdit::update_loop_elements));
1286 eSampleLoopStart.signal_value_changed().connect(
1287 sigc::mem_fun(*this, &DimRegionEdit::loop_start_changed));
1288 eSampleLoopLength.signal_value_changed().connect(
1289 sigc::mem_fun(*this, &DimRegionEdit::loop_length_changed));
1290 eSampleLoopInfinite.signal_value_changed().connect(
1291 sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled));
1292
1293
1294 addHeader(_("Script Patch Variables"));
1295
1296 m_labelPatchVarsDescr.set_markup(
1297 _("These are variables declared in scripts with keyword "
1298 "<span color='#FF4FF3'><b>patch</b></span>. "
1299 "A 'patch' variable allows to override its default value on a per "
1300 "instrument basis. That way a script may be shared by instruments "
1301 "while being able to fine tune certain script parameters for each "
1302 "instrument individually if necessary. Overridden default values "
1303 "are displayed in bold. To revert back to the script's default "
1304 "value, select the variable(s) and hit <b>&#x232b;</b> or "
1305 "<b>&#x2326;</b> key.")
1306 );
1307 scriptVarsDescrBox.set_spacing(13);
1308 scriptVarsDescrBox.pack_start(m_labelPatchVarsDescr, true, true);
1309 scriptVarsDescrBox.pack_start(editScriptSlotsButton, false, false);
1310 #if USE_GTKMM_GRID
1311 table[pageno]->attach(scriptVarsDescrBox, 1, rowno, 2);
1312 #else
1313 table[pageno]->attach(scriptVarsDescrBox, 1, 3, rowno, rowno + 1,
1314 Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1315 #endif
1316 rowno++;
1317
1318 #if GTKMM_MAJOR_VERSION >= 3
1319 scriptVars.set_margin_top(20);
1320 #endif
1321 #if USE_GTKMM_GRID
1322 table[pageno]->attach(scriptVars, 1, rowno, 2);
1323 #else
1324
1325 table[pageno]->attach(scriptVars, 1, 3, rowno, rowno + 1,
1326 Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL);
1327 #endif
1328 rowno++;
1329
1330
1331 append_page(*table[0], _("Sample"));
1332 append_page(*table[1], _("Amp (1)"));
1333 append_page(*table[2], _("Amp (2)"));
1334 append_page(*table[3], _("Amp (3)"));
1335 append_page(*table[4], _("Filter (1)"));
1336 append_page(*table[5], _("Filter (2)"));
1337 append_page(*table[6], _("Filter (3)"));
1338 append_page(*table[7], _("Pitch"));
1339 append_page(*table[8], _("Misc"));
1340 append_page(*table[9], _("Script"));
1341
1342 Settings::singleton()->showTooltips.get_proxy().signal_changed().connect(
1343 sigc::mem_fun(*this, &DimRegionEdit::on_show_tooltips_changed)
1344 );
1345
1346 on_show_tooltips_changed();
1347 }
1348
1349 DimRegionEdit::~DimRegionEdit()
1350 {
1351 }
1352
1353 void DimRegionEdit::addString(const char* labelText, Gtk::Label*& label,
1354 Gtk::Entry*& widget)
1355 {
1356 label = new Gtk::Label(Glib::ustring(labelText) + ":");
1357 #if HAS_GTKMM_ALIGNMENT
1358 label->set_alignment(Gtk::ALIGN_START);
1359 #else
1360 label->set_halign(Gtk::Align::START);
1361 #endif
1362
1363 #if USE_GTKMM_GRID
1364 table[pageno]->attach(*label, 1, rowno);
1365 #else
1366 table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,
1367 Gtk::FILL, Gtk::SHRINK);
1368 #endif
1369
1370 widget = new Gtk::Entry();
1371
1372 #if USE_GTKMM_GRID
1373 table[pageno]->attach(*widget, 2, rowno);
1374 #else
1375 table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1,
1376 Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1377 #endif
1378
1379 rowno++;
1380 }
1381
1382 void DimRegionEdit::addString(const char* labelText, Gtk::Label*& label,
1383 Gtk::Entry*& widget, Gtk::Button*& button)
1384 {
1385 label = new Gtk::Label(Glib::ustring(labelText) + ":");
1386 #if HAS_GTKMM_ALIGNMENT
1387 label->set_alignment(Gtk::ALIGN_START);
1388 #else
1389 label->set_halign(Gtk::Align::START);
1390 #endif
1391
1392 #if USE_GTKMM_GRID
1393 table[pageno]->attach(*label, 1, rowno);
1394 #else
1395 table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,
1396 Gtk::FILL, Gtk::SHRINK);
1397 #endif
1398
1399 widget = new Gtk::Entry();
1400 button = new Gtk::Button();
1401
1402 HBox* hbox = new HBox;
1403 hbox->pack_start(*widget);
1404 hbox->pack_start(*button, Gtk::PACK_SHRINK);
1405
1406 #if USE_GTKMM_GRID
1407 table[pageno]->attach(*hbox, 2, rowno);
1408 #else
1409 table[pageno]->attach(*hbox, 2, 3, rowno, rowno + 1,
1410 Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1411 #endif
1412
1413 rowno++;
1414 }
1415
1416 Gtk::Label* DimRegionEdit::addHeader(const char* text)
1417 {
1418 if (firstRowInBlock < rowno - 1)
1419 {
1420 Gtk::Label* filler = new Gtk::Label(" ");
1421 #if USE_GTKMM_GRID
1422 table[pageno]->attach(*filler, 0, firstRowInBlock);
1423 #else
1424 table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,
1425 Gtk::FILL, Gtk::SHRINK);
1426 #endif
1427 }
1428 Glib::ustring str = "<b>";
1429 str += text;
1430 str += "</b>";
1431 Gtk::Label* label = new Gtk::Label(str);
1432 label->set_use_markup();
1433 #if HAS_GTKMM_ALIGNMENT
1434 label->set_alignment(Gtk::ALIGN_START);
1435 #else
1436 label->set_halign(Gtk::Align::START);
1437 #endif
1438 // on GTKMM 3 there is absolutely no margin by default
1439 #if GTKMM_MAJOR_VERSION >= 3
1440 label->set_margin_top(18);
1441 label->set_margin_bottom(13);
1442 #endif
1443 #if USE_GTKMM_GRID
1444 table[pageno]->attach(*label, 0, rowno, 3);
1445 #else
1446 table[pageno]->attach(*label, 0, 3, rowno, rowno + 1,
1447 Gtk::FILL, Gtk::SHRINK);
1448 #endif
1449 rowno++;
1450 firstRowInBlock = rowno;
1451 return label;
1452 }
1453
1454 void DimRegionEdit::on_show_tooltips_changed() {
1455 const bool b = Settings::singleton()->showTooltips;
1456
1457 buttonSelectSample.set_has_tooltip(b);
1458 buttonNullSampleReference->set_has_tooltip(b);
1459 wSample->set_has_tooltip(b);
1460
1461 eEG1StateOptions.on_show_tooltips_changed();
1462 eEG2StateOptions.on_show_tooltips_changed();
1463
1464 set_has_tooltip(b);
1465 }
1466
1467 void DimRegionEdit::nextPage()
1468 {
1469 if (firstRowInBlock < rowno - 1)
1470 {
1471 Gtk::Label* filler = new Gtk::Label(" ");
1472 #if USE_GTKMM_GRID
1473 table[pageno]->attach(*filler, 0, firstRowInBlock);
1474 #else
1475 table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,
1476 Gtk::FILL, Gtk::SHRINK);
1477 #endif
1478 }
1479 pageno++;
1480 rowno = 0;
1481 firstRowInBlock = 0;
1482 }
1483
1484 void DimRegionEdit::addProp(BoolEntry& boolentry)
1485 {
1486 #if USE_GTKMM_GRID
1487 table[pageno]->attach(boolentry.widget, 1, rowno, 2);
1488 #else
1489 table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,
1490 Gtk::FILL, Gtk::SHRINK);
1491 #endif
1492 rowno++;
1493 }
1494
1495 void DimRegionEdit::addProp(LabelWidget& prop)
1496 {
1497 #if USE_GTKMM_GRID
1498 table[pageno]->attach(prop.label, 1, rowno);
1499 table[pageno]->attach(prop.widget, 2, rowno);
1500 #else
1501 table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1,
1502 Gtk::FILL, Gtk::SHRINK);
1503 table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1,
1504 Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1505 #endif
1506 rowno++;
1507 }
1508
1509 void DimRegionEdit::addLine(HBox& line)
1510 {
1511 #if USE_GTKMM_GRID
1512 table[pageno]->attach(line, 1, rowno, 2);
1513 #else
1514 table[pageno]->attach(line, 1, 3, rowno, rowno + 1,
1515 Gtk::FILL, Gtk::SHRINK);
1516 #endif
1517 rowno++;
1518 }
1519
1520 void DimRegionEdit::addRightHandSide(Gtk::Widget& widget)
1521 {
1522 #if USE_GTKMM_GRID
1523 table[pageno]->attach(widget, 2, rowno);
1524 #else
1525 table[pageno]->attach(widget, 2, 3, rowno, rowno + 1,
1526 Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1527 #endif
1528 rowno++;
1529 }
1530
1531 void DimRegionEdit::set_dim_region(gig::DimensionRegion* d)
1532 {
1533 dimregion = d;
1534 velocity_curve.set_dim_region(d);
1535 release_curve.set_dim_region(d);
1536 cutoff_curve.set_dim_region(d);
1537 crossfade_curve.set_dim_region(d);
1538 lfo1Graph.set_dim_region(d);
1539 lfo2Graph.set_dim_region(d);
1540 lfo3Graph.set_dim_region(d);
1541
1542 set_sensitive(d);
1543 if (!d) return;
1544
1545 update_model++;
1546 eEG1PreAttack.set_value(d->EG1PreAttack);
1547 eEG1Attack.set_value(d->EG1Attack);
1548 eEG1Decay1.set_value(d->EG1Decay1);
1549 eEG1Decay2.set_value(d->EG1Decay2);
1550 eEG1InfiniteSustain.set_value(d->EG1InfiniteSustain);
1551 eEG1Sustain.set_value(d->EG1Sustain);
1552 eEG1Release.set_value(d->EG1Release);
1553 eEG1Hold.set_value(d->EG1Hold);
1554 eEG1Controller.set_value(d->EG1Controller);
1555 eEG1ControllerInvert.set_value(d->EG1ControllerInvert);
1556 eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence);
1557 eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence);
1558 eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence);
1559 eEG1StateOptions.checkBoxAttack.set_value(d->EG1Options.AttackCancel);
1560 eEG1StateOptions.checkBoxAttackHold.set_value(d->EG1Options.AttackHoldCancel);
1561 eEG1StateOptions.checkBoxDecay1.set_value(d->EG1Options.Decay1Cancel);
1562 eEG1StateOptions.checkBoxDecay2.set_value(d->EG1Options.Decay2Cancel);
1563 eEG1StateOptions.checkBoxRelease.set_value(d->EG1Options.ReleaseCancel);
1564 eLFO1Wave.set_value(d->LFO1WaveForm);
1565 eLFO1Frequency.set_value(d->LFO1Frequency);
1566 eLFO1Phase.set_value(d->LFO1Phase);
1567 eLFO1InternalDepth.set_value(d->LFO1InternalDepth);
1568 eLFO1ControlDepth.set_value(d->LFO1ControlDepth);
1569 eLFO1Controller.set_value(d->LFO1Controller);
1570 eLFO1FlipPhase.set_value(d->LFO1FlipPhase);
1571 eLFO1Sync.set_value(d->LFO1Sync);
1572 eEG2PreAttack.set_value(d->EG2PreAttack);
1573 eEG2Attack.set_value(d->EG2Attack);
1574 eEG2Decay1.set_value(d->EG2Decay1);
1575 eEG2Decay2.set_value(d->EG2Decay2);
1576 eEG2InfiniteSustain.set_value(d->EG2InfiniteSustain);
1577 eEG2Sustain.set_value(d->EG2Sustain);
1578 eEG2Release.set_value(d->EG2Release);
1579 eEG2Controller.set_value(d->EG2Controller);
1580 eEG2ControllerInvert.set_value(d->EG2ControllerInvert);
1581 eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence);
1582 eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence);
1583 eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence);
1584 eEG2StateOptions.checkBoxAttack.set_value(d->EG2Options.AttackCancel);
1585 eEG2StateOptions.checkBoxAttackHold.set_value(d->EG2Options.AttackHoldCancel);
1586 eEG2StateOptions.checkBoxDecay1.set_value(d->EG2Options.Decay1Cancel);
1587 eEG2StateOptions.checkBoxDecay2.set_value(d->EG2Options.Decay2Cancel);
1588 eEG2StateOptions.checkBoxRelease.set_value(d->EG2Options.ReleaseCancel);
1589 eLFO2Wave.set_value(d->LFO2WaveForm);
1590 eLFO2Frequency.set_value(d->LFO2Frequency);
1591 eLFO2Phase.set_value(d->LFO2Phase);
1592 eLFO2InternalDepth.set_value(d->LFO2InternalDepth);
1593 eLFO2ControlDepth.set_value(d->LFO2ControlDepth);
1594 eLFO2Controller.set_value(d->LFO2Controller);
1595 eLFO2FlipPhase.set_value(d->LFO2FlipPhase);
1596 eLFO2Sync.set_value(d->LFO2Sync);
1597 eEG3Attack.set_value(d->EG3Attack);
1598 eEG3Depth.set_value(d->EG3Depth);
1599 eLFO3Wave.set_value(d->LFO3WaveForm);
1600 eLFO3Frequency.set_value(d->LFO3Frequency);
1601 eLFO3Phase.set_value(d->LFO3Phase);
1602 eLFO3InternalDepth.set_value(d->LFO3InternalDepth);
1603 eLFO3ControlDepth.set_value(d->LFO3ControlDepth);
1604 eLFO3Controller.set_value(d->LFO3Controller);
1605 eLFO3FlipPhase.set_value(d->LFO3FlipPhase);
1606 eLFO3Sync.set_value(d->LFO3Sync);
1607 eVCFEnabled.set_value(d->VCFEnabled);
1608 eVCFType.set_value(d->VCFType);
1609 eVCFCutoffController.set_value(d->VCFCutoffController);
1610 eVCFCutoffControllerInvert.set_value(d->VCFCutoffControllerInvert);
1611 eVCFCutoff.set_value(d->VCFCutoff);
1612 eVCFVelocityCurve.set_value(d->VCFVelocityCurve);
1613 eVCFVelocityScale.set_value(d->VCFVelocityScale);
1614 eVCFVelocityDynamicRange.set_value(d->VCFVelocityDynamicRange);
1615 eVCFResonance.set_value(d->VCFResonance);
1616 eVCFResonanceDynamic.set_value(d->VCFResonanceDynamic);
1617 eVCFResonanceController.set_value(d->VCFResonanceController);
1618 eVCFKeyboardTracking.set_value(d->VCFKeyboardTracking);
1619 eVCFKeyboardTrackingBreakpoint.set_value(d->VCFKeyboardTrackingBreakpoint);
1620 eVelocityResponseCurve.set_value(d->VelocityResponseCurve);
1621 eVelocityResponseDepth.set_value(d->VelocityResponseDepth);
1622 eVelocityResponseCurveScaling.set_value(d->VelocityResponseCurveScaling);
1623 eReleaseVelocityResponseCurve.set_value(d->ReleaseVelocityResponseCurve);
1624 eReleaseVelocityResponseDepth.set_value(d->ReleaseVelocityResponseDepth);
1625 eReleaseTriggerDecay.set_value(d->ReleaseTriggerDecay);
1626 eCrossfade_in_start.set_value(d->Crossfade.in_start);
1627 eCrossfade_in_end.set_value(d->Crossfade.in_end);
1628 eCrossfade_out_start.set_value(d->Crossfade.out_start);
1629 eCrossfade_out_end.set_value(d->Crossfade.out_end);
1630 ePitchTrack.set_value(d->PitchTrack);
1631 eSustainReleaseTrigger.set_value(d->SustainReleaseTrigger);
1632 eNoNoteOffReleaseTrigger.set_value(d->NoNoteOffReleaseTrigger);
1633 eDimensionBypass.set_value(d->DimensionBypass);
1634 ePan.set_value(d->Pan);
1635 eSelfMask.set_value(d->SelfMask);
1636 eAttenuationController.set_value(d->AttenuationController);
1637 eInvertAttenuationController.set_value(d->InvertAttenuationController);
1638 eAttenuationControllerThreshold.set_value(d->AttenuationControllerThreshold);
1639 eChannelOffset.set_value(d->ChannelOffset);
1640 eSustainDefeat.set_value(d->SustainDefeat);
1641 eMSDecode.set_value(d->MSDecode);
1642 eSampleStartOffset.set_value(d->SampleStartOffset);
1643 eUnityNote.set_value(d->UnityNote);
1644 // show sample group name
1645 {
1646 Glib::ustring s = "---";
1647 if (d->pSample && d->pSample->GetGroup())
1648 s = d->pSample->GetGroup()->Name;
1649 eSampleGroup.text.set_text(s);
1650 }
1651 // assemble sample format info string
1652 {
1653 Glib::ustring s;
1654 if (d->pSample) {
1655 switch (d->pSample->Channels) {
1656 case 1: s = _("Mono"); break;
1657 case 2: s = _("Stereo"); break;
1658 default:
1659 s = ToString(d->pSample->Channels) + _(" audio channels");
1660 break;
1661 }
1662 s += " " + ToString(d->pSample->BitDepth) + " Bits";
1663 s += " " + ToString(d->pSample->SamplesPerSecond/1000) + "."
1664 + ToString((d->pSample->SamplesPerSecond%1000)/100) + " kHz";
1665 } else {
1666 s = _("No sample assigned to this dimension region.");
1667 }
1668 eSampleFormatInfo.text.set_text(s);
1669 }
1670 // generate sample's memory address pointer string
1671 {
1672 Glib::ustring s;
1673 if (d->pSample) {
1674 char buf[64] = {};
1675 snprintf(buf, sizeof(buf), "%p", d->pSample);
1676 s = buf;
1677 } else {
1678 s = "---";
1679 }
1680 eSampleID.text.set_text(s);
1681 }
1682 // generate raw wave form data CRC-32 checksum string
1683 {
1684 Glib::ustring s = "---";
1685 if (d->pSample) {
1686 char buf[64] = {};
1687 snprintf(buf, sizeof(buf), "%x", d->pSample->GetWaveDataCRC32Checksum());
1688 s = buf;
1689 }
1690 eChecksum.text.set_text(s);
1691 }
1692 buttonSelectSample.set_sensitive(d && d->pSample);
1693 eFineTune.set_value(d->FineTune);
1694 eGain.set_value(d->Gain);
1695 eSampleLoopEnabled.set_value(d->SampleLoops);
1696 eSampleLoopType.set_value(
1697 d->SampleLoops ? d->pSampleLoops[0].LoopType : 0);
1698 eSampleLoopStart.set_value(
1699 d->SampleLoops ? d->pSampleLoops[0].LoopStart : 0);
1700 eSampleLoopLength.set_value(
1701 d->SampleLoops ? d->pSampleLoops[0].LoopLength : 0);
1702 eSampleLoopInfinite.set_value(
1703 d->pSample && d->pSample->LoopPlayCount == 0);
1704 eSampleLoopPlayCount.set_value(
1705 d->pSample ? d->pSample->LoopPlayCount : 0);
1706 update_model--;
1707
1708 wSample->set_text(d->pSample ? gig_to_utf8(d->pSample->pInfo->Name) :
1709 _("NULL"));
1710
1711 scriptVars.setInstrument(
1712 (gig::Instrument*) d->GetParent()->GetParent()
1713 );
1714
1715 update_loop_elements();
1716 VCFEnabled_toggled();
1717 }
1718
1719
1720 void DimRegionEdit::VCFEnabled_toggled()
1721 {
1722 bool sensitive = eVCFEnabled.get_value();
1723 eVCFType.set_sensitive(sensitive);
1724 eVCFCutoffController.set_sensitive(sensitive);
1725 eVCFVelocityCurve.set_sensitive(sensitive);
1726 eVCFVelocityScale.set_sensitive(sensitive);
1727 eVCFVelocityDynamicRange.set_sensitive(sensitive);
1728 cutoff_curve.set_sensitive(sensitive);
1729 eVCFResonance.set_sensitive(sensitive);
1730 eVCFResonanceController.set_sensitive(sensitive);
1731 eVCFKeyboardTracking.set_sensitive(sensitive);
1732 eVCFKeyboardTrackingBreakpoint.set_sensitive(sensitive);
1733 lEG2->set_sensitive(sensitive);
1734 eEG2PreAttack.set_sensitive(sensitive);
1735 eEG2Attack.set_sensitive(sensitive);
1736 eEG2Decay1.set_sensitive(sensitive);
1737 eEG2InfiniteSustain.set_sensitive(sensitive);
1738 eEG2Sustain.set_sensitive(sensitive);
1739 eEG2Release.set_sensitive(sensitive);
1740 eEG2Controller.set_sensitive(sensitive);
1741 eEG2ControllerAttackInfluence.set_sensitive(sensitive);
1742 eEG2ControllerDecayInfluence.set_sensitive(sensitive);
1743 eEG2ControllerReleaseInfluence.set_sensitive(sensitive);
1744 eEG2StateOptions.set_sensitive(sensitive);
1745 lLFO2->set_sensitive(sensitive);
1746 eLFO2Wave.set_sensitive(sensitive);
1747 eLFO2Frequency.set_sensitive(sensitive);
1748 eLFO2Phase.set_sensitive(sensitive);
1749 eLFO2InternalDepth.set_sensitive(sensitive);
1750 eLFO2ControlDepth.set_sensitive(sensitive);
1751 eLFO2Controller.set_sensitive(sensitive);
1752 eLFO2FlipPhase.set_sensitive(sensitive);
1753 eLFO2Sync.set_sensitive(sensitive);
1754 lfo2Graph.set_sensitive(sensitive);
1755 if (sensitive) {
1756 VCFCutoffController_changed();
1757 VCFResonanceController_changed();
1758 EG2InfiniteSustain_toggled();
1759 EG2Controller_changed();
1760 LFO2Controller_changed();
1761 } else {
1762 eVCFCutoffControllerInvert.set_sensitive(false);
1763 eVCFCutoff.set_sensitive(false);
1764 eVCFResonanceDynamic.set_sensitive(false);
1765 eVCFResonance.set_sensitive(false);
1766 eEG2Decay2.set_sensitive(false);
1767 eEG2ControllerInvert.set_sensitive(false);
1768 eLFO2InternalDepth.set_sensitive(false);
1769 eLFO2ControlDepth.set_sensitive(false);
1770 }
1771 }
1772
1773 void DimRegionEdit::VCFCutoffController_changed()
1774 {
1775 gig::vcf_cutoff_ctrl_t ctrl = eVCFCutoffController.get_value();
1776 bool hasController = ctrl != gig::vcf_cutoff_ctrl_none && ctrl != gig::vcf_cutoff_ctrl_none2;
1777
1778 eVCFCutoffControllerInvert.set_sensitive(hasController);
1779 eVCFCutoff.set_sensitive(!hasController);
1780 eVCFResonanceDynamic.set_sensitive(!hasController);
1781 eVCFVelocityScale.label.set_text(hasController ? _("Minimum cutoff:") :
1782 _("Velocity scale:"));
1783 }
1784
1785 void DimRegionEdit::VCFResonanceController_changed()
1786 {
1787 bool hasController = eVCFResonanceController.get_value() != gig::vcf_res_ctrl_none;
1788 eVCFResonance.set_sensitive(!hasController);
1789 }
1790
1791 void DimRegionEdit::EG1InfiniteSustain_toggled()
1792 {
1793 bool infSus = eEG1InfiniteSustain.get_value();
1794 eEG1Decay2.set_sensitive(!infSus);
1795 }
1796
1797 void DimRegionEdit::EG2InfiniteSustain_toggled()
1798 {
1799 bool infSus = eEG2InfiniteSustain.get_value();
1800 eEG2Decay2.set_sensitive(!infSus);
1801 }
1802
1803 void DimRegionEdit::EG1Controller_changed()
1804 {
1805 bool hasController = eEG1Controller.get_value().type != gig::leverage_ctrl_t::type_none;
1806 eEG1ControllerInvert.set_sensitive(hasController);
1807 }
1808
1809 void DimRegionEdit::EG2Controller_changed()
1810 {
1811 bool hasController = eEG2Controller.get_value().type != gig::leverage_ctrl_t::type_none;
1812 eEG2ControllerInvert.set_sensitive(hasController);
1813 }
1814
1815 void DimRegionEdit::AttenuationController_changed()
1816 {
1817 bool hasController =
1818 eAttenuationController.get_value().type != gig::leverage_ctrl_t::type_none;
1819 eInvertAttenuationController.set_sensitive(hasController);
1820 eAttenuationControllerThreshold.set_sensitive(hasController);
1821 eCrossfade_in_start.set_sensitive(hasController);
1822 eCrossfade_in_end.set_sensitive(hasController);
1823 eCrossfade_out_start.set_sensitive(hasController);
1824 eCrossfade_out_end.set_sensitive(hasController);
1825 crossfade_curve.set_sensitive(hasController);
1826 }
1827
1828 void DimRegionEdit::LFO1Controller_changed()
1829 {
1830 gig::lfo1_ctrl_t ctrl = eLFO1Controller.get_value();
1831 eLFO1ControlDepth.set_sensitive(ctrl != gig::lfo1_ctrl_internal);
1832 eLFO1InternalDepth.set_sensitive(ctrl != gig::lfo1_ctrl_modwheel &&
1833 ctrl != gig::lfo1_ctrl_breath);
1834 }
1835
1836 void DimRegionEdit::LFO2Controller_changed()
1837 {
1838 gig::lfo2_ctrl_t ctrl = eLFO2Controller.get_value();
1839 eLFO2ControlDepth.set_sensitive(ctrl != gig::lfo2_ctrl_internal);
1840 eLFO2InternalDepth.set_sensitive(ctrl != gig::lfo2_ctrl_modwheel &&
1841 ctrl != gig::lfo2_ctrl_foot);
1842 }
1843
1844 void DimRegionEdit::LFO3Controller_changed()
1845 {
1846 gig::lfo3_ctrl_t ctrl = eLFO3Controller.get_value();
1847 eLFO3ControlDepth.set_sensitive(ctrl != gig::lfo3_ctrl_internal);
1848 eLFO3InternalDepth.set_sensitive(ctrl != gig::lfo3_ctrl_modwheel &&
1849 ctrl != gig::lfo3_ctrl_aftertouch);
1850 }
1851
1852 void DimRegionEdit::crossfade1_changed()
1853 {
1854 update_model++;
1855 eCrossfade_in_end.set_value(dimregion->Crossfade.in_end);
1856 eCrossfade_out_start.set_value(dimregion->Crossfade.out_start);
1857 eCrossfade_out_end.set_value(dimregion->Crossfade.out_end);
1858 update_model--;
1859 }
1860
1861 void DimRegionEdit::crossfade2_changed()
1862 {
1863 update_model++;
1864 eCrossfade_in_start.set_value(dimregion->Crossfade.in_start);
1865 eCrossfade_out_start.set_value(dimregion->Crossfade.out_start);
1866 eCrossfade_out_end.set_value(dimregion->Crossfade.out_end);
1867 update_model--;
1868 }
1869
1870 void DimRegionEdit::crossfade3_changed()
1871 {
1872 update_model++;
1873 eCrossfade_in_start.set_value(dimregion->Crossfade.in_start);
1874 eCrossfade_in_end.set_value(dimregion->Crossfade.in_end);
1875 eCrossfade_out_end.set_value(dimregion->Crossfade.out_end);
1876 update_model--;
1877 }
1878
1879 void DimRegionEdit::crossfade4_changed()
1880 {
1881 update_model++;
1882 eCrossfade_in_start.set_value(dimregion->Crossfade.in_start);
1883 eCrossfade_in_end.set_value(dimregion->Crossfade.in_end);
1884 eCrossfade_out_start.set_value(dimregion->Crossfade.out_start);
1885 update_model--;
1886 }
1887
1888 void DimRegionEdit::update_loop_elements()
1889 {
1890 update_model++;
1891 const bool active = eSampleLoopEnabled.get_value();
1892 eSampleLoopStart.set_sensitive(active);
1893 eSampleLoopLength.set_sensitive(active);
1894 eSampleLoopType.set_sensitive(active);
1895 eSampleLoopInfinite.set_sensitive(active && dimregion && dimregion->pSample);
1896 // sample loop shall never be longer than the actual sample size
1897 loop_start_changed();
1898 loop_length_changed();
1899 eSampleLoopStart.set_value(
1900 dimregion->SampleLoops ? dimregion->pSampleLoops[0].LoopStart : 0);
1901 eSampleLoopLength.set_value(
1902 dimregion->SampleLoops ? dimregion->pSampleLoops[0].LoopLength : 0);
1903
1904 eSampleLoopInfinite.set_value(
1905 dimregion->pSample && dimregion->pSample->LoopPlayCount == 0);
1906
1907 loop_infinite_toggled();
1908 update_model--;
1909 }
1910
1911 void DimRegionEdit::loop_start_changed() {
1912 if (dimregion && dimregion->SampleLoops) {
1913 eSampleLoopLength.set_upper(dimregion->pSample ?
1914 dimregion->pSample->SamplesTotal -
1915 dimregion->pSampleLoops[0].LoopStart : 0);
1916 }
1917 }
1918
1919 void DimRegionEdit::loop_length_changed() {
1920 if (dimregion && dimregion->SampleLoops) {
1921 eSampleLoopStart.set_upper(dimregion->pSample ?
1922 dimregion->pSample->SamplesTotal -
1923 dimregion->pSampleLoops[0].LoopLength : 0);
1924 }
1925 }
1926
1927 void DimRegionEdit::loop_infinite_toggled() {
1928 eSampleLoopPlayCount.set_sensitive(
1929 dimregion && dimregion->pSample &&
1930 !eSampleLoopInfinite.get_value() &&
1931 eSampleLoopEnabled.get_value()
1932 );
1933 update_model++;
1934 eSampleLoopPlayCount.set_value(
1935 dimregion->pSample ? dimregion->pSample->LoopPlayCount : 0);
1936 update_model--;
1937 }
1938
1939 bool DimRegionEdit::set_sample(gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop)
1940 {
1941 bool result = false;
1942 for (std::set<gig::DimensionRegion*>::iterator itDimReg = dimregs.begin();
1943 itDimReg != dimregs.end(); ++itDimReg)
1944 {
1945 //NOTE: sample may be NULL !
1946 // (exactly: if called by nullOutSampleReference())
1947 result |= set_sample(*itDimReg, sample, copy_sample_unity, copy_sample_tune, copy_sample_loop);
1948 }
1949 return result;
1950 }
1951
1952 bool DimRegionEdit::set_sample(gig::DimensionRegion* dimreg, gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop)
1953 {
1954 if (dimreg) {
1955 //TODO: we should better move the code from MainWindow::on_sample_label_drop_drag_data_received() here
1956
1957 //NOTE: sample may be NULL !
1958 // (exactly: if called by nullOutSampleReference())
1959
1960 // currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received()
1961 //DimRegionChangeGuard(this, dimregion);
1962
1963 gig::Sample* oldref = dimreg->pSample;
1964
1965 // make sure stereo samples always are the same in both
1966 // dimregs in the samplechannel dimension
1967 int nbDimregs = 1;
1968 gig::DimensionRegion* d[2] = { dimreg, 0 };
1969 if ((sample && sample->Channels == 2) ||
1970 (!sample && oldref && oldref->Channels == 2))
1971 {
1972 gig::Region* region = dimreg->GetParent();
1973
1974 int bitcount = 0;
1975 int stereo_bit = 0;
1976 for (int dim = 0 ; dim < region->Dimensions ; dim++) {
1977 if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) {
1978 stereo_bit = 1 << bitcount;
1979 break;
1980 }
1981 bitcount += region->pDimensionDefinitions[dim].bits;
1982 }
1983
1984 if (stereo_bit) {
1985 int dimregno;
1986 for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) {
1987 if (region->pDimensionRegions[dimregno] == dimreg) {
1988 break;
1989 }
1990 }
1991 d[0] = region->pDimensionRegions[dimregno & ~stereo_bit];
1992 d[1] = region->pDimensionRegions[dimregno | stereo_bit];
1993 nbDimregs = 2;
1994 }
1995 }
1996
1997 for (int i = 0 ; i < nbDimregs ; i++) {
1998 d[i]->pSample = sample;
1999
2000 // copy sample information from Sample to DimensionRegion
2001 if (copy_sample_unity)
2002 d[i]->UnityNote = sample->MIDIUnityNote;
2003 if (copy_sample_tune)
2004 d[i]->FineTune = sample->FineTune;
2005 if (copy_sample_loop) {
2006 int loops = sample->Loops ? 1 : 0;
2007 while (d[i]->SampleLoops > loops) {
2008 d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]);
2009 }
2010 while (d[i]->SampleLoops < sample->Loops) {
2011 DLS::sample_loop_t loop;
2012 d[i]->AddSampleLoop(&loop);
2013 }
2014 if (loops) {
2015 d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t);
2016 d[i]->pSampleLoops[0].LoopType = sample->LoopType;
2017 d[i]->pSampleLoops[0].LoopStart = sample->LoopStart;
2018 d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1;
2019 }
2020 }
2021 }
2022
2023 // update ui
2024 update_model++;
2025 wSample->set_text(
2026 dimreg->pSample ? gig_to_utf8(dimreg->pSample->pInfo->Name) :
2027 _("NULL")
2028 );
2029 eUnityNote.set_value(dimreg->UnityNote);
2030 eFineTune.set_value(dimreg->FineTune);
2031 eSampleLoopEnabled.set_value(dimreg->SampleLoops);
2032 update_loop_elements();
2033 update_model--;
2034
2035 sample_ref_changed_signal.emit(oldref, sample);
2036 return true;
2037 }
2038 return false;
2039 }
2040
2041 sigc::signal<void, gig::DimensionRegion*>& DimRegionEdit::signal_dimreg_to_be_changed() {
2042 return dimreg_to_be_changed_signal;
2043 }
2044
2045 sigc::signal<void, gig::DimensionRegion*>& DimRegionEdit::signal_dimreg_changed() {
2046 return dimreg_changed_signal;
2047 }
2048
2049 sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& DimRegionEdit::signal_sample_ref_changed() {
2050 return sample_ref_changed_signal;
2051 }
2052
2053
2054 void DimRegionEdit::set_UnityNote(gig::DimensionRegion& d, uint8_t value)
2055 {
2056 d.UnityNote = value;
2057 }
2058
2059 void DimRegionEdit::set_FineTune(gig::DimensionRegion& d, int16_t value)
2060 {
2061 d.FineTune = value;
2062 }
2063
2064 void DimRegionEdit::set_Crossfade_in_start(gig::DimensionRegion& d,
2065 uint8_t value)
2066 {
2067 d.Crossfade.in_start = value;
2068 if (d.Crossfade.in_end < value) set_Crossfade_in_end(d, value);
2069 }
2070
2071 void DimRegionEdit::set_Crossfade_in_end(gig::DimensionRegion& d,
2072 uint8_t value)
2073 {
2074 d.Crossfade.in_end = value;
2075 if (value < d.Crossfade.in_start) set_Crossfade_in_start(d, value);
2076 if (value > d.Crossfade.out_start) set_Crossfade_out_start(d, value);
2077 }
2078
2079 void DimRegionEdit::set_Crossfade_out_start(gig::DimensionRegion& d,
2080 uint8_t value)
2081 {
2082 d.Crossfade.out_start = value;
2083 if (value < d.Crossfade.in_end) set_Crossfade_in_end(d, value);
2084 if (value > d.Crossfade.out_end) set_Crossfade_out_end(d, value);
2085 }
2086
2087 void DimRegionEdit::set_Crossfade_out_end(gig::DimensionRegion& d,
2088 uint8_t value)
2089 {
2090 d.Crossfade.out_end = value;
2091 if (value < d.Crossfade.out_start) set_Crossfade_out_start(d, value);
2092 }
2093
2094 void DimRegionEdit::set_Gain(gig::DimensionRegion& d, int32_t value)
2095 {
2096 d.SetGain(value);
2097 }
2098
2099 void DimRegionEdit::set_LoopEnabled(gig::DimensionRegion& d, bool value)
2100 {
2101 if (value) {
2102 // create a new sample loop in case there is none yet
2103 if (!d.SampleLoops) {
2104 DimRegionChangeGuard(this, &d);
2105
2106 DLS::sample_loop_t loop;
2107 loop.LoopType = gig::loop_type_normal;
2108 // loop the whole sample by default
2109 loop.LoopStart = 0;
2110 loop.LoopLength =
2111 (d.pSample) ? d.pSample->SamplesTotal : 0;
2112 d.AddSampleLoop(&loop);
2113 }
2114 } else {
2115 if (d.SampleLoops) {
2116 DimRegionChangeGuard(this, &d);
2117
2118 // delete ALL existing sample loops
2119 while (d.SampleLoops) {
2120 d.DeleteSampleLoop(&d.pSampleLoops[0]);
2121 }
2122 }
2123 }
2124 }
2125
2126 void DimRegionEdit::set_LoopType(gig::DimensionRegion& d, uint32_t value)
2127 {
2128 if (d.SampleLoops) d.pSampleLoops[0].LoopType = value;
2129 }
2130
2131 void DimRegionEdit::set_LoopStart(gig::DimensionRegion& d, uint32_t value)
2132 {
2133 if (d.SampleLoops) {
2134 d.pSampleLoops[0].LoopStart =
2135 d.pSample ?
2136 std::min(value, uint32_t(d.pSample->SamplesTotal -
2137 d.pSampleLoops[0].LoopLength)) :
2138 0;
2139 }
2140 }
2141
2142 void DimRegionEdit::set_LoopLength(gig::DimensionRegion& d, uint32_t value)
2143 {
2144 if (d.SampleLoops) {
2145 d.pSampleLoops[0].LoopLength =
2146 d.pSample ?
2147 std::min(value, uint32_t(d.pSample->SamplesTotal -
2148 d.pSampleLoops[0].LoopStart)) :
2149 0;
2150 }
2151 }
2152
2153 void DimRegionEdit::set_LoopInfinite(gig::DimensionRegion& d, bool value)
2154 {
2155 if (d.pSample) {
2156 if (value) d.pSample->LoopPlayCount = 0;
2157 else if (d.pSample->LoopPlayCount == 0) d.pSample->LoopPlayCount = 1;
2158 }
2159 }
2160
2161 void DimRegionEdit::set_LoopPlayCount(gig::DimensionRegion& d, uint32_t value)
2162 {
2163 if (d.pSample) d.pSample->LoopPlayCount = value;
2164 }
2165
2166 void DimRegionEdit::nullOutSampleReference() {
2167 if (!dimregion) return;
2168 set_sample(NULL/*sample*/, false, false, false);
2169 }
2170
2171 void DimRegionEdit::onButtonSelectSamplePressed() {
2172 if (!dimregion) return;
2173 if (!dimregion->pSample) return;
2174 select_sample_signal.emit(dimregion->pSample);
2175 }
2176
2177 sigc::signal<void, gig::Sample*>& DimRegionEdit::signal_select_sample() {
2178 return select_sample_signal;
2179 }

  ViewVC Help
Powered by ViewVC