/[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 3619 - (show annotations) (download)
Tue Oct 1 16:21:28 2019 UTC (6 months ago) by schoenebeck
File size: 78427 byte(s)
* Require C++11 compliant compiler.
* Draw LFO curves according to settings for each one of the 3 LFOs.
* Added 2 new tabs (a 3rd tab for "Amp" and a 3rd tab for "Filter").
* Shortened "Amplitude" -> "Amp" on tabs (to save space).
* Increased default window width 865px -> 960px.
* Bumped version (1.1.1.svn2).

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

  ViewVC Help
Powered by ViewVC