/[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 3622 - (show annotations) (download)
Tue Oct 1 16:41:06 2019 UTC (10 months, 1 week ago) by schoenebeck
File size: 78664 byte(s)
- LFO Graph: fill background always white.

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

  ViewVC Help
Powered by ViewVC