/[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 3624 - (show annotations) (download)
Wed Oct 2 17:11:30 2019 UTC (6 months ago) by schoenebeck
File size: 79967 byte(s)
* GIG SOUND FORMAT EXTENSION: Added combo box for selecting a wave form
  type for each one of the 3 LFOs (i.e. for overriding the default LFO
  sine wave form to either triangle, saw or square instead).

* GIG SOUND FORMAT EXTENSION: Added slider for each one of the 3 LFOs
  for altering the phase displacement of the respective LFO (that is
  for moving the LFO's start level horizontally on the time axis).

* GIG SOUND FORMAT EXTENSION: Added checkbox "Flip Phase" to LFO 3
  (the original Gigasampler/GigaStudio software only supported that
  option for LFO 1 and LFO 2).

* Bumped version (1.1.1.svn3).

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

  ViewVC Help
Powered by ViewVC