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