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