/[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 2536 - (show annotations) (download)
Mon Apr 21 17:49:17 2014 UTC (5 years, 2 months ago) by schoenebeck
File size: 54332 byte(s)
* if there is no region yet, show a red hint text to the user that he may
  right click on the region chooser area to add a region
* added tooltips to main menu entries (was buggy before)
* added tooltips to instruments tree view and samples tree view
* added various tooltips and adjusted some labels on the region settings
  pane

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"), 0, 100, 2),
155 eEG1Attack(_("Attack"), 0, 60, 3),
156 eEG1Decay1(_("Decay 1"), 0.005, 60, 3),
157 eEG1Decay2(_("Decay 2"), 0, 60, 3),
158 eEG1InfiniteSustain(_("Infinite sustain")),
159 eEG1Sustain(_("Sustain"), 0, 100, 2),
160 eEG1Release(_("Release"), 0, 60, 3),
161 eEG1Hold(_("Hold")),
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"), 0, 100, 2),
174 eEG2Attack(_("Attack"), 0, 60, 3),
175 eEG2Decay1(_("Decay 1"), 0.005, 60, 3),
176 eEG2Decay2(_("Decay 2"), 0, 60, 3),
177 eEG2InfiniteSustain(_("Infinite sustain")),
178 eEG2Sustain(_("Sustain"), 0, 100, 2),
179 eEG2Release(_("Release"), 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(_("One note/voice per key (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(_("MS decode")),
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 pageno = 0;
393 rowno = 0;
394 firstRowInBlock = 0;
395
396 addHeader(_("Mandatory Settings"));
397 addString(_("Sample"), lSample, wSample);
398 //TODO: the following would break drag&drop: wSample->property_editable().set_value(false); or this: wSample->set_editable(false);
399 #ifdef OLD_TOOLTIPS
400 tooltips.set_tip(*wSample, _("Drag & drop a sample here"));
401 #else
402 wSample->set_tooltip_text(_("Drag & drop a sample here"));
403 #endif
404 addProp(eUnityNote);
405 addHeader(_("Optional Settings"));
406 addProp(eSampleStartOffset);
407 addProp(eChannelOffset);
408 addHeader(_("Loops"));
409 addProp(eSampleLoopEnabled);
410 addProp(eSampleLoopStart);
411 addProp(eSampleLoopLength);
412 {
413 const char* choices[] = { _("normal"), _("bidirectional"), _("backward"), 0 };
414 static const uint32_t values[] = {
415 gig::loop_type_normal,
416 gig::loop_type_bidirectional,
417 gig::loop_type_backward
418 };
419 eSampleLoopType.set_choices(choices, values);
420 }
421 addProp(eSampleLoopType);
422 addProp(eSampleLoopInfinite);
423 addProp(eSampleLoopPlayCount);
424
425 nextPage();
426
427 addHeader(_("General Amplitude Settings"));
428 addProp(eGain);
429 addProp(eGainPlus6);
430 addProp(ePan);
431 addHeader(_("Amplitude Envelope (EG1)"));
432 addProp(eEG1PreAttack);
433 addProp(eEG1Attack);
434 addProp(eEG1Decay1);
435 addProp(eEG1Decay2);
436 addProp(eEG1InfiniteSustain);
437 addProp(eEG1Sustain);
438 addProp(eEG1Release);
439 addProp(eEG1Hold);
440 addProp(eEG1Controller);
441 addProp(eEG1ControllerInvert);
442 addProp(eEG1ControllerAttackInfluence);
443 addProp(eEG1ControllerDecayInfluence);
444 addProp(eEG1ControllerReleaseInfluence);
445
446 nextPage();
447
448 addHeader(_("Amplitude Oscillator (LFO1)"));
449 addProp(eLFO1Frequency);
450 addProp(eLFO1InternalDepth);
451 addProp(eLFO1ControlDepth);
452 {
453 const char* choices[] = { _("internal"), _("modwheel"), _("breath"),
454 _("internal+modwheel"), _("internal+breath"), 0 };
455 static const gig::lfo1_ctrl_t values[] = {
456 gig::lfo1_ctrl_internal,
457 gig::lfo1_ctrl_modwheel,
458 gig::lfo1_ctrl_breath,
459 gig::lfo1_ctrl_internal_modwheel,
460 gig::lfo1_ctrl_internal_breath
461 };
462 eLFO1Controller.set_choices(choices, values);
463 }
464 addProp(eLFO1Controller);
465 addProp(eLFO1FlipPhase);
466 addProp(eLFO1Sync);
467 addHeader(_("Crossfade"));
468 addProp(eAttenuationController);
469 addProp(eInvertAttenuationController);
470 addProp(eAttenuationControllerThreshold);
471 addProp(eCrossfade_in_start);
472 addProp(eCrossfade_in_end);
473 addProp(eCrossfade_out_start);
474 addProp(eCrossfade_out_end);
475
476 Gtk::Frame* frame = new Gtk::Frame;
477 frame->add(crossfade_curve);
478 table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
479 Gtk::SHRINK, Gtk::SHRINK);
480 rowno++;
481
482 eCrossfade_in_start.signal_value_changed().connect(
483 sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
484 eCrossfade_in_end.signal_value_changed().connect(
485 sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
486 eCrossfade_out_start.signal_value_changed().connect(
487 sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
488 eCrossfade_out_end.signal_value_changed().connect(
489 sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
490
491 nextPage();
492
493 addHeader(_("General Filter Settings"));
494 addProp(eVCFEnabled);
495 {
496 const char* choices[] = { _("lowpass"), _("lowpassturbo"), _("bandpass"),
497 _("highpass"), _("bandreject"), 0 };
498 static const gig::vcf_type_t values[] = {
499 gig::vcf_type_lowpass,
500 gig::vcf_type_lowpassturbo,
501 gig::vcf_type_bandpass,
502 gig::vcf_type_highpass,
503 gig::vcf_type_bandreject
504 };
505 eVCFType.set_choices(choices, values);
506 }
507 addProp(eVCFType);
508 {
509 const char* choices[] = { _("none"), _("none2"), _("modwheel"), _("effect1"), _("effect2"),
510 _("breath"), _("foot"), _("sustainpedal"), _("softpedal"),
511 _("genpurpose7"), _("genpurpose8"), _("aftertouch"), 0 };
512 static const gig::vcf_cutoff_ctrl_t values[] = {
513 gig::vcf_cutoff_ctrl_none,
514 gig::vcf_cutoff_ctrl_none2,
515 gig::vcf_cutoff_ctrl_modwheel,
516 gig::vcf_cutoff_ctrl_effect1,
517 gig::vcf_cutoff_ctrl_effect2,
518 gig::vcf_cutoff_ctrl_breath,
519 gig::vcf_cutoff_ctrl_foot,
520 gig::vcf_cutoff_ctrl_sustainpedal,
521 gig::vcf_cutoff_ctrl_softpedal,
522 gig::vcf_cutoff_ctrl_genpurpose7,
523 gig::vcf_cutoff_ctrl_genpurpose8,
524 gig::vcf_cutoff_ctrl_aftertouch
525 };
526 eVCFCutoffController.set_choices(choices, values);
527 }
528 addProp(eVCFCutoffController);
529 addProp(eVCFCutoffControllerInvert);
530 addProp(eVCFCutoff);
531 const char* curve_type_texts[] = { _("nonlinear"), _("linear"), _("special"), 0 };
532 static const gig::curve_type_t curve_type_values[] = {
533 gig::curve_type_nonlinear,
534 gig::curve_type_linear,
535 gig::curve_type_special
536 };
537 eVCFVelocityCurve.set_choices(curve_type_texts, curve_type_values);
538 addProp(eVCFVelocityCurve);
539 addProp(eVCFVelocityScale);
540 addProp(eVCFVelocityDynamicRange);
541
542 eVCFCutoffController.signal_value_changed().connect(
543 sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
544 eVCFVelocityCurve.signal_value_changed().connect(
545 sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
546 eVCFVelocityScale.signal_value_changed().connect(
547 sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
548 eVCFVelocityDynamicRange.signal_value_changed().connect(
549 sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
550
551 frame = new Gtk::Frame;
552 frame->add(cutoff_curve);
553 table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
554 Gtk::SHRINK, Gtk::SHRINK);
555 rowno++;
556
557 addProp(eVCFResonance);
558 addProp(eVCFResonanceDynamic);
559 {
560 const char* choices[] = { _("none"), _("genpurpose3"), _("genpurpose4"),
561 _("genpurpose5"), _("genpurpose6"), 0 };
562 static const gig::vcf_res_ctrl_t values[] = {
563 gig::vcf_res_ctrl_none,
564 gig::vcf_res_ctrl_genpurpose3,
565 gig::vcf_res_ctrl_genpurpose4,
566 gig::vcf_res_ctrl_genpurpose5,
567 gig::vcf_res_ctrl_genpurpose6
568 };
569 eVCFResonanceController.set_choices(choices, values);
570 }
571 addProp(eVCFResonanceController);
572 addProp(eVCFKeyboardTracking);
573 addProp(eVCFKeyboardTrackingBreakpoint);
574
575 nextPage();
576
577 lEG2 = addHeader(_("Filter Cutoff Envelope (EG2)"));
578 addProp(eEG2PreAttack);
579 addProp(eEG2Attack);
580 addProp(eEG2Decay1);
581 addProp(eEG2Decay2);
582 addProp(eEG2InfiniteSustain);
583 addProp(eEG2Sustain);
584 addProp(eEG2Release);
585 addProp(eEG2Controller);
586 addProp(eEG2ControllerInvert);
587 addProp(eEG2ControllerAttackInfluence);
588 addProp(eEG2ControllerDecayInfluence);
589 addProp(eEG2ControllerReleaseInfluence);
590 lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)"));
591 addProp(eLFO2Frequency);
592 addProp(eLFO2InternalDepth);
593 addProp(eLFO2ControlDepth);
594 {
595 const char* choices[] = { _("internal"), _("modwheel"), _("foot"),
596 _("internal+modwheel"), _("internal+foot"), 0 };
597 static const gig::lfo2_ctrl_t values[] = {
598 gig::lfo2_ctrl_internal,
599 gig::lfo2_ctrl_modwheel,
600 gig::lfo2_ctrl_foot,
601 gig::lfo2_ctrl_internal_modwheel,
602 gig::lfo2_ctrl_internal_foot
603 };
604 eLFO2Controller.set_choices(choices, values);
605 }
606 addProp(eLFO2Controller);
607 addProp(eLFO2FlipPhase);
608 addProp(eLFO2Sync);
609
610 nextPage();
611
612 addHeader(_("General Pitch Settings"));
613 addProp(eFineTune);
614 addProp(ePitchTrack);
615 addHeader(_("Pitch Envelope (EG3)"));
616 addProp(eEG3Attack);
617 addProp(eEG3Depth);
618 addHeader(_("Pitch Oscillator (LFO3)"));
619 addProp(eLFO3Frequency);
620 addProp(eLFO3InternalDepth);
621 addProp(eLFO3ControlDepth);
622 {
623 const char* choices[] = { _("internal"), _("modwheel"), _("aftertouch"),
624 _("internal+modwheel"), _("internal+aftertouch"), 0 };
625 static const gig::lfo3_ctrl_t values[] = {
626 gig::lfo3_ctrl_internal,
627 gig::lfo3_ctrl_modwheel,
628 gig::lfo3_ctrl_aftertouch,
629 gig::lfo3_ctrl_internal_modwheel,
630 gig::lfo3_ctrl_internal_aftertouch
631 };
632 eLFO3Controller.set_choices(choices, values);
633 }
634 addProp(eLFO3Controller);
635 addProp(eLFO3Sync);
636
637 nextPage();
638
639 addHeader(_("Velocity Reponse"));
640 eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values);
641 addProp(eVelocityResponseCurve);
642 addProp(eVelocityResponseDepth);
643 addProp(eVelocityResponseCurveScaling);
644
645 eVelocityResponseCurve.signal_value_changed().connect(
646 sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
647 eVelocityResponseDepth.signal_value_changed().connect(
648 sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
649 eVelocityResponseCurveScaling.signal_value_changed().connect(
650 sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
651
652 frame = new Gtk::Frame;
653 frame->add(velocity_curve);
654 table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
655 Gtk::SHRINK, Gtk::SHRINK);
656 rowno++;
657
658 addHeader(_("Release Velocity Reponse"));
659 eReleaseVelocityResponseCurve.set_choices(curve_type_texts,
660 curve_type_values);
661 addProp(eReleaseVelocityResponseCurve);
662 addProp(eReleaseVelocityResponseDepth);
663
664 eReleaseVelocityResponseCurve.signal_value_changed().connect(
665 sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));
666 eReleaseVelocityResponseDepth.signal_value_changed().connect(
667 sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));
668 frame = new Gtk::Frame;
669 frame->add(release_curve);
670 table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
671 Gtk::SHRINK, Gtk::SHRINK);
672 rowno++;
673
674 addProp(eReleaseTriggerDecay);
675 {
676 const char* choices[] = { _("none"), _("effect4depth"), _("effect5depth"), 0 };
677 static const gig::dim_bypass_ctrl_t values[] = {
678 gig::dim_bypass_ctrl_none,
679 gig::dim_bypass_ctrl_94,
680 gig::dim_bypass_ctrl_95
681 };
682 eDimensionBypass.set_choices(choices, values);
683 }
684 addProp(eDimensionBypass);
685 eSelfMask.widget.set_tooltip_text(_("If enabled: high velocity notes will stop low velocity notes at the same note, that way you can save voices that wouldn't be audible anyway."));
686 addProp(eSelfMask);
687 eSustainDefeat.widget.set_tooltip_text(_("If enabled: sustain pedal will not hold a note."));
688 addProp(eSustainDefeat);
689 eMSDecode.widget.set_tooltip_text(_("Gigastudio specific flag: defines if Mid Side Recordings should be decoded."));
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 ? gig_to_utf8(d->pSample->pInfo->Name) :
932 _("NULL"));
933
934 update_loop_elements();
935 VCFEnabled_toggled();
936 }
937
938
939 void DimRegionEdit::VCFEnabled_toggled()
940 {
941 bool sensitive = eVCFEnabled.get_value();
942 eVCFType.set_sensitive(sensitive);
943 eVCFCutoffController.set_sensitive(sensitive);
944 eVCFVelocityCurve.set_sensitive(sensitive);
945 eVCFVelocityScale.set_sensitive(sensitive);
946 eVCFVelocityDynamicRange.set_sensitive(sensitive);
947 cutoff_curve.set_sensitive(sensitive);
948 eVCFResonance.set_sensitive(sensitive);
949 eVCFResonanceController.set_sensitive(sensitive);
950 eVCFKeyboardTracking.set_sensitive(sensitive);
951 eVCFKeyboardTrackingBreakpoint.set_sensitive(sensitive);
952 lEG2->set_sensitive(sensitive);
953 eEG2PreAttack.set_sensitive(sensitive);
954 eEG2Attack.set_sensitive(sensitive);
955 eEG2Decay1.set_sensitive(sensitive);
956 eEG2InfiniteSustain.set_sensitive(sensitive);
957 eEG2Sustain.set_sensitive(sensitive);
958 eEG2Release.set_sensitive(sensitive);
959 eEG2Controller.set_sensitive(sensitive);
960 eEG2ControllerAttackInfluence.set_sensitive(sensitive);
961 eEG2ControllerDecayInfluence.set_sensitive(sensitive);
962 eEG2ControllerReleaseInfluence.set_sensitive(sensitive);
963 lLFO2->set_sensitive(sensitive);
964 eLFO2Frequency.set_sensitive(sensitive);
965 eLFO2InternalDepth.set_sensitive(sensitive);
966 eLFO2ControlDepth.set_sensitive(sensitive);
967 eLFO2Controller.set_sensitive(sensitive);
968 eLFO2FlipPhase.set_sensitive(sensitive);
969 eLFO2Sync.set_sensitive(sensitive);
970 if (sensitive) {
971 VCFCutoffController_changed();
972 VCFResonanceController_changed();
973 EG2InfiniteSustain_toggled();
974 EG2Controller_changed();
975 LFO2Controller_changed();
976 } else {
977 eVCFCutoffControllerInvert.set_sensitive(false);
978 eVCFCutoff.set_sensitive(false);
979 eVCFResonanceDynamic.set_sensitive(false);
980 eVCFResonance.set_sensitive(false);
981 eEG2Decay2.set_sensitive(false);
982 eEG2ControllerInvert.set_sensitive(false);
983 eLFO2InternalDepth.set_sensitive(false);
984 eLFO2ControlDepth.set_sensitive(false);
985 }
986 }
987
988 void DimRegionEdit::VCFCutoffController_changed()
989 {
990 gig::vcf_cutoff_ctrl_t ctrl = eVCFCutoffController.get_value();
991 bool hasController = ctrl != gig::vcf_cutoff_ctrl_none && ctrl != gig::vcf_cutoff_ctrl_none2;
992
993 eVCFCutoffControllerInvert.set_sensitive(hasController);
994 eVCFCutoff.set_sensitive(!hasController);
995 eVCFResonanceDynamic.set_sensitive(!hasController);
996 eVCFVelocityScale.label.set_text(hasController ? _("Minimum cutoff:") :
997 _("Velocity scale:"));
998 }
999
1000 void DimRegionEdit::VCFResonanceController_changed()
1001 {
1002 bool hasController = eVCFResonanceController.get_value() != gig::vcf_res_ctrl_none;
1003 eVCFResonance.set_sensitive(!hasController);
1004 }
1005
1006 void DimRegionEdit::EG1InfiniteSustain_toggled()
1007 {
1008 bool infSus = eEG1InfiniteSustain.get_value();
1009 eEG1Decay2.set_sensitive(!infSus);
1010 }
1011
1012 void DimRegionEdit::EG2InfiniteSustain_toggled()
1013 {
1014 bool infSus = eEG2InfiniteSustain.get_value();
1015 eEG2Decay2.set_sensitive(!infSus);
1016 }
1017
1018 void DimRegionEdit::EG1Controller_changed()
1019 {
1020 bool hasController = eEG1Controller.get_value().type != gig::leverage_ctrl_t::type_none;
1021 eEG1ControllerInvert.set_sensitive(hasController);
1022 }
1023
1024 void DimRegionEdit::EG2Controller_changed()
1025 {
1026 bool hasController = eEG2Controller.get_value().type != gig::leverage_ctrl_t::type_none;
1027 eEG2ControllerInvert.set_sensitive(hasController);
1028 }
1029
1030 void DimRegionEdit::AttenuationController_changed()
1031 {
1032 bool hasController =
1033 eAttenuationController.get_value().type != gig::leverage_ctrl_t::type_none;
1034 eInvertAttenuationController.set_sensitive(hasController);
1035 eAttenuationControllerThreshold.set_sensitive(hasController);
1036 eCrossfade_in_start.set_sensitive(hasController);
1037 eCrossfade_in_end.set_sensitive(hasController);
1038 eCrossfade_out_start.set_sensitive(hasController);
1039 eCrossfade_out_end.set_sensitive(hasController);
1040 crossfade_curve.set_sensitive(hasController);
1041 }
1042
1043 void DimRegionEdit::LFO1Controller_changed()
1044 {
1045 gig::lfo1_ctrl_t ctrl = eLFO1Controller.get_value();
1046 eLFO1ControlDepth.set_sensitive(ctrl != gig::lfo1_ctrl_internal);
1047 eLFO1InternalDepth.set_sensitive(ctrl != gig::lfo1_ctrl_modwheel &&
1048 ctrl != gig::lfo1_ctrl_breath);
1049 }
1050
1051 void DimRegionEdit::LFO2Controller_changed()
1052 {
1053 gig::lfo2_ctrl_t ctrl = eLFO2Controller.get_value();
1054 eLFO2ControlDepth.set_sensitive(ctrl != gig::lfo2_ctrl_internal);
1055 eLFO2InternalDepth.set_sensitive(ctrl != gig::lfo2_ctrl_modwheel &&
1056 ctrl != gig::lfo2_ctrl_foot);
1057 }
1058
1059 void DimRegionEdit::LFO3Controller_changed()
1060 {
1061 gig::lfo3_ctrl_t ctrl = eLFO3Controller.get_value();
1062 eLFO3ControlDepth.set_sensitive(ctrl != gig::lfo3_ctrl_internal);
1063 eLFO3InternalDepth.set_sensitive(ctrl != gig::lfo3_ctrl_modwheel &&
1064 ctrl != gig::lfo3_ctrl_aftertouch);
1065 }
1066
1067 void DimRegionEdit::crossfade1_changed()
1068 {
1069 update_model++;
1070 eCrossfade_in_end.set_value(dimregion->Crossfade.in_end);
1071 eCrossfade_out_start.set_value(dimregion->Crossfade.out_start);
1072 eCrossfade_out_end.set_value(dimregion->Crossfade.out_end);
1073 update_model--;
1074 }
1075
1076 void DimRegionEdit::crossfade2_changed()
1077 {
1078 update_model++;
1079 eCrossfade_in_start.set_value(dimregion->Crossfade.in_start);
1080 eCrossfade_out_start.set_value(dimregion->Crossfade.out_start);
1081 eCrossfade_out_end.set_value(dimregion->Crossfade.out_end);
1082 update_model--;
1083 }
1084
1085 void DimRegionEdit::crossfade3_changed()
1086 {
1087 update_model++;
1088 eCrossfade_in_start.set_value(dimregion->Crossfade.in_start);
1089 eCrossfade_in_end.set_value(dimregion->Crossfade.in_end);
1090 eCrossfade_out_end.set_value(dimregion->Crossfade.out_end);
1091 update_model--;
1092 }
1093
1094 void DimRegionEdit::crossfade4_changed()
1095 {
1096 update_model++;
1097 eCrossfade_in_start.set_value(dimregion->Crossfade.in_start);
1098 eCrossfade_in_end.set_value(dimregion->Crossfade.in_end);
1099 eCrossfade_out_start.set_value(dimregion->Crossfade.out_start);
1100 update_model--;
1101 }
1102
1103 void DimRegionEdit::update_loop_elements()
1104 {
1105 update_model++;
1106 const bool active = eSampleLoopEnabled.get_value();
1107 eSampleLoopStart.set_sensitive(active);
1108 eSampleLoopLength.set_sensitive(active);
1109 eSampleLoopType.set_sensitive(active);
1110 eSampleLoopInfinite.set_sensitive(active && dimregion && dimregion->pSample);
1111 // sample loop shall never be longer than the actual sample size
1112 loop_start_changed();
1113 loop_length_changed();
1114 eSampleLoopStart.set_value(
1115 dimregion->SampleLoops ? dimregion->pSampleLoops[0].LoopStart : 0);
1116 eSampleLoopLength.set_value(
1117 dimregion->SampleLoops ? dimregion->pSampleLoops[0].LoopLength : 0);
1118
1119 eSampleLoopInfinite.set_value(
1120 dimregion->pSample && dimregion->pSample->LoopPlayCount == 0);
1121
1122 loop_infinite_toggled();
1123 update_model--;
1124 }
1125
1126 void DimRegionEdit::loop_start_changed() {
1127 if (dimregion && dimregion->SampleLoops) {
1128 eSampleLoopLength.set_upper(dimregion->pSample ?
1129 dimregion->pSample->SamplesTotal -
1130 dimregion->pSampleLoops[0].LoopStart : 0);
1131 }
1132 }
1133
1134 void DimRegionEdit::loop_length_changed() {
1135 if (dimregion && dimregion->SampleLoops) {
1136 eSampleLoopStart.set_upper(dimregion->pSample ?
1137 dimregion->pSample->SamplesTotal -
1138 dimregion->pSampleLoops[0].LoopLength : 0);
1139 }
1140 }
1141
1142 void DimRegionEdit::loop_infinite_toggled() {
1143 eSampleLoopPlayCount.set_sensitive(
1144 dimregion && dimregion->pSample &&
1145 !eSampleLoopInfinite.get_value() &&
1146 eSampleLoopEnabled.get_value()
1147 );
1148 update_model++;
1149 eSampleLoopPlayCount.set_value(
1150 dimregion->pSample ? dimregion->pSample->LoopPlayCount : 0);
1151 update_model--;
1152 }
1153
1154 bool DimRegionEdit::set_sample(gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop)
1155 {
1156 if (dimregion) {
1157 //TODO: we should better move the code from MainWindow::on_sample_label_drop_drag_data_received() here
1158
1159 // currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received()
1160 //dimreg_to_be_changed_signal.emit(dimregion);
1161
1162 // make sure stereo samples always are the same in both
1163 // dimregs in the samplechannel dimension
1164 int nbDimregs = 1;
1165 gig::DimensionRegion* d[2] = { dimregion, 0 };
1166 if (sample->Channels == 2) {
1167 gig::Region* region = dimregion->GetParent();
1168
1169 int bitcount = 0;
1170 int stereo_bit = 0;
1171 for (int dim = 0 ; dim < region->Dimensions ; dim++) {
1172 if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) {
1173 stereo_bit = 1 << bitcount;
1174 break;
1175 }
1176 bitcount += region->pDimensionDefinitions[dim].bits;
1177 }
1178
1179 if (stereo_bit) {
1180 int dimregno;
1181 for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) {
1182 if (region->pDimensionRegions[dimregno] == dimregion) {
1183 break;
1184 }
1185 }
1186 d[0] = region->pDimensionRegions[dimregno & ~stereo_bit];
1187 d[1] = region->pDimensionRegions[dimregno | stereo_bit];
1188 nbDimregs = 2;
1189 }
1190 }
1191
1192 gig::Sample* oldref = dimregion->pSample;
1193
1194 for (int i = 0 ; i < nbDimregs ; i++) {
1195 d[i]->pSample = sample;
1196
1197 // copy sample information from Sample to DimensionRegion
1198 if (copy_sample_unity)
1199 d[i]->UnityNote = sample->MIDIUnityNote;
1200 if (copy_sample_tune)
1201 d[i]->FineTune = sample->FineTune;
1202 if (copy_sample_loop) {
1203 int loops = sample->Loops ? 1 : 0;
1204 while (d[i]->SampleLoops > loops) {
1205 d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]);
1206 }
1207 while (d[i]->SampleLoops < sample->Loops) {
1208 DLS::sample_loop_t loop;
1209 d[i]->AddSampleLoop(&loop);
1210 }
1211 if (loops) {
1212 d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t);
1213 d[i]->pSampleLoops[0].LoopType = sample->LoopType;
1214 d[i]->pSampleLoops[0].LoopStart = sample->LoopStart;
1215 d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1;
1216 }
1217 }
1218 }
1219
1220 // update ui
1221 update_model++;
1222 wSample->set_text(gig_to_utf8(dimregion->pSample->pInfo->Name));
1223 eUnityNote.set_value(dimregion->UnityNote);
1224 eFineTune.set_value(dimregion->FineTune);
1225 eSampleLoopEnabled.set_value(dimregion->SampleLoops);
1226 update_loop_elements();
1227 update_model--;
1228
1229 sample_ref_changed_signal.emit(oldref, sample);
1230 // currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received()
1231 //dimreg_changed_signal.emit(dimregion);
1232 return true;
1233 }
1234 return false;
1235 }
1236
1237 sigc::signal<void, gig::DimensionRegion*>& DimRegionEdit::signal_dimreg_to_be_changed() {
1238 return dimreg_to_be_changed_signal;
1239 }
1240
1241 sigc::signal<void, gig::DimensionRegion*>& DimRegionEdit::signal_dimreg_changed() {
1242 return dimreg_changed_signal;
1243 }
1244
1245 sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& DimRegionEdit::signal_sample_ref_changed() {
1246 return sample_ref_changed_signal;
1247 }
1248
1249
1250 void DimRegionEdit::set_UnityNote(gig::DimensionRegion* d, uint8_t value)
1251 {
1252 d->UnityNote = value;
1253 }
1254
1255 void DimRegionEdit::set_FineTune(gig::DimensionRegion* d, int16_t value)
1256 {
1257 d->FineTune = value;
1258 }
1259
1260 void DimRegionEdit::set_Crossfade_in_start(gig::DimensionRegion* d,
1261 uint8_t value)
1262 {
1263 d->Crossfade.in_start = value;
1264 if (d->Crossfade.in_end < value) set_Crossfade_in_end(d, value);
1265 }
1266
1267 void DimRegionEdit::set_Crossfade_in_end(gig::DimensionRegion* d,
1268 uint8_t value)
1269 {
1270 d->Crossfade.in_end = value;
1271 if (value < d->Crossfade.in_start) set_Crossfade_in_start(d, value);
1272 if (value > d->Crossfade.out_start) set_Crossfade_out_start(d, value);
1273 }
1274
1275 void DimRegionEdit::set_Crossfade_out_start(gig::DimensionRegion* d,
1276 uint8_t value)
1277 {
1278 d->Crossfade.out_start = value;
1279 if (value < d->Crossfade.in_end) set_Crossfade_in_end(d, value);
1280 if (value > d->Crossfade.out_end) set_Crossfade_out_end(d, value);
1281 }
1282
1283 void DimRegionEdit::set_Crossfade_out_end(gig::DimensionRegion* d,
1284 uint8_t value)
1285 {
1286 d->Crossfade.out_end = value;
1287 if (value < d->Crossfade.out_start) set_Crossfade_out_start(d, value);
1288 }
1289
1290 void DimRegionEdit::set_Gain(gig::DimensionRegion* d, int32_t value)
1291 {
1292 d->SetGain(value);
1293 }
1294
1295 void DimRegionEdit::set_LoopEnabled(gig::DimensionRegion* d, bool value)
1296 {
1297 if (value) {
1298 // create a new sample loop in case there is none yet
1299 if (!d->SampleLoops) {
1300 DLS::sample_loop_t loop;
1301 loop.LoopType = gig::loop_type_normal;
1302 // loop the whole sample by default
1303 loop.LoopStart = 0;
1304 loop.LoopLength =
1305 (d->pSample) ? d->pSample->SamplesTotal : 0;
1306 dimreg_to_be_changed_signal.emit(d);
1307 d->AddSampleLoop(&loop);
1308 dimreg_changed_signal.emit(d);
1309 }
1310 } else {
1311 if (d->SampleLoops) {
1312 dimreg_to_be_changed_signal.emit(d);
1313 // delete ALL existing sample loops
1314 while (d->SampleLoops) {
1315 d->DeleteSampleLoop(&d->pSampleLoops[0]);
1316 }
1317 dimreg_changed_signal.emit(d);
1318 }
1319 }
1320 }
1321
1322 void DimRegionEdit::set_LoopType(gig::DimensionRegion* d, uint32_t value)
1323 {
1324 if (d->SampleLoops) d->pSampleLoops[0].LoopType = value;
1325 }
1326
1327 void DimRegionEdit::set_LoopStart(gig::DimensionRegion* d, uint32_t value)
1328 {
1329 if (d->SampleLoops) {
1330 d->pSampleLoops[0].LoopStart =
1331 d->pSample ?
1332 std::min(value, uint32_t(d->pSample->SamplesTotal -
1333 d->pSampleLoops[0].LoopLength)) :
1334 0;
1335 }
1336 }
1337
1338 void DimRegionEdit::set_LoopLength(gig::DimensionRegion* d, uint32_t value)
1339 {
1340 if (d->SampleLoops) {
1341 d->pSampleLoops[0].LoopLength =
1342 d->pSample ?
1343 std::min(value, uint32_t(d->pSample->SamplesTotal -
1344 d->pSampleLoops[0].LoopStart)) :
1345 0;
1346 }
1347 }
1348
1349 void DimRegionEdit::set_LoopInfinite(gig::DimensionRegion* d, bool value)
1350 {
1351 if (d->pSample) {
1352 if (value) d->pSample->LoopPlayCount = 0;
1353 else if (d->pSample->LoopPlayCount == 0) d->pSample->LoopPlayCount = 1;
1354 }
1355 }
1356
1357 void DimRegionEdit::set_LoopPlayCount(gig::DimensionRegion* d, uint32_t value)
1358 {
1359 if (d->pSample) d->pSample->LoopPlayCount = value;
1360 }

  ViewVC Help
Powered by ViewVC