1 |
/* |
2 |
* Copyright (C) 2006-2013 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 "dimregionedit.h" |
21 |
|
22 |
#include "global.h" |
23 |
#include "compat.h" |
24 |
|
25 |
VelocityCurve::VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t)) : |
26 |
getter(getter), dimreg(0) { |
27 |
set_size_request(80, 80); |
28 |
} |
29 |
|
30 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
31 |
bool VelocityCurve::on_expose_event(GdkEventExpose* e) { |
32 |
const Cairo::RefPtr<Cairo::Context>& cr = |
33 |
get_window()->create_cairo_context(); |
34 |
#if 0 |
35 |
} |
36 |
#endif |
37 |
#else |
38 |
bool VelocityCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { |
39 |
#endif |
40 |
if (dimreg) { |
41 |
int w = get_width(); |
42 |
int h = get_height(); |
43 |
|
44 |
for (int pass = 0 ; pass < 2 ; pass++) { |
45 |
for (double x = 0 ; x <= w ; x++) { |
46 |
int vel = int(x * (127 - 1e-10) / w + 1); |
47 |
double y = (1 - (dimreg->*getter)(vel)) * (h - 3) + 1.5; |
48 |
|
49 |
if (x < 1e-10) { |
50 |
cr->move_to(x, y); |
51 |
} else { |
52 |
cr->line_to(x, y); |
53 |
} |
54 |
} |
55 |
if (pass == 0) { |
56 |
cr->line_to(w, h); |
57 |
cr->line_to(0, h); |
58 |
cr->set_source_rgba(0.5, 0.44, 1.0, is_sensitive() ? 0.2 : 0.1); |
59 |
cr->fill(); |
60 |
} else { |
61 |
cr->set_line_width(3); |
62 |
cr->set_source_rgba(0.5, 0.44, 1.0, is_sensitive() ? 1.0 : 0.3); |
63 |
cr->stroke(); |
64 |
} |
65 |
} |
66 |
} |
67 |
return true; |
68 |
} |
69 |
|
70 |
|
71 |
CrossfadeCurve::CrossfadeCurve() : dimreg(0) { |
72 |
set_size_request(280, 80); |
73 |
} |
74 |
|
75 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
76 |
bool CrossfadeCurve::on_expose_event(GdkEventExpose* e) { |
77 |
const Cairo::RefPtr<Cairo::Context>& cr = |
78 |
get_window()->create_cairo_context(); |
79 |
#if 0 |
80 |
} |
81 |
#endif |
82 |
#else |
83 |
bool CrossfadeCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { |
84 |
#endif |
85 |
if (dimreg) { |
86 |
cr->translate(1.5, 0); |
87 |
|
88 |
// first, draw curves for the other layers |
89 |
gig::Region* region = dimreg->GetParent(); |
90 |
int dimregno; |
91 |
for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) { |
92 |
if (region->pDimensionRegions[dimregno] == dimreg) { |
93 |
break; |
94 |
} |
95 |
} |
96 |
int bitcount = 0; |
97 |
int layer_bit = 0; |
98 |
for (int dim = 0 ; dim < region->Dimensions ; dim++) { |
99 |
if (region->pDimensionDefinitions[dim].dimension == |
100 |
gig::dimension_layer) { |
101 |
layer_bit = 1 << bitcount; |
102 |
|
103 |
int mask = |
104 |
~(((1 << region->pDimensionDefinitions[dim].bits) - 1) << |
105 |
bitcount); |
106 |
int c = dimregno & mask; // mask away the layer dimension |
107 |
|
108 |
for (int i = 0 ; i < region->pDimensionDefinitions[dim].zones ; |
109 |
i++) { |
110 |
gig::DimensionRegion* d = |
111 |
region->pDimensionRegions[c + (i << bitcount)]; |
112 |
if (d != dimreg) { |
113 |
draw_one_curve(cr, d, false); |
114 |
} |
115 |
} |
116 |
break; |
117 |
} |
118 |
bitcount += region->pDimensionDefinitions[dim].bits; |
119 |
} |
120 |
|
121 |
// then, draw the currently selected layer |
122 |
draw_one_curve(cr, dimreg, is_sensitive()); |
123 |
} |
124 |
return true; |
125 |
} |
126 |
|
127 |
void CrossfadeCurve::draw_one_curve(const Cairo::RefPtr<Cairo::Context>& cr, |
128 |
const gig::DimensionRegion* d, |
129 |
bool sensitive) { |
130 |
int w = get_width(); |
131 |
int h = get_height(); |
132 |
|
133 |
if (d->Crossfade.out_end) { |
134 |
for (int pass = 0 ; pass < 2 ; pass++) { |
135 |
cr->move_to(d->Crossfade.in_start / 127.0 * (w - 3), h); |
136 |
cr->line_to(d->Crossfade.in_end / 127.0 * (w - 3), 1.5); |
137 |
cr->line_to(d->Crossfade.out_start / 127.0 * (w - 3), 1.5); |
138 |
cr->line_to(d->Crossfade.out_end / 127.0 * (w - 3), h); |
139 |
|
140 |
if (pass == 0) { |
141 |
cr->set_source_rgba(0.5, 0.44, 1.0, sensitive ? 0.2 : 0.1); |
142 |
cr->fill(); |
143 |
} else { |
144 |
cr->set_line_width(3); |
145 |
cr->set_source_rgba(0.5, 0.44, 1.0, sensitive ? 1.0 : 0.3); |
146 |
cr->stroke(); |
147 |
} |
148 |
} |
149 |
} |
150 |
} |
151 |
|
152 |
|
153 |
DimRegionEdit::DimRegionEdit() : |
154 |
velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation), |
155 |
release_curve(&gig::DimensionRegion::GetVelocityRelease), |
156 |
cutoff_curve(&gig::DimensionRegion::GetVelocityCutoff), |
157 |
eEG1PreAttack(_("Pre-attack"), 0, 100, 2), |
158 |
eEG1Attack(_("Attack"), 0, 60, 3), |
159 |
eEG1Decay1(_("Decay 1"), 0.005, 60, 3), |
160 |
eEG1Decay2(_("Decay 2"), 0, 60, 3), |
161 |
eEG1InfiniteSustain(_("Infinite sustain")), |
162 |
eEG1Sustain(_("Sustain"), 0, 100, 2), |
163 |
eEG1Release(_("Release"), 0, 60, 3), |
164 |
eEG1Hold(_("Hold")), |
165 |
eEG1Controller(_("Controller")), |
166 |
eEG1ControllerInvert(_("Controller invert")), |
167 |
eEG1ControllerAttackInfluence(_("Controller attack influence"), 0, 3), |
168 |
eEG1ControllerDecayInfluence(_("Controller decay influence"), 0, 3), |
169 |
eEG1ControllerReleaseInfluence(_("Controller release influence"), 0, 3), |
170 |
eLFO1Frequency(_("Frequency"), 0.1, 10, 2), |
171 |
eLFO1InternalDepth(_("Internal depth"), 0, 1200), |
172 |
eLFO1ControlDepth(_("Control depth"), 0, 1200), |
173 |
eLFO1Controller(_("Controller")), |
174 |
eLFO1FlipPhase(_("Flip phase")), |
175 |
eLFO1Sync(_("Sync")), |
176 |
eEG2PreAttack(_("Pre-attack"), 0, 100, 2), |
177 |
eEG2Attack(_("Attack"), 0, 60, 3), |
178 |
eEG2Decay1(_("Decay 1"), 0.005, 60, 3), |
179 |
eEG2Decay2(_("Decay 2"), 0, 60, 3), |
180 |
eEG2InfiniteSustain(_("Infinite sustain")), |
181 |
eEG2Sustain(_("Sustain"), 0, 100, 2), |
182 |
eEG2Release(_("Release"), 0, 60, 3), |
183 |
eEG2Controller(_("Controller")), |
184 |
eEG2ControllerInvert(_("Controller invert")), |
185 |
eEG2ControllerAttackInfluence(_("Controller attack influence"), 0, 3), |
186 |
eEG2ControllerDecayInfluence(_("Controller decay influence"), 0, 3), |
187 |
eEG2ControllerReleaseInfluence(_("Controller release influence"), 0, 3), |
188 |
eLFO2Frequency(_("Frequency"), 0.1, 10, 2), |
189 |
eLFO2InternalDepth(_("Internal depth"), 0, 1200), |
190 |
eLFO2ControlDepth(_("Control depth"), 0, 1200), |
191 |
eLFO2Controller(_("Controller")), |
192 |
eLFO2FlipPhase(_("Flip phase")), |
193 |
eLFO2Sync(_("Sync")), |
194 |
eEG3Attack(_("Attack"), 0, 10, 3), |
195 |
eEG3Depth(_("Depth"), -1200, 1200), |
196 |
eLFO3Frequency(_("Frequency"), 0.1, 10, 2), |
197 |
eLFO3InternalDepth(_("Internal depth"), 0, 1200), |
198 |
eLFO3ControlDepth(_("Control depth"), 0, 1200), |
199 |
eLFO3Controller(_("Controller")), |
200 |
eLFO3Sync(_("Sync")), |
201 |
eVCFEnabled(_("Enabled")), |
202 |
eVCFType(_("Type")), |
203 |
eVCFCutoffController(_("Cutoff controller")), |
204 |
eVCFCutoffControllerInvert(_("Cutoff controller invert")), |
205 |
eVCFCutoff(_("Cutoff")), |
206 |
eVCFVelocityCurve(_("Velocity curve")), |
207 |
eVCFVelocityScale(_("Velocity scale")), |
208 |
eVCFVelocityDynamicRange(_("Velocity dynamic range"), 0, 4), |
209 |
eVCFResonance(_("Resonance")), |
210 |
eVCFResonanceDynamic(_("Resonance dynamic")), |
211 |
eVCFResonanceController(_("Resonance controller")), |
212 |
eVCFKeyboardTracking(_("Keyboard tracking")), |
213 |
eVCFKeyboardTrackingBreakpoint(_("Keyboard tracking breakpoint")), |
214 |
eVelocityResponseCurve(_("Velocity response curve")), |
215 |
eVelocityResponseDepth(_("Velocity response depth"), 0, 4), |
216 |
eVelocityResponseCurveScaling(_("Velocity response curve scaling")), |
217 |
eReleaseVelocityResponseCurve(_("Release velocity response curve")), |
218 |
eReleaseVelocityResponseDepth(_("Release velocity response depth"), 0, 4), |
219 |
eReleaseTriggerDecay(_("Release trigger decay"), 0, 8), |
220 |
eCrossfade_in_start(_("Crossfade-in start")), |
221 |
eCrossfade_in_end(_("Crossfade-in end")), |
222 |
eCrossfade_out_start(_("Crossfade-out start")), |
223 |
eCrossfade_out_end(_("Crossfade-out end")), |
224 |
ePitchTrack(_("Pitch track")), |
225 |
eDimensionBypass(_("Dimension bypass")), |
226 |
ePan(_("Pan"), -64, 63), |
227 |
eSelfMask(_("Self mask")), |
228 |
eAttenuationController(_("Attenuation controller")), |
229 |
eInvertAttenuationController(_("Invert attenuation controller")), |
230 |
eAttenuationControllerThreshold(_("Attenuation controller threshold")), |
231 |
eChannelOffset(_("Channel offset"), 0, 9), |
232 |
eSustainDefeat(_("Sustain defeat")), |
233 |
eMSDecode(_("MS decode")), |
234 |
eSampleStartOffset(_("Sample start offset"), 0, 2000), |
235 |
eUnityNote(_("Unity note")), |
236 |
eFineTune(_("Fine tune"), -49, 50), |
237 |
eGain(_("Gain"), -96, 0, 2, -655360), |
238 |
eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360), |
239 |
eSampleLoopEnabled(_("Enabled")), |
240 |
eSampleLoopStart(_("Loop start positon")), |
241 |
eSampleLoopLength(_("Loop size")), |
242 |
eSampleLoopType(_("Loop type")), |
243 |
eSampleLoopInfinite(_("Infinite loop")), |
244 |
eSampleLoopPlayCount(_("Playback count"), 1), |
245 |
update_model(0) |
246 |
{ |
247 |
connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack); |
248 |
connect(eEG1Attack, &gig::DimensionRegion::EG1Attack); |
249 |
connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1); |
250 |
connect(eEG1Decay2, &gig::DimensionRegion::EG1Decay2); |
251 |
connect(eEG1InfiniteSustain, &gig::DimensionRegion::EG1InfiniteSustain); |
252 |
connect(eEG1Sustain, &gig::DimensionRegion::EG1Sustain); |
253 |
connect(eEG1Release, &gig::DimensionRegion::EG1Release); |
254 |
connect(eEG1Hold, &gig::DimensionRegion::EG1Hold); |
255 |
connect(eEG1Controller, &gig::DimensionRegion::EG1Controller); |
256 |
connect(eEG1ControllerInvert, &gig::DimensionRegion::EG1ControllerInvert); |
257 |
connect(eEG1ControllerAttackInfluence, |
258 |
&gig::DimensionRegion::EG1ControllerAttackInfluence); |
259 |
connect(eEG1ControllerDecayInfluence, |
260 |
&gig::DimensionRegion::EG1ControllerDecayInfluence); |
261 |
connect(eEG1ControllerReleaseInfluence, |
262 |
&gig::DimensionRegion::EG1ControllerReleaseInfluence); |
263 |
connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency); |
264 |
connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth); |
265 |
connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth); |
266 |
connect(eLFO1Controller, &gig::DimensionRegion::LFO1Controller); |
267 |
connect(eLFO1FlipPhase, &gig::DimensionRegion::LFO1FlipPhase); |
268 |
connect(eLFO1Sync, &gig::DimensionRegion::LFO1Sync); |
269 |
connect(eEG2PreAttack, &gig::DimensionRegion::EG2PreAttack); |
270 |
connect(eEG2Attack, &gig::DimensionRegion::EG2Attack); |
271 |
connect(eEG2Decay1, &gig::DimensionRegion::EG2Decay1); |
272 |
connect(eEG2Decay2, &gig::DimensionRegion::EG2Decay2); |
273 |
connect(eEG2InfiniteSustain, &gig::DimensionRegion::EG2InfiniteSustain); |
274 |
connect(eEG2Sustain, &gig::DimensionRegion::EG2Sustain); |
275 |
connect(eEG2Release, &gig::DimensionRegion::EG2Release); |
276 |
connect(eEG2Controller, &gig::DimensionRegion::EG2Controller); |
277 |
connect(eEG2ControllerInvert, &gig::DimensionRegion::EG2ControllerInvert); |
278 |
connect(eEG2ControllerAttackInfluence, |
279 |
&gig::DimensionRegion::EG2ControllerAttackInfluence); |
280 |
connect(eEG2ControllerDecayInfluence, |
281 |
&gig::DimensionRegion::EG2ControllerDecayInfluence); |
282 |
connect(eEG2ControllerReleaseInfluence, |
283 |
&gig::DimensionRegion::EG2ControllerReleaseInfluence); |
284 |
connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency); |
285 |
connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth); |
286 |
connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth); |
287 |
connect(eLFO2Controller, &gig::DimensionRegion::LFO2Controller); |
288 |
connect(eLFO2FlipPhase, &gig::DimensionRegion::LFO2FlipPhase); |
289 |
connect(eLFO2Sync, &gig::DimensionRegion::LFO2Sync); |
290 |
connect(eEG3Attack, &gig::DimensionRegion::EG3Attack); |
291 |
connect(eEG3Depth, &gig::DimensionRegion::EG3Depth); |
292 |
connect(eLFO3Frequency, &gig::DimensionRegion::LFO3Frequency); |
293 |
connect(eLFO3InternalDepth, &gig::DimensionRegion::LFO3InternalDepth); |
294 |
connect(eLFO3ControlDepth, &gig::DimensionRegion::LFO3ControlDepth); |
295 |
connect(eLFO3Controller, &gig::DimensionRegion::LFO3Controller); |
296 |
connect(eLFO3Sync, &gig::DimensionRegion::LFO3Sync); |
297 |
connect(eVCFEnabled, &gig::DimensionRegion::VCFEnabled); |
298 |
connect(eVCFType, &gig::DimensionRegion::VCFType); |
299 |
connect(eVCFCutoffController, |
300 |
&gig::DimensionRegion::SetVCFCutoffController); |
301 |
connect(eVCFCutoffControllerInvert, |
302 |
&gig::DimensionRegion::VCFCutoffControllerInvert); |
303 |
connect(eVCFCutoff, &gig::DimensionRegion::VCFCutoff); |
304 |
connect(eVCFVelocityCurve, &gig::DimensionRegion::SetVCFVelocityCurve); |
305 |
connect(eVCFVelocityScale, &gig::DimensionRegion::SetVCFVelocityScale); |
306 |
connect(eVCFVelocityDynamicRange, |
307 |
&gig::DimensionRegion::SetVCFVelocityDynamicRange); |
308 |
connect(eVCFResonance, &gig::DimensionRegion::VCFResonance); |
309 |
connect(eVCFResonanceDynamic, &gig::DimensionRegion::VCFResonanceDynamic); |
310 |
connect(eVCFResonanceController, |
311 |
&gig::DimensionRegion::VCFResonanceController); |
312 |
connect(eVCFKeyboardTracking, &gig::DimensionRegion::VCFKeyboardTracking); |
313 |
connect(eVCFKeyboardTrackingBreakpoint, |
314 |
&gig::DimensionRegion::VCFKeyboardTrackingBreakpoint); |
315 |
connect(eVelocityResponseCurve, |
316 |
&gig::DimensionRegion::SetVelocityResponseCurve); |
317 |
connect(eVelocityResponseDepth, |
318 |
&gig::DimensionRegion::SetVelocityResponseDepth); |
319 |
connect(eVelocityResponseCurveScaling, |
320 |
&gig::DimensionRegion::SetVelocityResponseCurveScaling); |
321 |
connect(eReleaseVelocityResponseCurve, |
322 |
&gig::DimensionRegion::SetReleaseVelocityResponseCurve); |
323 |
connect(eReleaseVelocityResponseDepth, |
324 |
&gig::DimensionRegion::SetReleaseVelocityResponseDepth); |
325 |
connect(eReleaseTriggerDecay, &gig::DimensionRegion::ReleaseTriggerDecay); |
326 |
connect(eCrossfade_in_start, &DimRegionEdit::set_Crossfade_in_start); |
327 |
connect(eCrossfade_in_end, &DimRegionEdit::set_Crossfade_in_end); |
328 |
connect(eCrossfade_out_start, &DimRegionEdit::set_Crossfade_out_start); |
329 |
connect(eCrossfade_out_end, &DimRegionEdit::set_Crossfade_out_end); |
330 |
connect(ePitchTrack, &gig::DimensionRegion::PitchTrack); |
331 |
connect(eDimensionBypass, &gig::DimensionRegion::DimensionBypass); |
332 |
connect(ePan, &gig::DimensionRegion::Pan); |
333 |
connect(eSelfMask, &gig::DimensionRegion::SelfMask); |
334 |
connect(eAttenuationController, |
335 |
&gig::DimensionRegion::AttenuationController); |
336 |
connect(eInvertAttenuationController, |
337 |
&gig::DimensionRegion::InvertAttenuationController); |
338 |
connect(eAttenuationControllerThreshold, |
339 |
&gig::DimensionRegion::AttenuationControllerThreshold); |
340 |
connect(eChannelOffset, &gig::DimensionRegion::ChannelOffset); |
341 |
connect(eSustainDefeat, &gig::DimensionRegion::SustainDefeat); |
342 |
connect(eMSDecode, &gig::DimensionRegion::MSDecode); |
343 |
connect(eSampleStartOffset, &gig::DimensionRegion::SampleStartOffset); |
344 |
connect(eUnityNote, &DimRegionEdit::set_UnityNote); |
345 |
connect(eFineTune, &DimRegionEdit::set_FineTune); |
346 |
connect(eGain, &DimRegionEdit::set_Gain); |
347 |
connect(eGainPlus6, &DimRegionEdit::set_Gain); |
348 |
connect(eSampleLoopEnabled, &DimRegionEdit::set_LoopEnabled); |
349 |
connect(eSampleLoopType, &DimRegionEdit::set_LoopType); |
350 |
connect(eSampleLoopStart, &DimRegionEdit::set_LoopStart); |
351 |
connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength); |
352 |
connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite); |
353 |
connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount); |
354 |
|
355 |
for (int i = 0 ; i < 7 ; i++) { |
356 |
table[i] = new Gtk::Table(3, 1); |
357 |
table[i]->set_col_spacings(7); |
358 |
} |
359 |
|
360 |
// set tooltips |
361 |
eUnityNote.set_tip( |
362 |
_("Note this sample is associated with (a.k.a. 'root note')") |
363 |
); |
364 |
eSampleStartOffset.set_tip(_("Sample position at which playback should be started")); |
365 |
ePan.set_tip(_("Stereo balance (left/right)")); |
366 |
eChannelOffset.set_tip( |
367 |
_("Output channel where the audio signal should be routed to (0 - 9)") |
368 |
); |
369 |
ePitchTrack.set_tip( |
370 |
_("If true: sample will be pitched according to the key position " |
371 |
"(this would be disabled for drums for example)") |
372 |
); |
373 |
eSampleLoopEnabled.set_tip(_("If enabled: repeats to playback the sample")); |
374 |
eSampleLoopStart.set_tip( |
375 |
_("Start position within the sample (in sample points) of the area to " |
376 |
"be looped") |
377 |
); |
378 |
eSampleLoopLength.set_tip( |
379 |
_("Duration (in sample points) of the area to be looped") |
380 |
); |
381 |
eSampleLoopType.set_tip( |
382 |
_("Direction in which the loop area in the sample should be played back") |
383 |
); |
384 |
eSampleLoopInfinite.set_tip( |
385 |
_("Whether the loop area should be played back forever\n" |
386 |
"Caution: this setting is stored on Sample side, thus is shared " |
387 |
"among all dimension regions that use this sample!") |
388 |
); |
389 |
eSampleLoopPlayCount.set_tip( |
390 |
_("How many times the loop area should be played back\n" |
391 |
"Caution: this setting is stored on Sample side, thus is shared " |
392 |
"among all dimension regions that use this sample!") |
393 |
); |
394 |
|
395 |
pageno = 0; |
396 |
rowno = 0; |
397 |
firstRowInBlock = 0; |
398 |
|
399 |
addHeader(_("Mandatory Settings")); |
400 |
addString(_("Sample"), lSample, wSample); |
401 |
//TODO: the following would break drag&drop: wSample->property_editable().set_value(false); or this: wSample->set_editable(false); |
402 |
#ifdef OLD_TOOLTIPS |
403 |
tooltips.set_tip(*wSample, _("Drop a sample here")); |
404 |
#else |
405 |
wSample->set_tooltip_text(_("Drop a sample here")); |
406 |
#endif |
407 |
addProp(eUnityNote); |
408 |
addHeader(_("Optional Settings")); |
409 |
addProp(eSampleStartOffset); |
410 |
addProp(eChannelOffset); |
411 |
addHeader(_("Loops")); |
412 |
addProp(eSampleLoopEnabled); |
413 |
addProp(eSampleLoopStart); |
414 |
addProp(eSampleLoopLength); |
415 |
{ |
416 |
const char* choices[] = { _("normal"), _("bidirectional"), _("backward"), 0 }; |
417 |
static const uint32_t values[] = { |
418 |
gig::loop_type_normal, |
419 |
gig::loop_type_bidirectional, |
420 |
gig::loop_type_backward |
421 |
}; |
422 |
eSampleLoopType.set_choices(choices, values); |
423 |
} |
424 |
addProp(eSampleLoopType); |
425 |
addProp(eSampleLoopInfinite); |
426 |
addProp(eSampleLoopPlayCount); |
427 |
|
428 |
nextPage(); |
429 |
|
430 |
addHeader(_("General Amplitude Settings")); |
431 |
addProp(eGain); |
432 |
addProp(eGainPlus6); |
433 |
addProp(ePan); |
434 |
addHeader(_("Amplitude Envelope (EG1)")); |
435 |
addProp(eEG1PreAttack); |
436 |
addProp(eEG1Attack); |
437 |
addProp(eEG1Decay1); |
438 |
addProp(eEG1Decay2); |
439 |
addProp(eEG1InfiniteSustain); |
440 |
addProp(eEG1Sustain); |
441 |
addProp(eEG1Release); |
442 |
addProp(eEG1Hold); |
443 |
addProp(eEG1Controller); |
444 |
addProp(eEG1ControllerInvert); |
445 |
addProp(eEG1ControllerAttackInfluence); |
446 |
addProp(eEG1ControllerDecayInfluence); |
447 |
addProp(eEG1ControllerReleaseInfluence); |
448 |
|
449 |
nextPage(); |
450 |
|
451 |
addHeader(_("Amplitude Oscillator (LFO1)")); |
452 |
addProp(eLFO1Frequency); |
453 |
addProp(eLFO1InternalDepth); |
454 |
addProp(eLFO1ControlDepth); |
455 |
{ |
456 |
const char* choices[] = { _("internal"), _("modwheel"), _("breath"), |
457 |
_("internal+modwheel"), _("internal+breath"), 0 }; |
458 |
static const gig::lfo1_ctrl_t values[] = { |
459 |
gig::lfo1_ctrl_internal, |
460 |
gig::lfo1_ctrl_modwheel, |
461 |
gig::lfo1_ctrl_breath, |
462 |
gig::lfo1_ctrl_internal_modwheel, |
463 |
gig::lfo1_ctrl_internal_breath |
464 |
}; |
465 |
eLFO1Controller.set_choices(choices, values); |
466 |
} |
467 |
addProp(eLFO1Controller); |
468 |
addProp(eLFO1FlipPhase); |
469 |
addProp(eLFO1Sync); |
470 |
addHeader(_("Crossfade")); |
471 |
addProp(eAttenuationController); |
472 |
addProp(eInvertAttenuationController); |
473 |
addProp(eAttenuationControllerThreshold); |
474 |
addProp(eCrossfade_in_start); |
475 |
addProp(eCrossfade_in_end); |
476 |
addProp(eCrossfade_out_start); |
477 |
addProp(eCrossfade_out_end); |
478 |
|
479 |
Gtk::Frame* frame = new Gtk::Frame; |
480 |
frame->add(crossfade_curve); |
481 |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
482 |
Gtk::SHRINK, Gtk::SHRINK); |
483 |
rowno++; |
484 |
|
485 |
eCrossfade_in_start.signal_value_changed().connect( |
486 |
sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw)); |
487 |
eCrossfade_in_end.signal_value_changed().connect( |
488 |
sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw)); |
489 |
eCrossfade_out_start.signal_value_changed().connect( |
490 |
sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw)); |
491 |
eCrossfade_out_end.signal_value_changed().connect( |
492 |
sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw)); |
493 |
|
494 |
nextPage(); |
495 |
|
496 |
addHeader(_("General Filter Settings")); |
497 |
addProp(eVCFEnabled); |
498 |
{ |
499 |
const char* choices[] = { _("lowpass"), _("lowpassturbo"), _("bandpass"), |
500 |
_("highpass"), _("bandreject"), 0 }; |
501 |
static const gig::vcf_type_t values[] = { |
502 |
gig::vcf_type_lowpass, |
503 |
gig::vcf_type_lowpassturbo, |
504 |
gig::vcf_type_bandpass, |
505 |
gig::vcf_type_highpass, |
506 |
gig::vcf_type_bandreject |
507 |
}; |
508 |
eVCFType.set_choices(choices, values); |
509 |
} |
510 |
addProp(eVCFType); |
511 |
{ |
512 |
const char* choices[] = { _("none"), _("none2"), _("modwheel"), _("effect1"), _("effect2"), |
513 |
_("breath"), _("foot"), _("sustainpedal"), _("softpedal"), |
514 |
_("genpurpose7"), _("genpurpose8"), _("aftertouch"), 0 }; |
515 |
static const gig::vcf_cutoff_ctrl_t values[] = { |
516 |
gig::vcf_cutoff_ctrl_none, |
517 |
gig::vcf_cutoff_ctrl_none2, |
518 |
gig::vcf_cutoff_ctrl_modwheel, |
519 |
gig::vcf_cutoff_ctrl_effect1, |
520 |
gig::vcf_cutoff_ctrl_effect2, |
521 |
gig::vcf_cutoff_ctrl_breath, |
522 |
gig::vcf_cutoff_ctrl_foot, |
523 |
gig::vcf_cutoff_ctrl_sustainpedal, |
524 |
gig::vcf_cutoff_ctrl_softpedal, |
525 |
gig::vcf_cutoff_ctrl_genpurpose7, |
526 |
gig::vcf_cutoff_ctrl_genpurpose8, |
527 |
gig::vcf_cutoff_ctrl_aftertouch |
528 |
}; |
529 |
eVCFCutoffController.set_choices(choices, values); |
530 |
} |
531 |
addProp(eVCFCutoffController); |
532 |
addProp(eVCFCutoffControllerInvert); |
533 |
addProp(eVCFCutoff); |
534 |
const char* curve_type_texts[] = { _("nonlinear"), _("linear"), _("special"), 0 }; |
535 |
static const gig::curve_type_t curve_type_values[] = { |
536 |
gig::curve_type_nonlinear, |
537 |
gig::curve_type_linear, |
538 |
gig::curve_type_special |
539 |
}; |
540 |
eVCFVelocityCurve.set_choices(curve_type_texts, curve_type_values); |
541 |
addProp(eVCFVelocityCurve); |
542 |
addProp(eVCFVelocityScale); |
543 |
addProp(eVCFVelocityDynamicRange); |
544 |
|
545 |
eVCFCutoffController.signal_value_changed().connect( |
546 |
sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw)); |
547 |
eVCFVelocityCurve.signal_value_changed().connect( |
548 |
sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw)); |
549 |
eVCFVelocityScale.signal_value_changed().connect( |
550 |
sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw)); |
551 |
eVCFVelocityDynamicRange.signal_value_changed().connect( |
552 |
sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw)); |
553 |
|
554 |
frame = new Gtk::Frame; |
555 |
frame->add(cutoff_curve); |
556 |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
557 |
Gtk::SHRINK, Gtk::SHRINK); |
558 |
rowno++; |
559 |
|
560 |
addProp(eVCFResonance); |
561 |
addProp(eVCFResonanceDynamic); |
562 |
{ |
563 |
const char* choices[] = { _("none"), _("genpurpose3"), _("genpurpose4"), |
564 |
_("genpurpose5"), _("genpurpose6"), 0 }; |
565 |
static const gig::vcf_res_ctrl_t values[] = { |
566 |
gig::vcf_res_ctrl_none, |
567 |
gig::vcf_res_ctrl_genpurpose3, |
568 |
gig::vcf_res_ctrl_genpurpose4, |
569 |
gig::vcf_res_ctrl_genpurpose5, |
570 |
gig::vcf_res_ctrl_genpurpose6 |
571 |
}; |
572 |
eVCFResonanceController.set_choices(choices, values); |
573 |
} |
574 |
addProp(eVCFResonanceController); |
575 |
addProp(eVCFKeyboardTracking); |
576 |
addProp(eVCFKeyboardTrackingBreakpoint); |
577 |
|
578 |
nextPage(); |
579 |
|
580 |
lEG2 = addHeader(_("Filter Cutoff Envelope (EG2)")); |
581 |
addProp(eEG2PreAttack); |
582 |
addProp(eEG2Attack); |
583 |
addProp(eEG2Decay1); |
584 |
addProp(eEG2Decay2); |
585 |
addProp(eEG2InfiniteSustain); |
586 |
addProp(eEG2Sustain); |
587 |
addProp(eEG2Release); |
588 |
addProp(eEG2Controller); |
589 |
addProp(eEG2ControllerInvert); |
590 |
addProp(eEG2ControllerAttackInfluence); |
591 |
addProp(eEG2ControllerDecayInfluence); |
592 |
addProp(eEG2ControllerReleaseInfluence); |
593 |
lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)")); |
594 |
addProp(eLFO2Frequency); |
595 |
addProp(eLFO2InternalDepth); |
596 |
addProp(eLFO2ControlDepth); |
597 |
{ |
598 |
const char* choices[] = { _("internal"), _("modwheel"), _("foot"), |
599 |
_("internal+modwheel"), _("internal+foot"), 0 }; |
600 |
static const gig::lfo2_ctrl_t values[] = { |
601 |
gig::lfo2_ctrl_internal, |
602 |
gig::lfo2_ctrl_modwheel, |
603 |
gig::lfo2_ctrl_foot, |
604 |
gig::lfo2_ctrl_internal_modwheel, |
605 |
gig::lfo2_ctrl_internal_foot |
606 |
}; |
607 |
eLFO2Controller.set_choices(choices, values); |
608 |
} |
609 |
addProp(eLFO2Controller); |
610 |
addProp(eLFO2FlipPhase); |
611 |
addProp(eLFO2Sync); |
612 |
|
613 |
nextPage(); |
614 |
|
615 |
addHeader(_("General Pitch Settings")); |
616 |
addProp(eFineTune); |
617 |
addProp(ePitchTrack); |
618 |
addHeader(_("Pitch Envelope (EG3)")); |
619 |
addProp(eEG3Attack); |
620 |
addProp(eEG3Depth); |
621 |
addHeader(_("Pitch Oscillator (LFO3)")); |
622 |
addProp(eLFO3Frequency); |
623 |
addProp(eLFO3InternalDepth); |
624 |
addProp(eLFO3ControlDepth); |
625 |
{ |
626 |
const char* choices[] = { _("internal"), _("modwheel"), _("aftertouch"), |
627 |
_("internal+modwheel"), _("internal+aftertouch"), 0 }; |
628 |
static const gig::lfo3_ctrl_t values[] = { |
629 |
gig::lfo3_ctrl_internal, |
630 |
gig::lfo3_ctrl_modwheel, |
631 |
gig::lfo3_ctrl_aftertouch, |
632 |
gig::lfo3_ctrl_internal_modwheel, |
633 |
gig::lfo3_ctrl_internal_aftertouch |
634 |
}; |
635 |
eLFO3Controller.set_choices(choices, values); |
636 |
} |
637 |
addProp(eLFO3Controller); |
638 |
addProp(eLFO3Sync); |
639 |
|
640 |
nextPage(); |
641 |
|
642 |
addHeader(_("Velocity Reponse")); |
643 |
eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values); |
644 |
addProp(eVelocityResponseCurve); |
645 |
addProp(eVelocityResponseDepth); |
646 |
addProp(eVelocityResponseCurveScaling); |
647 |
|
648 |
eVelocityResponseCurve.signal_value_changed().connect( |
649 |
sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw)); |
650 |
eVelocityResponseDepth.signal_value_changed().connect( |
651 |
sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw)); |
652 |
eVelocityResponseCurveScaling.signal_value_changed().connect( |
653 |
sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw)); |
654 |
|
655 |
frame = new Gtk::Frame; |
656 |
frame->add(velocity_curve); |
657 |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
658 |
Gtk::SHRINK, Gtk::SHRINK); |
659 |
rowno++; |
660 |
|
661 |
addHeader(_("Release Velocity Reponse")); |
662 |
eReleaseVelocityResponseCurve.set_choices(curve_type_texts, |
663 |
curve_type_values); |
664 |
addProp(eReleaseVelocityResponseCurve); |
665 |
addProp(eReleaseVelocityResponseDepth); |
666 |
|
667 |
eReleaseVelocityResponseCurve.signal_value_changed().connect( |
668 |
sigc::mem_fun(release_curve, &VelocityCurve::queue_draw)); |
669 |
eReleaseVelocityResponseDepth.signal_value_changed().connect( |
670 |
sigc::mem_fun(release_curve, &VelocityCurve::queue_draw)); |
671 |
frame = new Gtk::Frame; |
672 |
frame->add(release_curve); |
673 |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
674 |
Gtk::SHRINK, Gtk::SHRINK); |
675 |
rowno++; |
676 |
|
677 |
addProp(eReleaseTriggerDecay); |
678 |
{ |
679 |
const char* choices[] = { _("none"), _("effect4depth"), _("effect5depth"), 0 }; |
680 |
static const gig::dim_bypass_ctrl_t values[] = { |
681 |
gig::dim_bypass_ctrl_none, |
682 |
gig::dim_bypass_ctrl_94, |
683 |
gig::dim_bypass_ctrl_95 |
684 |
}; |
685 |
eDimensionBypass.set_choices(choices, values); |
686 |
} |
687 |
addProp(eDimensionBypass); |
688 |
addProp(eSelfMask); |
689 |
addProp(eSustainDefeat); |
690 |
addProp(eMSDecode); |
691 |
|
692 |
nextPage(); |
693 |
|
694 |
|
695 |
eEG1InfiniteSustain.signal_value_changed().connect( |
696 |
sigc::mem_fun(*this, &DimRegionEdit::EG1InfiniteSustain_toggled)); |
697 |
eEG2InfiniteSustain.signal_value_changed().connect( |
698 |
sigc::mem_fun(*this, &DimRegionEdit::EG2InfiniteSustain_toggled)); |
699 |
eEG1Controller.signal_value_changed().connect( |
700 |
sigc::mem_fun(*this, &DimRegionEdit::EG1Controller_changed)); |
701 |
eEG2Controller.signal_value_changed().connect( |
702 |
sigc::mem_fun(*this, &DimRegionEdit::EG2Controller_changed)); |
703 |
eLFO1Controller.signal_value_changed().connect( |
704 |
sigc::mem_fun(*this, &DimRegionEdit::LFO1Controller_changed)); |
705 |
eLFO2Controller.signal_value_changed().connect( |
706 |
sigc::mem_fun(*this, &DimRegionEdit::LFO2Controller_changed)); |
707 |
eLFO3Controller.signal_value_changed().connect( |
708 |
sigc::mem_fun(*this, &DimRegionEdit::LFO3Controller_changed)); |
709 |
eAttenuationController.signal_value_changed().connect( |
710 |
sigc::mem_fun(*this, &DimRegionEdit::AttenuationController_changed)); |
711 |
eVCFEnabled.signal_value_changed().connect( |
712 |
sigc::mem_fun(*this, &DimRegionEdit::VCFEnabled_toggled)); |
713 |
eVCFCutoffController.signal_value_changed().connect( |
714 |
sigc::mem_fun(*this, &DimRegionEdit::VCFCutoffController_changed)); |
715 |
eVCFResonanceController.signal_value_changed().connect( |
716 |
sigc::mem_fun(*this, &DimRegionEdit::VCFResonanceController_changed)); |
717 |
|
718 |
eCrossfade_in_start.signal_value_changed().connect( |
719 |
sigc::mem_fun(*this, &DimRegionEdit::crossfade1_changed)); |
720 |
eCrossfade_in_end.signal_value_changed().connect( |
721 |
sigc::mem_fun(*this, &DimRegionEdit::crossfade2_changed)); |
722 |
eCrossfade_out_start.signal_value_changed().connect( |
723 |
sigc::mem_fun(*this, &DimRegionEdit::crossfade3_changed)); |
724 |
eCrossfade_out_end.signal_value_changed().connect( |
725 |
sigc::mem_fun(*this, &DimRegionEdit::crossfade4_changed)); |
726 |
|
727 |
eSampleLoopEnabled.signal_value_changed().connect( |
728 |
sigc::mem_fun(*this, &DimRegionEdit::update_loop_elements)); |
729 |
eSampleLoopStart.signal_value_changed().connect( |
730 |
sigc::mem_fun(*this, &DimRegionEdit::loop_start_changed)); |
731 |
eSampleLoopLength.signal_value_changed().connect( |
732 |
sigc::mem_fun(*this, &DimRegionEdit::loop_length_changed)); |
733 |
eSampleLoopInfinite.signal_value_changed().connect( |
734 |
sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled)); |
735 |
|
736 |
append_page(*table[0], _("Sample")); |
737 |
append_page(*table[1], _("Amplitude (1)")); |
738 |
append_page(*table[2], _("Amplitude (2)")); |
739 |
append_page(*table[3], _("Filter (1)")); |
740 |
append_page(*table[4], _("Filter (2)")); |
741 |
append_page(*table[5], _("Pitch")); |
742 |
append_page(*table[6], _("Misc")); |
743 |
} |
744 |
|
745 |
DimRegionEdit::~DimRegionEdit() |
746 |
{ |
747 |
} |
748 |
|
749 |
void DimRegionEdit::addString(const char* labelText, Gtk::Label*& label, |
750 |
Gtk::Entry*& widget) |
751 |
{ |
752 |
label = new Gtk::Label(Glib::ustring(labelText) + ":"); |
753 |
label->set_alignment(Gtk::ALIGN_START); |
754 |
|
755 |
table[pageno]->attach(*label, 1, 2, rowno, rowno + 1, |
756 |
Gtk::FILL, Gtk::SHRINK); |
757 |
|
758 |
widget = new Gtk::Entry(); |
759 |
|
760 |
table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1, |
761 |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
762 |
|
763 |
rowno++; |
764 |
} |
765 |
|
766 |
Gtk::Label* DimRegionEdit::addHeader(const char* text) |
767 |
{ |
768 |
if (firstRowInBlock < rowno - 1) |
769 |
{ |
770 |
Gtk::Label* filler = new Gtk::Label(" "); |
771 |
table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno, |
772 |
Gtk::FILL, Gtk::SHRINK); |
773 |
} |
774 |
Glib::ustring str = "<b>"; |
775 |
str += text; |
776 |
str += "</b>"; |
777 |
Gtk::Label* label = new Gtk::Label(str); |
778 |
label->set_use_markup(); |
779 |
label->set_alignment(Gtk::ALIGN_START); |
780 |
table[pageno]->attach(*label, 0, 3, rowno, rowno + 1, |
781 |
Gtk::FILL, Gtk::SHRINK); |
782 |
rowno++; |
783 |
firstRowInBlock = rowno; |
784 |
return label; |
785 |
} |
786 |
|
787 |
void DimRegionEdit::nextPage() |
788 |
{ |
789 |
if (firstRowInBlock < rowno - 1) |
790 |
{ |
791 |
Gtk::Label* filler = new Gtk::Label(" "); |
792 |
table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno, |
793 |
Gtk::FILL, Gtk::SHRINK); |
794 |
} |
795 |
pageno++; |
796 |
rowno = 0; |
797 |
firstRowInBlock = 0; |
798 |
} |
799 |
|
800 |
void DimRegionEdit::addProp(BoolEntry& boolentry) |
801 |
{ |
802 |
table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1, |
803 |
Gtk::FILL, Gtk::SHRINK); |
804 |
rowno++; |
805 |
} |
806 |
|
807 |
void DimRegionEdit::addProp(BoolEntryPlus6& boolentry) |
808 |
{ |
809 |
table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1, |
810 |
Gtk::FILL, Gtk::SHRINK); |
811 |
rowno++; |
812 |
} |
813 |
|
814 |
void DimRegionEdit::addProp(LabelWidget& prop) |
815 |
{ |
816 |
table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1, |
817 |
Gtk::FILL, Gtk::SHRINK); |
818 |
table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1, |
819 |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
820 |
rowno++; |
821 |
} |
822 |
|
823 |
|
824 |
void DimRegionEdit::set_dim_region(gig::DimensionRegion* d) |
825 |
{ |
826 |
dimregion = d; |
827 |
velocity_curve.set_dim_region(d); |
828 |
release_curve.set_dim_region(d); |
829 |
cutoff_curve.set_dim_region(d); |
830 |
crossfade_curve.set_dim_region(d); |
831 |
|
832 |
set_sensitive(d); |
833 |
if (!d) return; |
834 |
|
835 |
update_model++; |
836 |
eEG1PreAttack.set_value(d->EG1PreAttack); |
837 |
eEG1Attack.set_value(d->EG1Attack); |
838 |
eEG1Decay1.set_value(d->EG1Decay1); |
839 |
eEG1Decay2.set_value(d->EG1Decay2); |
840 |
eEG1InfiniteSustain.set_value(d->EG1InfiniteSustain); |
841 |
eEG1Sustain.set_value(d->EG1Sustain); |
842 |
eEG1Release.set_value(d->EG1Release); |
843 |
eEG1Hold.set_value(d->EG1Hold); |
844 |
eEG1Controller.set_value(d->EG1Controller); |
845 |
eEG1ControllerInvert.set_value(d->EG1ControllerInvert); |
846 |
eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence); |
847 |
eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence); |
848 |
eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence); |
849 |
eLFO1Frequency.set_value(d->LFO1Frequency); |
850 |
eLFO1InternalDepth.set_value(d->LFO1InternalDepth); |
851 |
eLFO1ControlDepth.set_value(d->LFO1ControlDepth); |
852 |
eLFO1Controller.set_value(d->LFO1Controller); |
853 |
eLFO1FlipPhase.set_value(d->LFO1FlipPhase); |
854 |
eLFO1Sync.set_value(d->LFO1Sync); |
855 |
eEG2PreAttack.set_value(d->EG2PreAttack); |
856 |
eEG2Attack.set_value(d->EG2Attack); |
857 |
eEG2Decay1.set_value(d->EG2Decay1); |
858 |
eEG2Decay2.set_value(d->EG2Decay2); |
859 |
eEG2InfiniteSustain.set_value(d->EG2InfiniteSustain); |
860 |
eEG2Sustain.set_value(d->EG2Sustain); |
861 |
eEG2Release.set_value(d->EG2Release); |
862 |
eEG2Controller.set_value(d->EG2Controller); |
863 |
eEG2ControllerInvert.set_value(d->EG2ControllerInvert); |
864 |
eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence); |
865 |
eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence); |
866 |
eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence); |
867 |
eLFO2Frequency.set_value(d->LFO2Frequency); |
868 |
eLFO2InternalDepth.set_value(d->LFO2InternalDepth); |
869 |
eLFO2ControlDepth.set_value(d->LFO2ControlDepth); |
870 |
eLFO2Controller.set_value(d->LFO2Controller); |
871 |
eLFO2FlipPhase.set_value(d->LFO2FlipPhase); |
872 |
eLFO2Sync.set_value(d->LFO2Sync); |
873 |
eEG3Attack.set_value(d->EG3Attack); |
874 |
eEG3Depth.set_value(d->EG3Depth); |
875 |
eLFO3Frequency.set_value(d->LFO3Frequency); |
876 |
eLFO3InternalDepth.set_value(d->LFO3InternalDepth); |
877 |
eLFO3ControlDepth.set_value(d->LFO3ControlDepth); |
878 |
eLFO3Controller.set_value(d->LFO3Controller); |
879 |
eLFO3Sync.set_value(d->LFO3Sync); |
880 |
eVCFEnabled.set_value(d->VCFEnabled); |
881 |
eVCFType.set_value(d->VCFType); |
882 |
eVCFCutoffController.set_value(d->VCFCutoffController); |
883 |
eVCFCutoffControllerInvert.set_value(d->VCFCutoffControllerInvert); |
884 |
eVCFCutoff.set_value(d->VCFCutoff); |
885 |
eVCFVelocityCurve.set_value(d->VCFVelocityCurve); |
886 |
eVCFVelocityScale.set_value(d->VCFVelocityScale); |
887 |
eVCFVelocityDynamicRange.set_value(d->VCFVelocityDynamicRange); |
888 |
eVCFResonance.set_value(d->VCFResonance); |
889 |
eVCFResonanceDynamic.set_value(d->VCFResonanceDynamic); |
890 |
eVCFResonanceController.set_value(d->VCFResonanceController); |
891 |
eVCFKeyboardTracking.set_value(d->VCFKeyboardTracking); |
892 |
eVCFKeyboardTrackingBreakpoint.set_value(d->VCFKeyboardTrackingBreakpoint); |
893 |
eVelocityResponseCurve.set_value(d->VelocityResponseCurve); |
894 |
eVelocityResponseDepth.set_value(d->VelocityResponseDepth); |
895 |
eVelocityResponseCurveScaling.set_value(d->VelocityResponseCurveScaling); |
896 |
eReleaseVelocityResponseCurve.set_value(d->ReleaseVelocityResponseCurve); |
897 |
eReleaseVelocityResponseDepth.set_value(d->ReleaseVelocityResponseDepth); |
898 |
eReleaseTriggerDecay.set_value(d->ReleaseTriggerDecay); |
899 |
eCrossfade_in_start.set_value(d->Crossfade.in_start); |
900 |
eCrossfade_in_end.set_value(d->Crossfade.in_end); |
901 |
eCrossfade_out_start.set_value(d->Crossfade.out_start); |
902 |
eCrossfade_out_end.set_value(d->Crossfade.out_end); |
903 |
ePitchTrack.set_value(d->PitchTrack); |
904 |
eDimensionBypass.set_value(d->DimensionBypass); |
905 |
ePan.set_value(d->Pan); |
906 |
eSelfMask.set_value(d->SelfMask); |
907 |
eAttenuationController.set_value(d->AttenuationController); |
908 |
eInvertAttenuationController.set_value(d->InvertAttenuationController); |
909 |
eAttenuationControllerThreshold.set_value(d->AttenuationControllerThreshold); |
910 |
eChannelOffset.set_value(d->ChannelOffset); |
911 |
eSustainDefeat.set_value(d->SustainDefeat); |
912 |
eMSDecode.set_value(d->MSDecode); |
913 |
eSampleStartOffset.set_value(d->SampleStartOffset); |
914 |
eUnityNote.set_value(d->UnityNote); |
915 |
eFineTune.set_value(d->FineTune); |
916 |
eGain.set_value(d->Gain); |
917 |
eGainPlus6.set_value(d->Gain); |
918 |
eSampleLoopEnabled.set_value(d->SampleLoops); |
919 |
eSampleLoopType.set_value( |
920 |
d->SampleLoops ? d->pSampleLoops[0].LoopType : 0); |
921 |
eSampleLoopStart.set_value( |
922 |
d->SampleLoops ? d->pSampleLoops[0].LoopStart : 0); |
923 |
eSampleLoopLength.set_value( |
924 |
d->SampleLoops ? d->pSampleLoops[0].LoopLength : 0); |
925 |
eSampleLoopInfinite.set_value( |
926 |
d->pSample && d->pSample->LoopPlayCount == 0); |
927 |
eSampleLoopPlayCount.set_value( |
928 |
d->pSample ? d->pSample->LoopPlayCount : 0); |
929 |
update_model--; |
930 |
|
931 |
wSample->set_text(d->pSample ? d->pSample->pInfo->Name.c_str() : _("NULL")); |
932 |
|
933 |
update_loop_elements(); |
934 |
VCFEnabled_toggled(); |
935 |
} |
936 |
|
937 |
|
938 |
void DimRegionEdit::VCFEnabled_toggled() |
939 |
{ |
940 |
bool sensitive = eVCFEnabled.get_value(); |
941 |
eVCFType.set_sensitive(sensitive); |
942 |
eVCFCutoffController.set_sensitive(sensitive); |
943 |
eVCFVelocityCurve.set_sensitive(sensitive); |
944 |
eVCFVelocityScale.set_sensitive(sensitive); |
945 |
eVCFVelocityDynamicRange.set_sensitive(sensitive); |
946 |
cutoff_curve.set_sensitive(sensitive); |
947 |
eVCFResonance.set_sensitive(sensitive); |
948 |
eVCFResonanceController.set_sensitive(sensitive); |
949 |
eVCFKeyboardTracking.set_sensitive(sensitive); |
950 |
eVCFKeyboardTrackingBreakpoint.set_sensitive(sensitive); |
951 |
lEG2->set_sensitive(sensitive); |
952 |
eEG2PreAttack.set_sensitive(sensitive); |
953 |
eEG2Attack.set_sensitive(sensitive); |
954 |
eEG2Decay1.set_sensitive(sensitive); |
955 |
eEG2InfiniteSustain.set_sensitive(sensitive); |
956 |
eEG2Sustain.set_sensitive(sensitive); |
957 |
eEG2Release.set_sensitive(sensitive); |
958 |
eEG2Controller.set_sensitive(sensitive); |
959 |
eEG2ControllerAttackInfluence.set_sensitive(sensitive); |
960 |
eEG2ControllerDecayInfluence.set_sensitive(sensitive); |
961 |
eEG2ControllerReleaseInfluence.set_sensitive(sensitive); |
962 |
lLFO2->set_sensitive(sensitive); |
963 |
eLFO2Frequency.set_sensitive(sensitive); |
964 |
eLFO2InternalDepth.set_sensitive(sensitive); |
965 |
eLFO2ControlDepth.set_sensitive(sensitive); |
966 |
eLFO2Controller.set_sensitive(sensitive); |
967 |
eLFO2FlipPhase.set_sensitive(sensitive); |
968 |
eLFO2Sync.set_sensitive(sensitive); |
969 |
if (sensitive) { |
970 |
VCFCutoffController_changed(); |
971 |
VCFResonanceController_changed(); |
972 |
EG2InfiniteSustain_toggled(); |
973 |
EG2Controller_changed(); |
974 |
LFO2Controller_changed(); |
975 |
} else { |
976 |
eVCFCutoffControllerInvert.set_sensitive(false); |
977 |
eVCFCutoff.set_sensitive(false); |
978 |
eVCFResonanceDynamic.set_sensitive(false); |
979 |
eVCFResonance.set_sensitive(false); |
980 |
eEG2Decay2.set_sensitive(false); |
981 |
eEG2ControllerInvert.set_sensitive(false); |
982 |
eLFO2InternalDepth.set_sensitive(false); |
983 |
eLFO2ControlDepth.set_sensitive(false); |
984 |
} |
985 |
} |
986 |
|
987 |
void DimRegionEdit::VCFCutoffController_changed() |
988 |
{ |
989 |
gig::vcf_cutoff_ctrl_t ctrl = eVCFCutoffController.get_value(); |
990 |
bool hasController = ctrl != gig::vcf_cutoff_ctrl_none && ctrl != gig::vcf_cutoff_ctrl_none2; |
991 |
|
992 |
eVCFCutoffControllerInvert.set_sensitive(hasController); |
993 |
eVCFCutoff.set_sensitive(!hasController); |
994 |
eVCFResonanceDynamic.set_sensitive(!hasController); |
995 |
eVCFVelocityScale.label.set_text(hasController ? _("Minimum cutoff:") : |
996 |
_("Velocity scale:")); |
997 |
} |
998 |
|
999 |
void DimRegionEdit::VCFResonanceController_changed() |
1000 |
{ |
1001 |
bool hasController = eVCFResonanceController.get_value() != gig::vcf_res_ctrl_none; |
1002 |
eVCFResonance.set_sensitive(!hasController); |
1003 |
} |
1004 |
|
1005 |
void DimRegionEdit::EG1InfiniteSustain_toggled() |
1006 |
{ |
1007 |
bool infSus = eEG1InfiniteSustain.get_value(); |
1008 |
eEG1Decay2.set_sensitive(!infSus); |
1009 |
} |
1010 |
|
1011 |
void DimRegionEdit::EG2InfiniteSustain_toggled() |
1012 |
{ |
1013 |
bool infSus = eEG2InfiniteSustain.get_value(); |
1014 |
eEG2Decay2.set_sensitive(!infSus); |
1015 |
} |
1016 |
|
1017 |
void DimRegionEdit::EG1Controller_changed() |
1018 |
{ |
1019 |
bool hasController = eEG1Controller.get_value().type != gig::leverage_ctrl_t::type_none; |
1020 |
eEG1ControllerInvert.set_sensitive(hasController); |
1021 |
} |
1022 |
|
1023 |
void DimRegionEdit::EG2Controller_changed() |
1024 |
{ |
1025 |
bool hasController = eEG2Controller.get_value().type != gig::leverage_ctrl_t::type_none; |
1026 |
eEG2ControllerInvert.set_sensitive(hasController); |
1027 |
} |
1028 |
|
1029 |
void DimRegionEdit::AttenuationController_changed() |
1030 |
{ |
1031 |
bool hasController = |
1032 |
eAttenuationController.get_value().type != gig::leverage_ctrl_t::type_none; |
1033 |
eInvertAttenuationController.set_sensitive(hasController); |
1034 |
eAttenuationControllerThreshold.set_sensitive(hasController); |
1035 |
eCrossfade_in_start.set_sensitive(hasController); |
1036 |
eCrossfade_in_end.set_sensitive(hasController); |
1037 |
eCrossfade_out_start.set_sensitive(hasController); |
1038 |
eCrossfade_out_end.set_sensitive(hasController); |
1039 |
crossfade_curve.set_sensitive(hasController); |
1040 |
} |
1041 |
|
1042 |
void DimRegionEdit::LFO1Controller_changed() |
1043 |
{ |
1044 |
gig::lfo1_ctrl_t ctrl = eLFO1Controller.get_value(); |
1045 |
eLFO1ControlDepth.set_sensitive(ctrl != gig::lfo1_ctrl_internal); |
1046 |
eLFO1InternalDepth.set_sensitive(ctrl != gig::lfo1_ctrl_modwheel && |
1047 |
ctrl != gig::lfo1_ctrl_breath); |
1048 |
} |
1049 |
|
1050 |
void DimRegionEdit::LFO2Controller_changed() |
1051 |
{ |
1052 |
gig::lfo2_ctrl_t ctrl = eLFO2Controller.get_value(); |
1053 |
eLFO2ControlDepth.set_sensitive(ctrl != gig::lfo2_ctrl_internal); |
1054 |
eLFO2InternalDepth.set_sensitive(ctrl != gig::lfo2_ctrl_modwheel && |
1055 |
ctrl != gig::lfo2_ctrl_foot); |
1056 |
} |
1057 |
|
1058 |
void DimRegionEdit::LFO3Controller_changed() |
1059 |
{ |
1060 |
gig::lfo3_ctrl_t ctrl = eLFO3Controller.get_value(); |
1061 |
eLFO3ControlDepth.set_sensitive(ctrl != gig::lfo3_ctrl_internal); |
1062 |
eLFO3InternalDepth.set_sensitive(ctrl != gig::lfo3_ctrl_modwheel && |
1063 |
ctrl != gig::lfo3_ctrl_aftertouch); |
1064 |
} |
1065 |
|
1066 |
void DimRegionEdit::crossfade1_changed() |
1067 |
{ |
1068 |
update_model++; |
1069 |
eCrossfade_in_end.set_value(dimregion->Crossfade.in_end); |
1070 |
eCrossfade_out_start.set_value(dimregion->Crossfade.out_start); |
1071 |
eCrossfade_out_end.set_value(dimregion->Crossfade.out_end); |
1072 |
update_model--; |
1073 |
} |
1074 |
|
1075 |
void DimRegionEdit::crossfade2_changed() |
1076 |
{ |
1077 |
update_model++; |
1078 |
eCrossfade_in_start.set_value(dimregion->Crossfade.in_start); |
1079 |
eCrossfade_out_start.set_value(dimregion->Crossfade.out_start); |
1080 |
eCrossfade_out_end.set_value(dimregion->Crossfade.out_end); |
1081 |
update_model--; |
1082 |
} |
1083 |
|
1084 |
void DimRegionEdit::crossfade3_changed() |
1085 |
{ |
1086 |
update_model++; |
1087 |
eCrossfade_in_start.set_value(dimregion->Crossfade.in_start); |
1088 |
eCrossfade_in_end.set_value(dimregion->Crossfade.in_end); |
1089 |
eCrossfade_out_end.set_value(dimregion->Crossfade.out_end); |
1090 |
update_model--; |
1091 |
} |
1092 |
|
1093 |
void DimRegionEdit::crossfade4_changed() |
1094 |
{ |
1095 |
update_model++; |
1096 |
eCrossfade_in_start.set_value(dimregion->Crossfade.in_start); |
1097 |
eCrossfade_in_end.set_value(dimregion->Crossfade.in_end); |
1098 |
eCrossfade_out_start.set_value(dimregion->Crossfade.out_start); |
1099 |
update_model--; |
1100 |
} |
1101 |
|
1102 |
void DimRegionEdit::update_loop_elements() |
1103 |
{ |
1104 |
update_model++; |
1105 |
const bool active = eSampleLoopEnabled.get_value(); |
1106 |
eSampleLoopStart.set_sensitive(active); |
1107 |
eSampleLoopLength.set_sensitive(active); |
1108 |
eSampleLoopType.set_sensitive(active); |
1109 |
eSampleLoopInfinite.set_sensitive(active && dimregion && dimregion->pSample); |
1110 |
// sample loop shall never be longer than the actual sample size |
1111 |
loop_start_changed(); |
1112 |
loop_length_changed(); |
1113 |
eSampleLoopStart.set_value( |
1114 |
dimregion->SampleLoops ? dimregion->pSampleLoops[0].LoopStart : 0); |
1115 |
eSampleLoopLength.set_value( |
1116 |
dimregion->SampleLoops ? dimregion->pSampleLoops[0].LoopLength : 0); |
1117 |
|
1118 |
eSampleLoopInfinite.set_value( |
1119 |
dimregion->pSample && dimregion->pSample->LoopPlayCount == 0); |
1120 |
|
1121 |
loop_infinite_toggled(); |
1122 |
update_model--; |
1123 |
} |
1124 |
|
1125 |
void DimRegionEdit::loop_start_changed() { |
1126 |
if (dimregion && dimregion->SampleLoops) { |
1127 |
eSampleLoopLength.set_upper(dimregion->pSample ? |
1128 |
dimregion->pSample->SamplesTotal - |
1129 |
dimregion->pSampleLoops[0].LoopStart : 0); |
1130 |
} |
1131 |
} |
1132 |
|
1133 |
void DimRegionEdit::loop_length_changed() { |
1134 |
if (dimregion && dimregion->SampleLoops) { |
1135 |
eSampleLoopStart.set_upper(dimregion->pSample ? |
1136 |
dimregion->pSample->SamplesTotal - |
1137 |
dimregion->pSampleLoops[0].LoopLength : 0); |
1138 |
} |
1139 |
} |
1140 |
|
1141 |
void DimRegionEdit::loop_infinite_toggled() { |
1142 |
eSampleLoopPlayCount.set_sensitive( |
1143 |
dimregion && dimregion->pSample && |
1144 |
!eSampleLoopInfinite.get_value() && |
1145 |
eSampleLoopEnabled.get_value() |
1146 |
); |
1147 |
update_model++; |
1148 |
eSampleLoopPlayCount.set_value( |
1149 |
dimregion->pSample ? dimregion->pSample->LoopPlayCount : 0); |
1150 |
update_model--; |
1151 |
} |
1152 |
|
1153 |
bool DimRegionEdit::set_sample(gig::Sample* sample) |
1154 |
{ |
1155 |
if (dimregion) { |
1156 |
//TODO: we should better move the code from MainWindow::on_sample_label_drop_drag_data_received() here |
1157 |
|
1158 |
// currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received() |
1159 |
//dimreg_to_be_changed_signal.emit(dimregion); |
1160 |
|
1161 |
// make sure stereo samples always are the same in both |
1162 |
// dimregs in the samplechannel dimension |
1163 |
int nbDimregs = 1; |
1164 |
gig::DimensionRegion* d[2] = { dimregion, 0 }; |
1165 |
if (sample->Channels == 2) { |
1166 |
gig::Region* region = dimregion->GetParent(); |
1167 |
|
1168 |
int bitcount = 0; |
1169 |
int stereo_bit = 0; |
1170 |
for (int dim = 0 ; dim < region->Dimensions ; dim++) { |
1171 |
if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) { |
1172 |
stereo_bit = 1 << bitcount; |
1173 |
break; |
1174 |
} |
1175 |
bitcount += region->pDimensionDefinitions[dim].bits; |
1176 |
} |
1177 |
|
1178 |
if (stereo_bit) { |
1179 |
int dimregno; |
1180 |
for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) { |
1181 |
if (region->pDimensionRegions[dimregno] == dimregion) { |
1182 |
break; |
1183 |
} |
1184 |
} |
1185 |
d[0] = region->pDimensionRegions[dimregno & ~stereo_bit]; |
1186 |
d[1] = region->pDimensionRegions[dimregno | stereo_bit]; |
1187 |
nbDimregs = 2; |
1188 |
} |
1189 |
} |
1190 |
|
1191 |
gig::Sample* oldref = dimregion->pSample; |
1192 |
|
1193 |
for (int i = 0 ; i < nbDimregs ; i++) { |
1194 |
d[i]->pSample = sample; |
1195 |
|
1196 |
// copy sample information from Sample to DimensionRegion |
1197 |
|
1198 |
d[i]->UnityNote = sample->MIDIUnityNote; |
1199 |
d[i]->FineTune = sample->FineTune; |
1200 |
|
1201 |
int loops = sample->Loops ? 1 : 0; |
1202 |
while (d[i]->SampleLoops > loops) { |
1203 |
d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]); |
1204 |
} |
1205 |
while (d[i]->SampleLoops < sample->Loops) { |
1206 |
DLS::sample_loop_t loop; |
1207 |
d[i]->AddSampleLoop(&loop); |
1208 |
} |
1209 |
if (loops) { |
1210 |
d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t); |
1211 |
d[i]->pSampleLoops[0].LoopType = sample->LoopType; |
1212 |
d[i]->pSampleLoops[0].LoopStart = sample->LoopStart; |
1213 |
d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1; |
1214 |
} |
1215 |
} |
1216 |
|
1217 |
// update ui |
1218 |
update_model++; |
1219 |
wSample->set_text(dimregion->pSample->pInfo->Name); |
1220 |
eUnityNote.set_value(dimregion->UnityNote); |
1221 |
eFineTune.set_value(dimregion->FineTune); |
1222 |
eSampleLoopEnabled.set_value(dimregion->SampleLoops); |
1223 |
update_loop_elements(); |
1224 |
update_model--; |
1225 |
|
1226 |
sample_ref_changed_signal.emit(oldref, sample); |
1227 |
// currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received() |
1228 |
//dimreg_changed_signal.emit(dimregion); |
1229 |
return true; |
1230 |
} |
1231 |
return false; |
1232 |
} |
1233 |
|
1234 |
sigc::signal<void, gig::DimensionRegion*>& DimRegionEdit::signal_dimreg_to_be_changed() { |
1235 |
return dimreg_to_be_changed_signal; |
1236 |
} |
1237 |
|
1238 |
sigc::signal<void, gig::DimensionRegion*>& DimRegionEdit::signal_dimreg_changed() { |
1239 |
return dimreg_changed_signal; |
1240 |
} |
1241 |
|
1242 |
sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& DimRegionEdit::signal_sample_ref_changed() { |
1243 |
return sample_ref_changed_signal; |
1244 |
} |
1245 |
|
1246 |
|
1247 |
void DimRegionEdit::set_UnityNote(gig::DimensionRegion* d, uint8_t value) |
1248 |
{ |
1249 |
d->UnityNote = value; |
1250 |
} |
1251 |
|
1252 |
void DimRegionEdit::set_FineTune(gig::DimensionRegion* d, int16_t value) |
1253 |
{ |
1254 |
d->FineTune = value; |
1255 |
} |
1256 |
|
1257 |
void DimRegionEdit::set_Crossfade_in_start(gig::DimensionRegion* d, |
1258 |
uint8_t value) |
1259 |
{ |
1260 |
d->Crossfade.in_start = value; |
1261 |
if (d->Crossfade.in_end < value) set_Crossfade_in_end(d, value); |
1262 |
} |
1263 |
|
1264 |
void DimRegionEdit::set_Crossfade_in_end(gig::DimensionRegion* d, |
1265 |
uint8_t value) |
1266 |
{ |
1267 |
d->Crossfade.in_end = value; |
1268 |
if (value < d->Crossfade.in_start) set_Crossfade_in_start(d, value); |
1269 |
if (value > d->Crossfade.out_start) set_Crossfade_out_start(d, value); |
1270 |
} |
1271 |
|
1272 |
void DimRegionEdit::set_Crossfade_out_start(gig::DimensionRegion* d, |
1273 |
uint8_t value) |
1274 |
{ |
1275 |
d->Crossfade.out_start = value; |
1276 |
if (value < d->Crossfade.in_end) set_Crossfade_in_end(d, value); |
1277 |
if (value > d->Crossfade.out_end) set_Crossfade_out_end(d, value); |
1278 |
} |
1279 |
|
1280 |
void DimRegionEdit::set_Crossfade_out_end(gig::DimensionRegion* d, |
1281 |
uint8_t value) |
1282 |
{ |
1283 |
d->Crossfade.out_end = value; |
1284 |
if (value < d->Crossfade.out_start) set_Crossfade_out_start(d, value); |
1285 |
} |
1286 |
|
1287 |
void DimRegionEdit::set_Gain(gig::DimensionRegion* d, int32_t value) |
1288 |
{ |
1289 |
d->SetGain(value); |
1290 |
} |
1291 |
|
1292 |
void DimRegionEdit::set_LoopEnabled(gig::DimensionRegion* d, bool value) |
1293 |
{ |
1294 |
if (value) { |
1295 |
// create a new sample loop in case there is none yet |
1296 |
if (!d->SampleLoops) { |
1297 |
DLS::sample_loop_t loop; |
1298 |
loop.LoopType = gig::loop_type_normal; |
1299 |
// loop the whole sample by default |
1300 |
loop.LoopStart = 0; |
1301 |
loop.LoopLength = |
1302 |
(d->pSample) ? d->pSample->SamplesTotal : 0; |
1303 |
dimreg_to_be_changed_signal.emit(d); |
1304 |
d->AddSampleLoop(&loop); |
1305 |
dimreg_changed_signal.emit(d); |
1306 |
} |
1307 |
} else { |
1308 |
if (d->SampleLoops) { |
1309 |
dimreg_to_be_changed_signal.emit(d); |
1310 |
// delete ALL existing sample loops |
1311 |
while (d->SampleLoops) { |
1312 |
d->DeleteSampleLoop(&d->pSampleLoops[0]); |
1313 |
} |
1314 |
dimreg_changed_signal.emit(d); |
1315 |
} |
1316 |
} |
1317 |
} |
1318 |
|
1319 |
void DimRegionEdit::set_LoopType(gig::DimensionRegion* d, uint32_t value) |
1320 |
{ |
1321 |
if (d->SampleLoops) d->pSampleLoops[0].LoopType = value; |
1322 |
} |
1323 |
|
1324 |
void DimRegionEdit::set_LoopStart(gig::DimensionRegion* d, uint32_t value) |
1325 |
{ |
1326 |
if (d->SampleLoops) { |
1327 |
d->pSampleLoops[0].LoopStart = |
1328 |
d->pSample ? |
1329 |
std::min(value, uint32_t(d->pSample->SamplesTotal - |
1330 |
d->pSampleLoops[0].LoopLength)) : |
1331 |
0; |
1332 |
} |
1333 |
} |
1334 |
|
1335 |
void DimRegionEdit::set_LoopLength(gig::DimensionRegion* d, uint32_t value) |
1336 |
{ |
1337 |
if (d->SampleLoops) { |
1338 |
d->pSampleLoops[0].LoopLength = |
1339 |
d->pSample ? |
1340 |
std::min(value, uint32_t(d->pSample->SamplesTotal - |
1341 |
d->pSampleLoops[0].LoopStart)) : |
1342 |
0; |
1343 |
} |
1344 |
} |
1345 |
|
1346 |
void DimRegionEdit::set_LoopInfinite(gig::DimensionRegion* d, bool value) |
1347 |
{ |
1348 |
if (d->pSample) { |
1349 |
if (value) d->pSample->LoopPlayCount = 0; |
1350 |
else if (d->pSample->LoopPlayCount == 0) d->pSample->LoopPlayCount = 1; |
1351 |
} |
1352 |
} |
1353 |
|
1354 |
void DimRegionEdit::set_LoopPlayCount(gig::DimensionRegion* d, uint32_t value) |
1355 |
{ |
1356 |
if (d->pSample) d->pSample->LoopPlayCount = value; |
1357 |
} |