/[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 3737 - (show annotations) (download)
Sat Feb 1 20:39:39 2020 UTC (4 years, 2 months ago) by schoenebeck
File size: 84445 byte(s)
* NKSP: Added support for managing script 'patch' variables for each
  instrument; added a dedicated "Script" tab on right-hand side of Gigedit's
  main window with a list view to manage these variables.

* Bumped version (1.1.1.svn14).

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

  ViewVC Help
Powered by ViewVC