1 |
/* |
/* |
2 |
* Copyright (C) 2006-2010 Andreas Persson |
* Copyright (C) 2006-2015 Andreas Persson |
3 |
* |
* |
4 |
* This program is free software; you can redistribute it and/or |
* This program is free software; you can redistribute it and/or |
5 |
* modify it under the terms of the GNU General Public License as |
* modify it under the terms of the GNU General Public License as |
20 |
#include "dimregionedit.h" |
#include "dimregionedit.h" |
21 |
|
|
22 |
#include "global.h" |
#include "global.h" |
23 |
|
#include "compat.h" |
24 |
|
|
25 |
|
VelocityCurve::VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t)) : |
26 |
|
getter(getter), dimreg(0) { |
27 |
|
set_size_request(80, 80); |
28 |
|
} |
29 |
|
|
30 |
|
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
31 |
|
bool VelocityCurve::on_expose_event(GdkEventExpose* e) { |
32 |
|
const Cairo::RefPtr<Cairo::Context>& cr = |
33 |
|
get_window()->create_cairo_context(); |
34 |
|
#if 0 |
35 |
|
} |
36 |
|
#endif |
37 |
|
#else |
38 |
|
bool VelocityCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { |
39 |
|
#endif |
40 |
|
if (dimreg) { |
41 |
|
int w = get_width(); |
42 |
|
int h = get_height(); |
43 |
|
|
44 |
|
for (int pass = 0 ; pass < 2 ; pass++) { |
45 |
|
for (double x = 0 ; x <= w ; x++) { |
46 |
|
int vel = int(x * (127 - 1e-10) / w + 1); |
47 |
|
double y = (1 - (dimreg->*getter)(vel)) * (h - 3) + 1.5; |
48 |
|
|
49 |
|
if (x < 1e-10) { |
50 |
|
cr->move_to(x, y); |
51 |
|
} else { |
52 |
|
cr->line_to(x, y); |
53 |
|
} |
54 |
|
} |
55 |
|
if (pass == 0) { |
56 |
|
cr->line_to(w, h); |
57 |
|
cr->line_to(0, h); |
58 |
|
cr->set_source_rgba(0.5, 0.44, 1.0, is_sensitive() ? 0.2 : 0.1); |
59 |
|
cr->fill(); |
60 |
|
} else { |
61 |
|
cr->set_line_width(3); |
62 |
|
cr->set_source_rgba(0.5, 0.44, 1.0, is_sensitive() ? 1.0 : 0.3); |
63 |
|
cr->stroke(); |
64 |
|
} |
65 |
|
} |
66 |
|
} |
67 |
|
return true; |
68 |
|
} |
69 |
|
|
70 |
|
|
71 |
|
CrossfadeCurve::CrossfadeCurve() : dimreg(0) { |
72 |
|
set_size_request(280, 80); |
73 |
|
} |
74 |
|
|
75 |
|
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
76 |
|
bool CrossfadeCurve::on_expose_event(GdkEventExpose* e) { |
77 |
|
const Cairo::RefPtr<Cairo::Context>& cr = |
78 |
|
get_window()->create_cairo_context(); |
79 |
|
#if 0 |
80 |
|
} |
81 |
|
#endif |
82 |
|
#else |
83 |
|
bool CrossfadeCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { |
84 |
|
#endif |
85 |
|
if (dimreg) { |
86 |
|
cr->translate(1.5, 0); |
87 |
|
|
88 |
|
// first, draw curves for the other layers |
89 |
|
gig::Region* region = dimreg->GetParent(); |
90 |
|
int dimregno; |
91 |
|
for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) { |
92 |
|
if (region->pDimensionRegions[dimregno] == dimreg) { |
93 |
|
break; |
94 |
|
} |
95 |
|
} |
96 |
|
int bitcount = 0; |
97 |
|
for (int dim = 0 ; dim < region->Dimensions ; dim++) { |
98 |
|
if (region->pDimensionDefinitions[dim].dimension == |
99 |
|
gig::dimension_layer) { |
100 |
|
int mask = |
101 |
|
~(((1 << region->pDimensionDefinitions[dim].bits) - 1) << |
102 |
|
bitcount); |
103 |
|
int c = dimregno & mask; // mask away the layer dimension |
104 |
|
|
105 |
|
for (int i = 0 ; i < region->pDimensionDefinitions[dim].zones ; |
106 |
|
i++) { |
107 |
|
gig::DimensionRegion* d = |
108 |
|
region->pDimensionRegions[c + (i << bitcount)]; |
109 |
|
if (d != dimreg) { |
110 |
|
draw_one_curve(cr, d, false); |
111 |
|
} |
112 |
|
} |
113 |
|
break; |
114 |
|
} |
115 |
|
bitcount += region->pDimensionDefinitions[dim].bits; |
116 |
|
} |
117 |
|
|
118 |
|
// then, draw the currently selected layer |
119 |
|
draw_one_curve(cr, dimreg, is_sensitive()); |
120 |
|
} |
121 |
|
return true; |
122 |
|
} |
123 |
|
|
124 |
|
void CrossfadeCurve::draw_one_curve(const Cairo::RefPtr<Cairo::Context>& cr, |
125 |
|
const gig::DimensionRegion* d, |
126 |
|
bool sensitive) { |
127 |
|
int w = get_width(); |
128 |
|
int h = get_height(); |
129 |
|
|
130 |
|
if (d->Crossfade.out_end) { |
131 |
|
for (int pass = 0 ; pass < 2 ; pass++) { |
132 |
|
cr->move_to(d->Crossfade.in_start / 127.0 * (w - 3), h); |
133 |
|
cr->line_to(d->Crossfade.in_end / 127.0 * (w - 3), 1.5); |
134 |
|
cr->line_to(d->Crossfade.out_start / 127.0 * (w - 3), 1.5); |
135 |
|
cr->line_to(d->Crossfade.out_end / 127.0 * (w - 3), h); |
136 |
|
|
137 |
|
if (pass == 0) { |
138 |
|
cr->set_source_rgba(0.5, 0.44, 1.0, sensitive ? 0.2 : 0.1); |
139 |
|
cr->fill(); |
140 |
|
} else { |
141 |
|
cr->set_line_width(3); |
142 |
|
cr->set_source_rgba(0.5, 0.44, 1.0, sensitive ? 1.0 : 0.3); |
143 |
|
cr->stroke(); |
144 |
|
} |
145 |
|
} |
146 |
|
} |
147 |
|
} |
148 |
|
|
149 |
|
|
150 |
DimRegionEdit::DimRegionEdit() : |
DimRegionEdit::DimRegionEdit() : |
151 |
eEG1PreAttack(_("Pre-attack"), 0, 100, 2), |
velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation), |
152 |
eEG1Attack(_("Attack"), 0, 60, 3), |
release_curve(&gig::DimensionRegion::GetVelocityRelease), |
153 |
eEG1Decay1(_("Decay 1"), 0.005, 60, 3), |
cutoff_curve(&gig::DimensionRegion::GetVelocityCutoff), |
154 |
eEG1Decay2(_("Decay 2"), 0, 60, 3), |
eEG1PreAttack(_("Pre-attack Level (%)"), 0, 100, 2), |
155 |
|
eEG1Attack(_("Attack Time (seconds)"), 0, 60, 3), |
156 |
|
eEG1Decay1(_("Decay 1 Time (seconds)"), 0.005, 60, 3), |
157 |
|
eEG1Decay2(_("Decay 2 Time (seconds)"), 0, 60, 3), |
158 |
eEG1InfiniteSustain(_("Infinite sustain")), |
eEG1InfiniteSustain(_("Infinite sustain")), |
159 |
eEG1Sustain(_("Sustain"), 0, 100, 2), |
eEG1Sustain(_("Sustain Level (%)"), 0, 100, 2), |
160 |
eEG1Release(_("Release"), 0, 60, 3), |
eEG1Release(_("Release Time (seconds)"), 0, 60, 3), |
161 |
eEG1Hold(_("Hold")), |
eEG1Hold(_("Hold Attack Stage until Loop End")), |
162 |
eEG1Controller(_("Controller")), |
eEG1Controller(_("Controller")), |
163 |
eEG1ControllerInvert(_("Controller invert")), |
eEG1ControllerInvert(_("Controller invert")), |
164 |
eEG1ControllerAttackInfluence(_("Controller attack influence"), 0, 3), |
eEG1ControllerAttackInfluence(_("Controller attack influence"), 0, 3), |
170 |
eLFO1Controller(_("Controller")), |
eLFO1Controller(_("Controller")), |
171 |
eLFO1FlipPhase(_("Flip phase")), |
eLFO1FlipPhase(_("Flip phase")), |
172 |
eLFO1Sync(_("Sync")), |
eLFO1Sync(_("Sync")), |
173 |
eEG2PreAttack(_("Pre-attack"), 0, 100, 2), |
eEG2PreAttack(_("Pre-attack Level (%)"), 0, 100, 2), |
174 |
eEG2Attack(_("Attack"), 0, 60, 3), |
eEG2Attack(_("Attack Time (seconds)"), 0, 60, 3), |
175 |
eEG2Decay1(_("Decay 1"), 0.005, 60, 3), |
eEG2Decay1(_("Decay 1 Time (seconds)"), 0.005, 60, 3), |
176 |
eEG2Decay2(_("Decay 2"), 0, 60, 3), |
eEG2Decay2(_("Decay 2 Time (seconds)"), 0, 60, 3), |
177 |
eEG2InfiniteSustain(_("Infinite sustain")), |
eEG2InfiniteSustain(_("Infinite sustain")), |
178 |
eEG2Sustain(_("Sustain"), 0, 100, 2), |
eEG2Sustain(_("Sustain Level (%)"), 0, 100, 2), |
179 |
eEG2Release(_("Release"), 0, 60, 3), |
eEG2Release(_("Release Time (seconds)"), 0, 60, 3), |
180 |
eEG2Controller(_("Controller")), |
eEG2Controller(_("Controller")), |
181 |
eEG2ControllerInvert(_("Controller invert")), |
eEG2ControllerInvert(_("Controller invert")), |
182 |
eEG2ControllerAttackInfluence(_("Controller attack influence"), 0, 3), |
eEG2ControllerAttackInfluence(_("Controller attack influence"), 0, 3), |
221 |
ePitchTrack(_("Pitch track")), |
ePitchTrack(_("Pitch track")), |
222 |
eDimensionBypass(_("Dimension bypass")), |
eDimensionBypass(_("Dimension bypass")), |
223 |
ePan(_("Pan"), -64, 63), |
ePan(_("Pan"), -64, 63), |
224 |
eSelfMask(_("Self mask")), |
eSelfMask(_("Kill lower velocity voices (a.k.a \"Self mask\")")), |
225 |
eAttenuationController(_("Attenuation controller")), |
eAttenuationController(_("Attenuation controller")), |
226 |
eInvertAttenuationController(_("Invert attenuation controller")), |
eInvertAttenuationController(_("Invert attenuation controller")), |
227 |
eAttenuationControllerThreshold(_("Attenuation controller threshold")), |
eAttenuationControllerThreshold(_("Attenuation controller threshold")), |
228 |
eChannelOffset(_("Channel offset"), 0, 9), |
eChannelOffset(_("Channel offset"), 0, 9), |
229 |
eSustainDefeat(_("Sustain defeat")), |
eSustainDefeat(_("Ignore Hold Pedal (a.k.a. \"Sustain defeat\")")), |
230 |
eMSDecode(_("MS decode")), |
eMSDecode(_("Decode Mid/Side Recordings")), |
231 |
eSampleStartOffset(_("Sample start offset"), 0, 2000), |
eSampleStartOffset(_("Sample start offset"), 0, 2000), |
232 |
eUnityNote(_("Unity note")), |
eUnityNote(_("Unity note")), |
233 |
|
eSampleFormatInfo(_("Sample Format")), |
234 |
|
eSampleID("Sample ID"), |
235 |
eFineTune(_("Fine tune"), -49, 50), |
eFineTune(_("Fine tune"), -49, 50), |
236 |
eGain(_("Gain"), -96, 0, 2, -655360), |
eGain(_("Gain"), -96, 0, 2, -655360), |
237 |
eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360), |
eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360), |
241 |
eSampleLoopType(_("Loop type")), |
eSampleLoopType(_("Loop type")), |
242 |
eSampleLoopInfinite(_("Infinite loop")), |
eSampleLoopInfinite(_("Infinite loop")), |
243 |
eSampleLoopPlayCount(_("Playback count"), 1), |
eSampleLoopPlayCount(_("Playback count"), 1), |
244 |
|
buttonSelectSample(UNICODE_LEFT_ARROW + " " + _("Select Sample")), |
245 |
update_model(0) |
update_model(0) |
246 |
{ |
{ |
247 |
connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack); |
connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack); |
351 |
connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength); |
connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength); |
352 |
connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite); |
connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite); |
353 |
connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount); |
connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount); |
354 |
|
buttonSelectSample.signal_clicked().connect( |
355 |
|
sigc::mem_fun(*this, &DimRegionEdit::onButtonSelectSamplePressed) |
356 |
|
); |
357 |
|
|
358 |
for (int i = 0 ; i < 7 ; i++) { |
for (int i = 0 ; i < 7 ; i++) { |
359 |
table[i] = new Gtk::Table(3, 1); |
table[i] = new Gtk::Table(3, 1); |
364 |
eUnityNote.set_tip( |
eUnityNote.set_tip( |
365 |
_("Note this sample is associated with (a.k.a. 'root note')") |
_("Note this sample is associated with (a.k.a. 'root note')") |
366 |
); |
); |
367 |
|
buttonSelectSample.set_tooltip_text( |
368 |
|
_("Selects the sample of this dimension region on the left hand side's sample tree view.") |
369 |
|
); |
370 |
eSampleStartOffset.set_tip(_("Sample position at which playback should be started")); |
eSampleStartOffset.set_tip(_("Sample position at which playback should be started")); |
371 |
ePan.set_tip(_("Stereo balance (left/right)")); |
ePan.set_tip(_("Stereo balance (left/right)")); |
372 |
eChannelOffset.set_tip( |
eChannelOffset.set_tip( |
397 |
"Caution: this setting is stored on Sample side, thus is shared " |
"Caution: this setting is stored on Sample side, thus is shared " |
398 |
"among all dimension regions that use this sample!") |
"among all dimension regions that use this sample!") |
399 |
); |
); |
400 |
|
|
401 |
|
eEG1PreAttack.set_tip( |
402 |
|
"Very first level this EG starts with. It rises then in Attack Time " |
403 |
|
"seconds from this initial level to 100%." |
404 |
|
); |
405 |
|
eEG1Attack.set_tip( |
406 |
|
"Duration of the EG's Attack stage, which raises its level from " |
407 |
|
"Pre-Attack Level to 100%." |
408 |
|
); |
409 |
|
eEG1Hold.set_tip( |
410 |
|
"On looped sounds, enabling this will cause the Decay 1 stage not to " |
411 |
|
"enter before the loop has been passed one time." |
412 |
|
); |
413 |
|
eAttenuationController.set_tip(_( |
414 |
|
"If you are not using the 'Layer' dimension, then this controller " |
415 |
|
"simply alters the volume. If you are using the 'Layer' dimension, " |
416 |
|
"then this controller is controlling the crossfade between Layers in " |
417 |
|
"real-time." |
418 |
|
)); |
419 |
|
|
420 |
|
eLFO1Sync.set_tip( |
421 |
|
"If not checked, every voice will use its own LFO instance, which " |
422 |
|
"causes voices triggered at different points in time to have different " |
423 |
|
"LFO levels. By enabling 'Sync' here the voices will instead use and " |
424 |
|
"share one single LFO, causing all voices to have the same LFO level, " |
425 |
|
"no matter when the individual notes have been triggered." |
426 |
|
); |
427 |
|
eLFO2Sync.set_tip( |
428 |
|
"If not checked, every voice will use its own LFO instance, which " |
429 |
|
"causes voices triggered at different points in time to have different " |
430 |
|
"LFO levels. By enabling 'Sync' here the voices will instead use and " |
431 |
|
"share one single LFO, causing all voices to have the same LFO level, " |
432 |
|
"no matter when the individual notes have been triggered." |
433 |
|
); |
434 |
|
eLFO3Sync.set_tip( |
435 |
|
"If not checked, every voice will use its own LFO instance, which " |
436 |
|
"causes voices triggered at different points in time to have different " |
437 |
|
"LFO levels. By enabling 'Sync' here the voices will instead use and " |
438 |
|
"share one single LFO, causing all voices to have the same LFO level, " |
439 |
|
"no matter when the individual notes have been triggered." |
440 |
|
); |
441 |
|
eLFO1FlipPhase.set_tip( |
442 |
|
"Inverts the LFO's generated wave vertically." |
443 |
|
); |
444 |
|
eLFO2FlipPhase.set_tip( |
445 |
|
"Inverts the LFO's generated wave vertically." |
446 |
|
); |
447 |
|
|
448 |
pageno = 0; |
pageno = 0; |
449 |
rowno = 0; |
rowno = 0; |
450 |
firstRowInBlock = 0; |
firstRowInBlock = 0; |
451 |
|
|
452 |
addHeader(_("Mandatory Settings")); |
addHeader(_("Mandatory Settings")); |
453 |
addString(_("Sample"), lSample, wSample); |
addString(_("Sample"), lSample, wSample, buttonNullSampleReference); |
454 |
|
buttonNullSampleReference->set_label("X"); |
455 |
|
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.")); |
456 |
|
buttonNullSampleReference->signal_clicked().connect( |
457 |
|
sigc::mem_fun(*this, &DimRegionEdit::nullOutSampleReference) |
458 |
|
); |
459 |
//TODO: the following would break drag&drop: wSample->property_editable().set_value(false); or this: wSample->set_editable(false); |
//TODO: the following would break drag&drop: wSample->property_editable().set_value(false); or this: wSample->set_editable(false); |
460 |
#ifdef OLD_TOOLTIPS |
#ifdef OLD_TOOLTIPS |
461 |
tooltips.set_tip(*wSample, _("Drop a sample here")); |
tooltips.set_tip(*wSample, _("Drag & drop a sample here")); |
462 |
#else |
#else |
463 |
wSample->set_tooltip_text(_("Drop a sample here")); |
wSample->set_tooltip_text(_("Drag & drop a sample here")); |
464 |
#endif |
#endif |
465 |
addProp(eUnityNote); |
addProp(eUnityNote); |
466 |
|
addProp(eSampleFormatInfo); |
467 |
|
addProp(eSampleID); |
468 |
|
addRightHandSide(buttonSelectSample); |
469 |
addHeader(_("Optional Settings")); |
addHeader(_("Optional Settings")); |
470 |
addProp(eSampleStartOffset); |
addProp(eSampleStartOffset); |
471 |
addProp(eChannelOffset); |
addProp(eChannelOffset); |
495 |
addHeader(_("Amplitude Envelope (EG1)")); |
addHeader(_("Amplitude Envelope (EG1)")); |
496 |
addProp(eEG1PreAttack); |
addProp(eEG1PreAttack); |
497 |
addProp(eEG1Attack); |
addProp(eEG1Attack); |
498 |
|
addProp(eEG1Hold); |
499 |
addProp(eEG1Decay1); |
addProp(eEG1Decay1); |
500 |
addProp(eEG1Decay2); |
addProp(eEG1Decay2); |
501 |
addProp(eEG1InfiniteSustain); |
addProp(eEG1InfiniteSustain); |
502 |
addProp(eEG1Sustain); |
addProp(eEG1Sustain); |
503 |
addProp(eEG1Release); |
addProp(eEG1Release); |
|
addProp(eEG1Hold); |
|
504 |
addProp(eEG1Controller); |
addProp(eEG1Controller); |
505 |
addProp(eEG1ControllerInvert); |
addProp(eEG1ControllerInvert); |
506 |
addProp(eEG1ControllerAttackInfluence); |
addProp(eEG1ControllerAttackInfluence); |
537 |
addProp(eCrossfade_out_start); |
addProp(eCrossfade_out_start); |
538 |
addProp(eCrossfade_out_end); |
addProp(eCrossfade_out_end); |
539 |
|
|
540 |
|
Gtk::Frame* frame = new Gtk::Frame; |
541 |
|
frame->add(crossfade_curve); |
542 |
|
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
543 |
|
Gtk::SHRINK, Gtk::SHRINK); |
544 |
|
rowno++; |
545 |
|
|
546 |
|
eCrossfade_in_start.signal_value_changed().connect( |
547 |
|
sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw)); |
548 |
|
eCrossfade_in_end.signal_value_changed().connect( |
549 |
|
sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw)); |
550 |
|
eCrossfade_out_start.signal_value_changed().connect( |
551 |
|
sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw)); |
552 |
|
eCrossfade_out_end.signal_value_changed().connect( |
553 |
|
sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw)); |
554 |
|
|
555 |
nextPage(); |
nextPage(); |
556 |
|
|
557 |
addHeader(_("General Filter Settings")); |
addHeader(_("General Filter Settings")); |
602 |
addProp(eVCFVelocityCurve); |
addProp(eVCFVelocityCurve); |
603 |
addProp(eVCFVelocityScale); |
addProp(eVCFVelocityScale); |
604 |
addProp(eVCFVelocityDynamicRange); |
addProp(eVCFVelocityDynamicRange); |
605 |
|
|
606 |
|
eVCFCutoffController.signal_value_changed().connect( |
607 |
|
sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw)); |
608 |
|
eVCFVelocityCurve.signal_value_changed().connect( |
609 |
|
sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw)); |
610 |
|
eVCFVelocityScale.signal_value_changed().connect( |
611 |
|
sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw)); |
612 |
|
eVCFVelocityDynamicRange.signal_value_changed().connect( |
613 |
|
sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw)); |
614 |
|
|
615 |
|
frame = new Gtk::Frame; |
616 |
|
frame->add(cutoff_curve); |
617 |
|
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
618 |
|
Gtk::SHRINK, Gtk::SHRINK); |
619 |
|
rowno++; |
620 |
|
|
621 |
addProp(eVCFResonance); |
addProp(eVCFResonance); |
622 |
addProp(eVCFResonanceDynamic); |
addProp(eVCFResonanceDynamic); |
623 |
{ |
{ |
700 |
|
|
701 |
nextPage(); |
nextPage(); |
702 |
|
|
703 |
|
addHeader(_("Velocity Response")); |
704 |
eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values); |
eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values); |
705 |
addProp(eVelocityResponseCurve); |
addProp(eVelocityResponseCurve); |
706 |
addProp(eVelocityResponseDepth); |
addProp(eVelocityResponseDepth); |
707 |
addProp(eVelocityResponseCurveScaling); |
addProp(eVelocityResponseCurveScaling); |
708 |
|
|
709 |
|
eVelocityResponseCurve.signal_value_changed().connect( |
710 |
|
sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw)); |
711 |
|
eVelocityResponseDepth.signal_value_changed().connect( |
712 |
|
sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw)); |
713 |
|
eVelocityResponseCurveScaling.signal_value_changed().connect( |
714 |
|
sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw)); |
715 |
|
|
716 |
|
frame = new Gtk::Frame; |
717 |
|
frame->add(velocity_curve); |
718 |
|
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
719 |
|
Gtk::SHRINK, Gtk::SHRINK); |
720 |
|
rowno++; |
721 |
|
|
722 |
|
addHeader(_("Release Velocity Response")); |
723 |
eReleaseVelocityResponseCurve.set_choices(curve_type_texts, |
eReleaseVelocityResponseCurve.set_choices(curve_type_texts, |
724 |
curve_type_values); |
curve_type_values); |
725 |
addProp(eReleaseVelocityResponseCurve); |
addProp(eReleaseVelocityResponseCurve); |
726 |
addProp(eReleaseVelocityResponseDepth); |
addProp(eReleaseVelocityResponseDepth); |
727 |
|
|
728 |
|
eReleaseVelocityResponseCurve.signal_value_changed().connect( |
729 |
|
sigc::mem_fun(release_curve, &VelocityCurve::queue_draw)); |
730 |
|
eReleaseVelocityResponseDepth.signal_value_changed().connect( |
731 |
|
sigc::mem_fun(release_curve, &VelocityCurve::queue_draw)); |
732 |
|
frame = new Gtk::Frame; |
733 |
|
frame->add(release_curve); |
734 |
|
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
735 |
|
Gtk::SHRINK, Gtk::SHRINK); |
736 |
|
rowno++; |
737 |
|
|
738 |
addProp(eReleaseTriggerDecay); |
addProp(eReleaseTriggerDecay); |
739 |
{ |
{ |
740 |
const char* choices[] = { _("none"), _("effect4depth"), _("effect5depth"), 0 }; |
const char* choices[] = { _("none"), _("effect4depth"), _("effect5depth"), 0 }; |
746 |
eDimensionBypass.set_choices(choices, values); |
eDimensionBypass.set_choices(choices, values); |
747 |
} |
} |
748 |
addProp(eDimensionBypass); |
addProp(eDimensionBypass); |
749 |
|
eSelfMask.widget.set_tooltip_text(_( |
750 |
|
"If enabled: new notes with higher velocity value will stop older " |
751 |
|
"notes with lower velocity values, that way you can save voices that " |
752 |
|
"would barely be audible. This is also useful for certain drum sounds." |
753 |
|
)); |
754 |
addProp(eSelfMask); |
addProp(eSelfMask); |
755 |
|
eSustainDefeat.widget.set_tooltip_text(_( |
756 |
|
"If enabled: sustain pedal will not hold a note. This way you can use " |
757 |
|
"the sustain pedal for other purposes, for example to switch among " |
758 |
|
"dimension regions." |
759 |
|
)); |
760 |
addProp(eSustainDefeat); |
addProp(eSustainDefeat); |
761 |
|
eMSDecode.widget.set_tooltip_text(_( |
762 |
|
"Defines if Mid/Side Recordings should be decoded. Mid/Side Recordings " |
763 |
|
"are an alternative way to record sounds in stereo. The sampler needs " |
764 |
|
"to decode such samples to actually make use of them. Note: this " |
765 |
|
"feature is currently not supported by LinuxSampler." |
766 |
|
)); |
767 |
addProp(eMSDecode); |
addProp(eMSDecode); |
768 |
|
|
769 |
nextPage(); |
nextPage(); |
827 |
Gtk::Entry*& widget) |
Gtk::Entry*& widget) |
828 |
{ |
{ |
829 |
label = new Gtk::Label(Glib::ustring(labelText) + ":"); |
label = new Gtk::Label(Glib::ustring(labelText) + ":"); |
830 |
label->set_alignment(Gtk::ALIGN_LEFT); |
label->set_alignment(Gtk::ALIGN_START); |
831 |
|
|
832 |
table[pageno]->attach(*label, 1, 2, rowno, rowno + 1, |
table[pageno]->attach(*label, 1, 2, rowno, rowno + 1, |
833 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
840 |
rowno++; |
rowno++; |
841 |
} |
} |
842 |
|
|
843 |
|
void DimRegionEdit::addString(const char* labelText, Gtk::Label*& label, |
844 |
|
Gtk::Entry*& widget, Gtk::Button*& button) |
845 |
|
{ |
846 |
|
label = new Gtk::Label(Glib::ustring(labelText) + ":"); |
847 |
|
label->set_alignment(Gtk::ALIGN_START); |
848 |
|
|
849 |
|
table[pageno]->attach(*label, 1, 2, rowno, rowno + 1, |
850 |
|
Gtk::FILL, Gtk::SHRINK); |
851 |
|
|
852 |
|
widget = new Gtk::Entry(); |
853 |
|
button = new Gtk::Button(); |
854 |
|
|
855 |
|
Gtk::HBox* hbox = new Gtk::HBox; |
856 |
|
hbox->pack_start(*widget); |
857 |
|
hbox->pack_start(*button, Gtk::PACK_SHRINK); |
858 |
|
|
859 |
|
table[pageno]->attach(*hbox, 2, 3, rowno, rowno + 1, |
860 |
|
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
861 |
|
|
862 |
|
rowno++; |
863 |
|
} |
864 |
|
|
865 |
Gtk::Label* DimRegionEdit::addHeader(const char* text) |
Gtk::Label* DimRegionEdit::addHeader(const char* text) |
866 |
{ |
{ |
867 |
if (firstRowInBlock < rowno - 1) |
if (firstRowInBlock < rowno - 1) |
875 |
str += "</b>"; |
str += "</b>"; |
876 |
Gtk::Label* label = new Gtk::Label(str); |
Gtk::Label* label = new Gtk::Label(str); |
877 |
label->set_use_markup(); |
label->set_use_markup(); |
878 |
label->set_alignment(Gtk::ALIGN_LEFT); |
label->set_alignment(Gtk::ALIGN_START); |
879 |
table[pageno]->attach(*label, 0, 3, rowno, rowno + 1, |
table[pageno]->attach(*label, 0, 3, rowno, rowno + 1, |
880 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
881 |
rowno++; |
rowno++; |
919 |
rowno++; |
rowno++; |
920 |
} |
} |
921 |
|
|
922 |
|
void DimRegionEdit::addRightHandSide(Gtk::Widget& widget) |
923 |
|
{ |
924 |
|
table[pageno]->attach(widget, 2, 3, rowno, rowno + 1, |
925 |
|
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
926 |
|
rowno++; |
927 |
|
} |
928 |
|
|
929 |
void DimRegionEdit::set_dim_region(gig::DimensionRegion* d) |
void DimRegionEdit::set_dim_region(gig::DimensionRegion* d) |
930 |
{ |
{ |
931 |
dimregion = d; |
dimregion = d; |
932 |
|
velocity_curve.set_dim_region(d); |
933 |
|
release_curve.set_dim_region(d); |
934 |
|
cutoff_curve.set_dim_region(d); |
935 |
|
crossfade_curve.set_dim_region(d); |
936 |
|
|
937 |
set_sensitive(d); |
set_sensitive(d); |
938 |
if (!d) return; |
if (!d) return; |
1017 |
eMSDecode.set_value(d->MSDecode); |
eMSDecode.set_value(d->MSDecode); |
1018 |
eSampleStartOffset.set_value(d->SampleStartOffset); |
eSampleStartOffset.set_value(d->SampleStartOffset); |
1019 |
eUnityNote.set_value(d->UnityNote); |
eUnityNote.set_value(d->UnityNote); |
1020 |
|
// assemble sample format info string |
1021 |
|
{ |
1022 |
|
Glib::ustring s; |
1023 |
|
if (d->pSample) { |
1024 |
|
switch (d->pSample->Channels) { |
1025 |
|
case 1: s = _("Mono"); break; |
1026 |
|
case 2: s = _("Stereo"); break; |
1027 |
|
default: |
1028 |
|
s = ToString(d->pSample->Channels) + _(" audio channels"); |
1029 |
|
break; |
1030 |
|
} |
1031 |
|
s += " " + ToString(d->pSample->BitDepth) + " Bits"; |
1032 |
|
s += " " + ToString(d->pSample->SamplesPerSecond/1000) + "." |
1033 |
|
+ ToString((d->pSample->SamplesPerSecond%1000)/100) + " kHz"; |
1034 |
|
} else { |
1035 |
|
s = _("No sample assigned to this dimension region."); |
1036 |
|
} |
1037 |
|
eSampleFormatInfo.text.set_text(s); |
1038 |
|
} |
1039 |
|
// generate sample's memory address pointer string |
1040 |
|
{ |
1041 |
|
Glib::ustring s; |
1042 |
|
if (d->pSample) { |
1043 |
|
char buf[64] = {}; |
1044 |
|
snprintf(buf, sizeof(buf), "%p", d->pSample); |
1045 |
|
s = buf; |
1046 |
|
} else { |
1047 |
|
s = "---"; |
1048 |
|
} |
1049 |
|
eSampleID.text.set_text(s); |
1050 |
|
} |
1051 |
|
buttonSelectSample.set_sensitive(d && d->pSample); |
1052 |
eFineTune.set_value(d->FineTune); |
eFineTune.set_value(d->FineTune); |
1053 |
eGain.set_value(d->Gain); |
eGain.set_value(d->Gain); |
1054 |
eGainPlus6.set_value(d->Gain); |
eGainPlus6.set_value(d->Gain); |
1065 |
d->pSample ? d->pSample->LoopPlayCount : 0); |
d->pSample ? d->pSample->LoopPlayCount : 0); |
1066 |
update_model--; |
update_model--; |
1067 |
|
|
1068 |
wSample->set_text(d->pSample ? d->pSample->pInfo->Name.c_str() : _("NULL")); |
wSample->set_text(d->pSample ? gig_to_utf8(d->pSample->pInfo->Name) : |
1069 |
|
_("NULL")); |
1070 |
|
|
1071 |
update_loop_elements(); |
update_loop_elements(); |
1072 |
VCFEnabled_toggled(); |
VCFEnabled_toggled(); |
1081 |
eVCFVelocityCurve.set_sensitive(sensitive); |
eVCFVelocityCurve.set_sensitive(sensitive); |
1082 |
eVCFVelocityScale.set_sensitive(sensitive); |
eVCFVelocityScale.set_sensitive(sensitive); |
1083 |
eVCFVelocityDynamicRange.set_sensitive(sensitive); |
eVCFVelocityDynamicRange.set_sensitive(sensitive); |
1084 |
|
cutoff_curve.set_sensitive(sensitive); |
1085 |
eVCFResonance.set_sensitive(sensitive); |
eVCFResonance.set_sensitive(sensitive); |
1086 |
eVCFResonanceController.set_sensitive(sensitive); |
eVCFResonanceController.set_sensitive(sensitive); |
1087 |
eVCFKeyboardTracking.set_sensitive(sensitive); |
eVCFKeyboardTracking.set_sensitive(sensitive); |
1174 |
eCrossfade_in_end.set_sensitive(hasController); |
eCrossfade_in_end.set_sensitive(hasController); |
1175 |
eCrossfade_out_start.set_sensitive(hasController); |
eCrossfade_out_start.set_sensitive(hasController); |
1176 |
eCrossfade_out_end.set_sensitive(hasController); |
eCrossfade_out_end.set_sensitive(hasController); |
1177 |
|
crossfade_curve.set_sensitive(hasController); |
1178 |
} |
} |
1179 |
|
|
1180 |
void DimRegionEdit::LFO1Controller_changed() |
void DimRegionEdit::LFO1Controller_changed() |
1288 |
update_model--; |
update_model--; |
1289 |
} |
} |
1290 |
|
|
1291 |
bool DimRegionEdit::set_sample(gig::Sample* sample) |
bool DimRegionEdit::set_sample(gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop) |
1292 |
{ |
{ |
1293 |
if (dimregion) { |
if (dimregion) { |
1294 |
//TODO: we should better move the code from MainWindow::on_sample_label_drop_drag_data_received() here |
//TODO: we should better move the code from MainWindow::on_sample_label_drop_drag_data_received() here |
1332 |
d[i]->pSample = sample; |
d[i]->pSample = sample; |
1333 |
|
|
1334 |
// copy sample information from Sample to DimensionRegion |
// copy sample information from Sample to DimensionRegion |
1335 |
|
if (copy_sample_unity) |
1336 |
d[i]->UnityNote = sample->MIDIUnityNote; |
d[i]->UnityNote = sample->MIDIUnityNote; |
1337 |
d[i]->FineTune = sample->FineTune; |
if (copy_sample_tune) |
1338 |
|
d[i]->FineTune = sample->FineTune; |
1339 |
int loops = sample->Loops ? 1 : 0; |
if (copy_sample_loop) { |
1340 |
while (d[i]->SampleLoops > loops) { |
int loops = sample->Loops ? 1 : 0; |
1341 |
d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]); |
while (d[i]->SampleLoops > loops) { |
1342 |
} |
d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]); |
1343 |
while (d[i]->SampleLoops < sample->Loops) { |
} |
1344 |
DLS::sample_loop_t loop; |
while (d[i]->SampleLoops < sample->Loops) { |
1345 |
d[i]->AddSampleLoop(&loop); |
DLS::sample_loop_t loop; |
1346 |
} |
d[i]->AddSampleLoop(&loop); |
1347 |
if (loops) { |
} |
1348 |
d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t); |
if (loops) { |
1349 |
d[i]->pSampleLoops[0].LoopType = sample->LoopType; |
d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t); |
1350 |
d[i]->pSampleLoops[0].LoopStart = sample->LoopStart; |
d[i]->pSampleLoops[0].LoopType = sample->LoopType; |
1351 |
d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1; |
d[i]->pSampleLoops[0].LoopStart = sample->LoopStart; |
1352 |
|
d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1; |
1353 |
|
} |
1354 |
} |
} |
1355 |
} |
} |
1356 |
|
|
1357 |
// update ui |
// update ui |
1358 |
update_model++; |
update_model++; |
1359 |
wSample->set_text(dimregion->pSample->pInfo->Name); |
wSample->set_text(gig_to_utf8(dimregion->pSample->pInfo->Name)); |
1360 |
eUnityNote.set_value(dimregion->UnityNote); |
eUnityNote.set_value(dimregion->UnityNote); |
1361 |
eFineTune.set_value(dimregion->FineTune); |
eFineTune.set_value(dimregion->FineTune); |
1362 |
eSampleLoopEnabled.set_value(dimregion->SampleLoops); |
eSampleLoopEnabled.set_value(dimregion->SampleLoops); |
1495 |
{ |
{ |
1496 |
if (d->pSample) d->pSample->LoopPlayCount = value; |
if (d->pSample) d->pSample->LoopPlayCount = value; |
1497 |
} |
} |
1498 |
|
|
1499 |
|
void DimRegionEdit::nullOutSampleReference() { |
1500 |
|
if (!dimregion) return; |
1501 |
|
gig::Sample* oldref = dimregion->pSample; |
1502 |
|
if (!oldref) return; |
1503 |
|
|
1504 |
|
dimreg_to_be_changed_signal.emit(dimregion); |
1505 |
|
|
1506 |
|
// in case currently assigned sample is a stereo one, then remove both |
1507 |
|
// references (expected to be due to a "stereo dimension") |
1508 |
|
gig::DimensionRegion* d[2] = { dimregion, NULL }; |
1509 |
|
if (oldref->Channels == 2) { |
1510 |
|
gig::Region* region = dimregion->GetParent(); |
1511 |
|
int stereo_bit = 0; |
1512 |
|
{ |
1513 |
|
int bitcount = 0; |
1514 |
|
for (int dim = 0 ; dim < region->Dimensions ; dim++) { |
1515 |
|
if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) { |
1516 |
|
stereo_bit = 1 << bitcount; |
1517 |
|
break; |
1518 |
|
} |
1519 |
|
bitcount += region->pDimensionDefinitions[dim].bits; |
1520 |
|
} |
1521 |
|
|
1522 |
|
if (stereo_bit) { |
1523 |
|
int dimregno; |
1524 |
|
for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) { |
1525 |
|
if (region->pDimensionRegions[dimregno] == dimregion) { |
1526 |
|
break; |
1527 |
|
} |
1528 |
|
} |
1529 |
|
d[0] = region->pDimensionRegions[dimregno & ~stereo_bit]; |
1530 |
|
d[1] = region->pDimensionRegions[dimregno | stereo_bit]; |
1531 |
|
} |
1532 |
|
} |
1533 |
|
} |
1534 |
|
|
1535 |
|
if (d[0]) d[0]->pSample = NULL; |
1536 |
|
if (d[1]) d[1]->pSample = NULL; |
1537 |
|
|
1538 |
|
// update UI elements |
1539 |
|
set_dim_region(dimregion); |
1540 |
|
|
1541 |
|
sample_ref_changed_signal.emit(oldref, NULL); |
1542 |
|
dimreg_changed_signal.emit(dimregion); |
1543 |
|
} |
1544 |
|
|
1545 |
|
void DimRegionEdit::onButtonSelectSamplePressed() { |
1546 |
|
if (!dimregion) return; |
1547 |
|
if (!dimregion->pSample) return; |
1548 |
|
select_sample_signal.emit(dimregion->pSample); |
1549 |
|
} |
1550 |
|
|
1551 |
|
sigc::signal<void, gig::Sample*>& DimRegionEdit::signal_select_sample() { |
1552 |
|
return select_sample_signal; |
1553 |
|
} |