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