/[svn]/gigedit/trunk/src/gigedit/dimregionedit.cpp
ViewVC logotype

Contents of /gigedit/trunk/src/gigedit/dimregionedit.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2566 - (show annotations) (download)
Tue May 20 14:35:36 2014 UTC (6 years ago) by schoenebeck
File size: 57199 byte(s)
* Minor usability improvements (UI labels and tooltips).

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

  ViewVC Help
Powered by ViewVC