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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1623 by persson, Fri Jan 4 19:42:45 2008 UTC revision 2430 by persson, Sun Mar 3 17:26:11 2013 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006-2008 Andreas Persson   * Copyright (C) 2006-2013 Andreas Persson
3   *   *
4   * This program is free software; you can redistribute it and/or   * This program is free software; you can redistribute it and/or
5   * modify it under the terms of the GNU General Public License as   * modify it under the terms of the GNU General Public License as
# Line 20  Line 20 
20  #include "dimregionedit.h"  #include "dimregionedit.h"
21    
22  #include "global.h"  #include "global.h"
23    #include "compat.h"
24    
25    VelocityCurve::VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t)) :
26        getter(getter), dimreg(0) {
27        set_size_request(80, 80);
28    }
29    
30    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
31    bool VelocityCurve::on_expose_event(GdkEventExpose* e) {
32        const Cairo::RefPtr<Cairo::Context>& cr =
33            get_window()->create_cairo_context();
34    #if 0
35    }
36    #endif
37    #else
38    bool VelocityCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) {
39    #endif
40        if (dimreg) {
41            int w = get_width();
42            int h = get_height();
43    
44            for (int pass = 0 ; pass < 2 ; pass++) {
45                for (double x = 0 ; x <= w ; x++) {
46                    int vel = int(x * (127 - 1e-10) / w + 1);
47                    double y = (1 - (dimreg->*getter)(vel)) * (h - 3) + 1.5;
48    
49                    if (x < 1e-10) {
50                        cr->move_to(x, y);
51                    } else {
52                        cr->line_to(x, y);
53                    }
54                }
55                if (pass == 0) {
56                    cr->line_to(w, h);
57                    cr->line_to(0, h);
58                    cr->set_source_rgba(0.5, 0.44, 1.0, is_sensitive() ? 0.2 : 0.1);
59                    cr->fill();
60                } else {
61                    cr->set_line_width(3);
62                    cr->set_source_rgba(0.5, 0.44, 1.0, is_sensitive() ? 1.0 : 0.3);
63                    cr->stroke();
64                }
65            }
66        }
67        return true;
68    }
69    
70    
71    CrossfadeCurve::CrossfadeCurve() : dimreg(0) {
72        set_size_request(280, 80);
73    }
74    
75    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
76    bool CrossfadeCurve::on_expose_event(GdkEventExpose* e) {
77        const Cairo::RefPtr<Cairo::Context>& cr =
78            get_window()->create_cairo_context();
79    #if 0
80    }
81    #endif
82    #else
83    bool CrossfadeCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) {
84    #endif
85        if (dimreg) {
86            cr->translate(1.5, 0);
87    
88            // first, draw curves for the other layers
89            gig::Region* region = dimreg->GetParent();
90            int dimregno;
91            for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) {
92                if (region->pDimensionRegions[dimregno] == dimreg) {
93                    break;
94                }
95            }
96            int bitcount = 0;
97            int layer_bit = 0;
98            for (int dim = 0 ; dim < region->Dimensions ; dim++) {
99                if (region->pDimensionDefinitions[dim].dimension ==
100                    gig::dimension_layer) {
101                    layer_bit = 1 << bitcount;
102    
103                    int mask =
104                        ~(((1 << region->pDimensionDefinitions[dim].bits) - 1) <<
105                          bitcount);
106                    int c = dimregno & mask; // mask away the layer dimension
107    
108                    for (int i = 0 ; i < region->pDimensionDefinitions[dim].zones ;
109                         i++) {
110                        gig::DimensionRegion* d =
111                            region->pDimensionRegions[c + (i << bitcount)];
112                        if (d != dimreg) {
113                            draw_one_curve(cr, d, false);
114                        }
115                    }
116                    break;
117                }
118                bitcount += region->pDimensionDefinitions[dim].bits;
119            }
120    
121            // then, draw the currently selected layer
122            draw_one_curve(cr, dimreg, is_sensitive());
123        }
124        return true;
125    }
126    
127    void CrossfadeCurve::draw_one_curve(const Cairo::RefPtr<Cairo::Context>& cr,
128                                        const gig::DimensionRegion* d,
129                                        bool sensitive) {
130        int w = get_width();
131        int h = get_height();
132    
133        if (d->Crossfade.out_end) {
134            for (int pass = 0 ; pass < 2 ; pass++) {
135                cr->move_to(d->Crossfade.in_start / 127.0 * (w - 3), h);
136                cr->line_to(d->Crossfade.in_end / 127.0 * (w - 3), 1.5);
137                cr->line_to(d->Crossfade.out_start / 127.0 * (w - 3), 1.5);
138                cr->line_to(d->Crossfade.out_end / 127.0 * (w - 3), h);
139    
140                if (pass == 0) {
141                    cr->set_source_rgba(0.5, 0.44, 1.0, sensitive ? 0.2 : 0.1);
142                    cr->fill();
143                } else {
144                    cr->set_line_width(3);
145                    cr->set_source_rgba(0.5, 0.44, 1.0, sensitive ? 1.0 : 0.3);
146                    cr->stroke();
147                }
148            }
149        }
150    }
151    
152    
153  DimRegionEdit::DimRegionEdit() :  DimRegionEdit::DimRegionEdit() :
154      eEG1PreAttack("Pre-attack", 0, 100, 2),      velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation),
155      eEG1Attack("Attack", 0, 60, 3),      release_curve(&gig::DimensionRegion::GetVelocityRelease),
156      eEG1Decay1("Decay 1", 0.005, 60, 3),      cutoff_curve(&gig::DimensionRegion::GetVelocityCutoff),
157      eEG1Decay2("Decay 2", 0, 60, 3),      eEG1PreAttack(_("Pre-attack"), 0, 100, 2),
158      eEG1InfiniteSustain("Infinite sustain"),      eEG1Attack(_("Attack"), 0, 60, 3),
159      eEG1Sustain("Sustain", 0, 100, 2),      eEG1Decay1(_("Decay 1"), 0.005, 60, 3),
160      eEG1Release("Release", 0, 60, 3),      eEG1Decay2(_("Decay 2"), 0, 60, 3),
161      eEG1Hold("Hold"),      eEG1InfiniteSustain(_("Infinite sustain")),
162      eEG1Controller("Controller"),      eEG1Sustain(_("Sustain"), 0, 100, 2),
163      eEG1ControllerInvert("Controller invert"),      eEG1Release(_("Release"), 0, 60, 3),
164      eEG1ControllerAttackInfluence("Controller attack influence", 0, 3),      eEG1Hold(_("Hold")),
165      eEG1ControllerDecayInfluence("Controller decay influence", 0, 3),      eEG1Controller(_("Controller")),
166      eEG1ControllerReleaseInfluence("Controller release influence", 0, 3),      eEG1ControllerInvert(_("Controller invert")),
167      eLFO1Frequency("Frequency", 0.1, 10, 2),      eEG1ControllerAttackInfluence(_("Controller attack influence"), 0, 3),
168      eLFO1InternalDepth("Internal depth", 0, 1200),      eEG1ControllerDecayInfluence(_("Controller decay influence"), 0, 3),
169      eLFO1ControlDepth("Control depth", 0, 1200),      eEG1ControllerReleaseInfluence(_("Controller release influence"), 0, 3),
170      eLFO1Controller("Controller"),      eLFO1Frequency(_("Frequency"), 0.1, 10, 2),
171      eLFO1FlipPhase("Flip phase"),      eLFO1InternalDepth(_("Internal depth"), 0, 1200),
172      eLFO1Sync("Sync"),      eLFO1ControlDepth(_("Control depth"), 0, 1200),
173      eEG2PreAttack("Pre-attack", 0, 100, 2),      eLFO1Controller(_("Controller")),
174      eEG2Attack("Attack", 0, 60, 3),      eLFO1FlipPhase(_("Flip phase")),
175      eEG2Decay1("Decay 1", 0.005, 60, 3),      eLFO1Sync(_("Sync")),
176      eEG2Decay2("Decay 2", 0, 60, 3),      eEG2PreAttack(_("Pre-attack"), 0, 100, 2),
177      eEG2InfiniteSustain("Infinite sustain"),      eEG2Attack(_("Attack"), 0, 60, 3),
178      eEG2Sustain("Sustain", 0, 100, 2),      eEG2Decay1(_("Decay 1"), 0.005, 60, 3),
179      eEG2Release("Release", 0, 60, 3),      eEG2Decay2(_("Decay 2"), 0, 60, 3),
180      eEG2Controller("Controller"),      eEG2InfiniteSustain(_("Infinite sustain")),
181      eEG2ControllerInvert("Controller invert"),      eEG2Sustain(_("Sustain"), 0, 100, 2),
182      eEG2ControllerAttackInfluence("Controller attack influence", 0, 3),      eEG2Release(_("Release"), 0, 60, 3),
183      eEG2ControllerDecayInfluence("Controller decay influence", 0, 3),      eEG2Controller(_("Controller")),
184      eEG2ControllerReleaseInfluence("Controller release influence", 0, 3),      eEG2ControllerInvert(_("Controller invert")),
185      eLFO2Frequency("Frequency", 0.1, 10, 2),      eEG2ControllerAttackInfluence(_("Controller attack influence"), 0, 3),
186      eLFO2InternalDepth("Internal depth", 0, 1200),      eEG2ControllerDecayInfluence(_("Controller decay influence"), 0, 3),
187      eLFO2ControlDepth("Control depth", 0, 1200),      eEG2ControllerReleaseInfluence(_("Controller release influence"), 0, 3),
188      eLFO2Controller("Controller"),      eLFO2Frequency(_("Frequency"), 0.1, 10, 2),
189      eLFO2FlipPhase("Flip phase"),      eLFO2InternalDepth(_("Internal depth"), 0, 1200),
190      eLFO2Sync("Sync"),      eLFO2ControlDepth(_("Control depth"), 0, 1200),
191      eEG3Attack("Attack", 0, 10, 3),      eLFO2Controller(_("Controller")),
192      eEG3Depth("Depth", -1200, 1200),      eLFO2FlipPhase(_("Flip phase")),
193      eLFO3Frequency("Frequency", 0.1, 10, 2),      eLFO2Sync(_("Sync")),
194      eLFO3InternalDepth("Internal depth", 0, 1200),      eEG3Attack(_("Attack"), 0, 10, 3),
195      eLFO3ControlDepth("Control depth", 0, 1200),      eEG3Depth(_("Depth"), -1200, 1200),
196      eLFO3Controller("Controller"),      eLFO3Frequency(_("Frequency"), 0.1, 10, 2),
197      eLFO3Sync("Sync"),      eLFO3InternalDepth(_("Internal depth"), 0, 1200),
198      eVCFEnabled("Enabled"),      eLFO3ControlDepth(_("Control depth"), 0, 1200),
199      eVCFType("Type"),      eLFO3Controller(_("Controller")),
200      eVCFCutoffController("Cutoff controller"),      eLFO3Sync(_("Sync")),
201      eVCFCutoffControllerInvert("Cutoff controller invert"),      eVCFEnabled(_("Enabled")),
202      eVCFCutoff("Cutoff"),      eVCFType(_("Type")),
203      eVCFVelocityCurve("Velocity curve"),      eVCFCutoffController(_("Cutoff controller")),
204      eVCFVelocityScale("Velocity scale"),      eVCFCutoffControllerInvert(_("Cutoff controller invert")),
205      eVCFVelocityDynamicRange("Velocity dynamic range", 0, 4),      eVCFCutoff(_("Cutoff")),
206      eVCFResonance("Resonance"),      eVCFVelocityCurve(_("Velocity curve")),
207      eVCFResonanceDynamic("Resonance dynamic"),      eVCFVelocityScale(_("Velocity scale")),
208      eVCFResonanceController("Resonance controller"),      eVCFVelocityDynamicRange(_("Velocity dynamic range"), 0, 4),
209      eVCFKeyboardTracking("Keyboard tracking"),      eVCFResonance(_("Resonance")),
210      eVCFKeyboardTrackingBreakpoint("Keyboard tracking breakpoint"),      eVCFResonanceDynamic(_("Resonance dynamic")),
211      eVelocityResponseCurve("Velocity response curve"),      eVCFResonanceController(_("Resonance controller")),
212      eVelocityResponseDepth("Velocity response depth", 0, 4),      eVCFKeyboardTracking(_("Keyboard tracking")),
213      eVelocityResponseCurveScaling("Velocity response curve scaling"),      eVCFKeyboardTrackingBreakpoint(_("Keyboard tracking breakpoint")),
214      eReleaseVelocityResponseCurve("Release velocity response curve"),      eVelocityResponseCurve(_("Velocity response curve")),
215      eReleaseVelocityResponseDepth("Release velocity response depth", 0, 4),      eVelocityResponseDepth(_("Velocity response depth"), 0, 4),
216      eReleaseTriggerDecay("Release trigger decay", 0, 8),      eVelocityResponseCurveScaling(_("Velocity response curve scaling")),
217      eCrossfade_in_start("Crossfade-in start"),      eReleaseVelocityResponseCurve(_("Release velocity response curve")),
218      eCrossfade_in_end("Crossfade-in end"),      eReleaseVelocityResponseDepth(_("Release velocity response depth"), 0, 4),
219      eCrossfade_out_start("Crossfade-out start"),      eReleaseTriggerDecay(_("Release trigger decay"), 0, 8),
220      eCrossfade_out_end("Crossfade-out end"),      eCrossfade_in_start(_("Crossfade-in start")),
221      ePitchTrack("Pitch track"),      eCrossfade_in_end(_("Crossfade-in end")),
222      eDimensionBypass("Dimension bypass"),      eCrossfade_out_start(_("Crossfade-out start")),
223      ePan("Pan", -64, 63),      eCrossfade_out_end(_("Crossfade-out end")),
224      eSelfMask("Self mask"),      ePitchTrack(_("Pitch track")),
225      eAttenuationController("Attenuation controller"),      eDimensionBypass(_("Dimension bypass")),
226      eInvertAttenuationController("Invert attenuation controller"),      ePan(_("Pan"), -64, 63),
227      eAttenuationControllerThreshold("Attenuation controller threshold"),      eSelfMask(_("Self mask")),
228      eChannelOffset("Channel offset", 0, 9),      eAttenuationController(_("Attenuation controller")),
229      eSustainDefeat("Sustain defeat"),      eInvertAttenuationController(_("Invert attenuation controller")),
230      eMSDecode("MS decode"),      eAttenuationControllerThreshold(_("Attenuation controller threshold")),
231      eSampleStartOffset("Sample start offset", 0, 2000),      eChannelOffset(_("Channel offset"), 0, 9),
232      eUnityNote("Unity note"),      eSustainDefeat(_("Sustain defeat")),
233      eFineTune("Fine tune", -49, 50),      eMSDecode(_("MS decode")),
234      eGain("Gain", -96, 0, 2, -655360),      eSampleStartOffset(_("Sample start offset"), 0, 2000),
235      eGainPlus6("Gain +6dB", eGain, 6 * -655360),      eUnityNote(_("Unity note")),
236      eSampleLoopEnabled("Enabled"),      eFineTune(_("Fine tune"), -49, 50),
237      eSampleLoopStart("Loop start positon"),      eGain(_("Gain"), -96, 0, 2, -655360),
238      eSampleLoopLength("Loop size"),      eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360),
239      eSampleLoopType("Loop type"),      eSampleLoopEnabled(_("Enabled")),
240      eSampleLoopInfinite("Infinite loop"),      eSampleLoopStart(_("Loop start positon")),
241      eSampleLoopPlayCount("Playback count", 1),      eSampleLoopLength(_("Loop size")),
242        eSampleLoopType(_("Loop type")),
243        eSampleLoopInfinite(_("Infinite loop")),
244        eSampleLoopPlayCount(_("Playback count"), 1),
245      update_model(0)      update_model(0)
246  {  {
247      connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack);      connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack);
# Line 265  DimRegionEdit::DimRegionEdit() : Line 397  DimRegionEdit::DimRegionEdit() :
397      firstRowInBlock = 0;      firstRowInBlock = 0;
398    
399      addHeader(_("Mandatory Settings"));      addHeader(_("Mandatory Settings"));
400      addString("Sample", lSample, wSample);      addString(_("Sample"), lSample, wSample);
401      //TODO: the following would break drag&drop:   wSample->property_editable().set_value(false);  or this:    wSample->set_editable(false);      //TODO: the following would break drag&drop:   wSample->property_editable().set_value(false);  or this:    wSample->set_editable(false);
402    #ifdef OLD_TOOLTIPS
403      tooltips.set_tip(*wSample, _("Drop a sample here"));      tooltips.set_tip(*wSample, _("Drop a sample here"));
404    #else
405        wSample->set_tooltip_text(_("Drop a sample here"));
406    #endif
407      addProp(eUnityNote);      addProp(eUnityNote);
408      addHeader(_("Optional Settings"));      addHeader(_("Optional Settings"));
409      addProp(eSampleStartOffset);      addProp(eSampleStartOffset);
410      addProp(eChannelOffset);      addProp(eChannelOffset);
411      addHeader("Loops");      addHeader(_("Loops"));
412      addProp(eSampleLoopEnabled);      addProp(eSampleLoopEnabled);
413      addProp(eSampleLoopStart);      addProp(eSampleLoopStart);
414      addProp(eSampleLoopLength);      addProp(eSampleLoopLength);
415      {      {
416          const char* choices[] = { "normal", "bidirectional", "backward", 0 };          const char* choices[] = { _("normal"), _("bidirectional"), _("backward"), 0 };
417          static const uint32_t values[] = {          static const uint32_t values[] = {
418              gig::loop_type_normal,              gig::loop_type_normal,
419              gig::loop_type_bidirectional,              gig::loop_type_bidirectional,
# Line 317  DimRegionEdit::DimRegionEdit() : Line 453  DimRegionEdit::DimRegionEdit() :
453      addProp(eLFO1InternalDepth);      addProp(eLFO1InternalDepth);
454      addProp(eLFO1ControlDepth);      addProp(eLFO1ControlDepth);
455      {      {
456          const char* choices[] = { "internal", "modwheel", "breath",          const char* choices[] = { _("internal"), _("modwheel"), _("breath"),
457                                    "internal+modwheel", "internal+breath", 0 };                                    _("internal+modwheel"), _("internal+breath"), 0 };
458          static const gig::lfo1_ctrl_t values[] = {          static const gig::lfo1_ctrl_t values[] = {
459              gig::lfo1_ctrl_internal,              gig::lfo1_ctrl_internal,
460              gig::lfo1_ctrl_modwheel,              gig::lfo1_ctrl_modwheel,
# Line 331  DimRegionEdit::DimRegionEdit() : Line 467  DimRegionEdit::DimRegionEdit() :
467      addProp(eLFO1Controller);      addProp(eLFO1Controller);
468      addProp(eLFO1FlipPhase);      addProp(eLFO1FlipPhase);
469      addProp(eLFO1Sync);      addProp(eLFO1Sync);
470      addHeader("Crossfade");      addHeader(_("Crossfade"));
471      addProp(eAttenuationController);      addProp(eAttenuationController);
472      addProp(eInvertAttenuationController);      addProp(eInvertAttenuationController);
473      addProp(eAttenuationControllerThreshold);      addProp(eAttenuationControllerThreshold);
# Line 340  DimRegionEdit::DimRegionEdit() : Line 476  DimRegionEdit::DimRegionEdit() :
476      addProp(eCrossfade_out_start);      addProp(eCrossfade_out_start);
477      addProp(eCrossfade_out_end);      addProp(eCrossfade_out_end);
478    
479        Gtk::Frame* frame = new Gtk::Frame;
480        frame->add(crossfade_curve);
481        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
482                              Gtk::SHRINK, Gtk::SHRINK);
483        rowno++;
484    
485        eCrossfade_in_start.signal_value_changed().connect(
486            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
487        eCrossfade_in_end.signal_value_changed().connect(
488            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
489        eCrossfade_out_start.signal_value_changed().connect(
490            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
491        eCrossfade_out_end.signal_value_changed().connect(
492            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
493    
494      nextPage();      nextPage();
495    
496      addHeader(_("General Filter Settings"));      addHeader(_("General Filter Settings"));
497      addProp(eVCFEnabled);      addProp(eVCFEnabled);
498      {      {
499          const char* choices[] = { "lowpass", "lowpassturbo", "bandpass",          const char* choices[] = { _("lowpass"), _("lowpassturbo"), _("bandpass"),
500                                    "highpass", "bandreject", 0 };                                    _("highpass"), _("bandreject"), 0 };
501          static const gig::vcf_type_t values[] = {          static const gig::vcf_type_t values[] = {
502              gig::vcf_type_lowpass,              gig::vcf_type_lowpass,
503              gig::vcf_type_lowpassturbo,              gig::vcf_type_lowpassturbo,
# Line 358  DimRegionEdit::DimRegionEdit() : Line 509  DimRegionEdit::DimRegionEdit() :
509      }      }
510      addProp(eVCFType);      addProp(eVCFType);
511      {      {
512          const char* choices[] = { "none", "none2", "modwheel", "effect1", "effect2",          const char* choices[] = { _("none"), _("none2"), _("modwheel"), _("effect1"), _("effect2"),
513                                    "breath", "foot", "sustainpedal", "softpedal",                                    _("breath"), _("foot"), _("sustainpedal"), _("softpedal"),
514                                    "genpurpose7", "genpurpose8", "aftertouch", 0 };                                    _("genpurpose7"), _("genpurpose8"), _("aftertouch"), 0 };
515          static const gig::vcf_cutoff_ctrl_t values[] = {          static const gig::vcf_cutoff_ctrl_t values[] = {
516              gig::vcf_cutoff_ctrl_none,              gig::vcf_cutoff_ctrl_none,
517              gig::vcf_cutoff_ctrl_none2,              gig::vcf_cutoff_ctrl_none2,
# Line 380  DimRegionEdit::DimRegionEdit() : Line 531  DimRegionEdit::DimRegionEdit() :
531      addProp(eVCFCutoffController);      addProp(eVCFCutoffController);
532      addProp(eVCFCutoffControllerInvert);      addProp(eVCFCutoffControllerInvert);
533      addProp(eVCFCutoff);      addProp(eVCFCutoff);
534      const char* curve_type_texts[] = { "nonlinear", "linear", "special", 0 };      const char* curve_type_texts[] = { _("nonlinear"), _("linear"), _("special"), 0 };
535      static const gig::curve_type_t curve_type_values[] = {      static const gig::curve_type_t curve_type_values[] = {
536          gig::curve_type_nonlinear,          gig::curve_type_nonlinear,
537          gig::curve_type_linear,          gig::curve_type_linear,
# Line 390  DimRegionEdit::DimRegionEdit() : Line 541  DimRegionEdit::DimRegionEdit() :
541      addProp(eVCFVelocityCurve);      addProp(eVCFVelocityCurve);
542      addProp(eVCFVelocityScale);      addProp(eVCFVelocityScale);
543      addProp(eVCFVelocityDynamicRange);      addProp(eVCFVelocityDynamicRange);
544    
545        eVCFCutoffController.signal_value_changed().connect(
546            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
547        eVCFVelocityCurve.signal_value_changed().connect(
548            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
549        eVCFVelocityScale.signal_value_changed().connect(
550            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
551        eVCFVelocityDynamicRange.signal_value_changed().connect(
552            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
553    
554        frame = new Gtk::Frame;
555        frame->add(cutoff_curve);
556        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
557                              Gtk::SHRINK, Gtk::SHRINK);
558        rowno++;
559    
560      addProp(eVCFResonance);      addProp(eVCFResonance);
561      addProp(eVCFResonanceDynamic);      addProp(eVCFResonanceDynamic);
562      {      {
563          const char* choices[] = { "none", "genpurpose3", "genpurpose4",          const char* choices[] = { _("none"), _("genpurpose3"), _("genpurpose4"),
564                                    "genpurpose5", "genpurpose6", 0 };                                    _("genpurpose5"), _("genpurpose6"), 0 };
565          static const gig::vcf_res_ctrl_t values[] = {          static const gig::vcf_res_ctrl_t values[] = {
566              gig::vcf_res_ctrl_none,              gig::vcf_res_ctrl_none,
567              gig::vcf_res_ctrl_genpurpose3,              gig::vcf_res_ctrl_genpurpose3,
# Line 428  DimRegionEdit::DimRegionEdit() : Line 595  DimRegionEdit::DimRegionEdit() :
595      addProp(eLFO2InternalDepth);      addProp(eLFO2InternalDepth);
596      addProp(eLFO2ControlDepth);      addProp(eLFO2ControlDepth);
597      {      {
598          const char* choices[] = { "internal", "modwheel", "foot",          const char* choices[] = { _("internal"), _("modwheel"), _("foot"),
599                                    "internal+modwheel", "internal+foot", 0 };                                    _("internal+modwheel"), _("internal+foot"), 0 };
600          static const gig::lfo2_ctrl_t values[] = {          static const gig::lfo2_ctrl_t values[] = {
601              gig::lfo2_ctrl_internal,              gig::lfo2_ctrl_internal,
602              gig::lfo2_ctrl_modwheel,              gig::lfo2_ctrl_modwheel,
# Line 456  DimRegionEdit::DimRegionEdit() : Line 623  DimRegionEdit::DimRegionEdit() :
623      addProp(eLFO3InternalDepth);      addProp(eLFO3InternalDepth);
624      addProp(eLFO3ControlDepth);      addProp(eLFO3ControlDepth);
625      {      {
626          const char* choices[] = { "internal", "modwheel", "aftertouch",          const char* choices[] = { _("internal"), _("modwheel"), _("aftertouch"),
627                                    "internal+modwheel", "internal+aftertouch", 0 };                                    _("internal+modwheel"), _("internal+aftertouch"), 0 };
628          static const gig::lfo3_ctrl_t values[] = {          static const gig::lfo3_ctrl_t values[] = {
629              gig::lfo3_ctrl_internal,              gig::lfo3_ctrl_internal,
630              gig::lfo3_ctrl_modwheel,              gig::lfo3_ctrl_modwheel,
# Line 472  DimRegionEdit::DimRegionEdit() : Line 639  DimRegionEdit::DimRegionEdit() :
639    
640      nextPage();      nextPage();
641    
642        addHeader(_("Velocity Reponse"));
643      eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values);      eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values);
644      addProp(eVelocityResponseCurve);      addProp(eVelocityResponseCurve);
645      addProp(eVelocityResponseDepth);      addProp(eVelocityResponseDepth);
646      addProp(eVelocityResponseCurveScaling);      addProp(eVelocityResponseCurveScaling);
647    
648        eVelocityResponseCurve.signal_value_changed().connect(
649            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
650        eVelocityResponseDepth.signal_value_changed().connect(
651            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
652        eVelocityResponseCurveScaling.signal_value_changed().connect(
653            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
654    
655        frame = new Gtk::Frame;
656        frame->add(velocity_curve);
657        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
658                              Gtk::SHRINK, Gtk::SHRINK);
659        rowno++;
660    
661        addHeader(_("Release Velocity Reponse"));
662      eReleaseVelocityResponseCurve.set_choices(curve_type_texts,      eReleaseVelocityResponseCurve.set_choices(curve_type_texts,
663                                                curve_type_values);                                                curve_type_values);
664      addProp(eReleaseVelocityResponseCurve);      addProp(eReleaseVelocityResponseCurve);
665      addProp(eReleaseVelocityResponseDepth);      addProp(eReleaseVelocityResponseDepth);
666    
667        eReleaseVelocityResponseCurve.signal_value_changed().connect(
668            sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));
669        eReleaseVelocityResponseDepth.signal_value_changed().connect(
670            sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));
671        frame = new Gtk::Frame;
672        frame->add(release_curve);
673        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
674                              Gtk::SHRINK, Gtk::SHRINK);
675        rowno++;
676    
677      addProp(eReleaseTriggerDecay);      addProp(eReleaseTriggerDecay);
678      {      {
679          const char* choices[] = { "none", "effect4depth", "effect5depth", 0 };          const char* choices[] = { _("none"), _("effect4depth"), _("effect5depth"), 0 };
680          static const gig::dim_bypass_ctrl_t values[] = {          static const gig::dim_bypass_ctrl_t values[] = {
681              gig::dim_bypass_ctrl_none,              gig::dim_bypass_ctrl_none,
682              gig::dim_bypass_ctrl_94,              gig::dim_bypass_ctrl_94,
# Line 539  DimRegionEdit::DimRegionEdit() : Line 733  DimRegionEdit::DimRegionEdit() :
733      eSampleLoopInfinite.signal_value_changed().connect(      eSampleLoopInfinite.signal_value_changed().connect(
734          sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled));          sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled));
735    
736      append_page(*table[0], "Sample");      append_page(*table[0], _("Sample"));
737      append_page(*table[1], "Amplitude (1)");      append_page(*table[1], _("Amplitude (1)"));
738      append_page(*table[2], "Amplitude (2)");      append_page(*table[2], _("Amplitude (2)"));
739      append_page(*table[3], "Filter (1)");      append_page(*table[3], _("Filter (1)"));
740      append_page(*table[4], "Filter (2)");      append_page(*table[4], _("Filter (2)"));
741      append_page(*table[5], "Pitch");      append_page(*table[5], _("Pitch"));
742      append_page(*table[6], "Misc");      append_page(*table[6], _("Misc"));
743  }  }
744    
745  DimRegionEdit::~DimRegionEdit()  DimRegionEdit::~DimRegionEdit()
# Line 556  void DimRegionEdit::addString(const char Line 750  void DimRegionEdit::addString(const char
750                                Gtk::Entry*& widget)                                Gtk::Entry*& widget)
751  {  {
752      label = new Gtk::Label(Glib::ustring(labelText) + ":");      label = new Gtk::Label(Glib::ustring(labelText) + ":");
753      label->set_alignment(Gtk::ALIGN_LEFT);      label->set_alignment(Gtk::ALIGN_START);
754    
755      table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,      table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,
756                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
# Line 582  Gtk::Label* DimRegionEdit::addHeader(con Line 776  Gtk::Label* DimRegionEdit::addHeader(con
776      str += "</b>";      str += "</b>";
777      Gtk::Label* label = new Gtk::Label(str);      Gtk::Label* label = new Gtk::Label(str);
778      label->set_use_markup();      label->set_use_markup();
779      label->set_alignment(Gtk::ALIGN_LEFT);      label->set_alignment(Gtk::ALIGN_START);
780      table[pageno]->attach(*label, 0, 3, rowno, rowno + 1,      table[pageno]->attach(*label, 0, 3, rowno, rowno + 1,
781                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
782      rowno++;      rowno++;
# Line 630  void DimRegionEdit::addProp(LabelWidget& Line 824  void DimRegionEdit::addProp(LabelWidget&
824  void DimRegionEdit::set_dim_region(gig::DimensionRegion* d)  void DimRegionEdit::set_dim_region(gig::DimensionRegion* d)
825  {  {
826      dimregion = d;      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);      set_sensitive(d);
833      if (!d) return;      if (!d) return;
# Line 730  void DimRegionEdit::set_dim_region(gig:: Line 928  void DimRegionEdit::set_dim_region(gig::
928          d->pSample ? d->pSample->LoopPlayCount : 0);          d->pSample ? d->pSample->LoopPlayCount : 0);
929      update_model--;      update_model--;
930    
931      wSample->set_text(d->pSample ? d->pSample->pInfo->Name.c_str() : "NULL");      wSample->set_text(d->pSample ? d->pSample->pInfo->Name.c_str() : _("NULL"));
932    
933      update_loop_elements();      update_loop_elements();
934      VCFEnabled_toggled();      VCFEnabled_toggled();
# Line 745  void DimRegionEdit::VCFEnabled_toggled() Line 943  void DimRegionEdit::VCFEnabled_toggled()
943      eVCFVelocityCurve.set_sensitive(sensitive);      eVCFVelocityCurve.set_sensitive(sensitive);
944      eVCFVelocityScale.set_sensitive(sensitive);      eVCFVelocityScale.set_sensitive(sensitive);
945      eVCFVelocityDynamicRange.set_sensitive(sensitive);      eVCFVelocityDynamicRange.set_sensitive(sensitive);
946        cutoff_curve.set_sensitive(sensitive);
947      eVCFResonance.set_sensitive(sensitive);      eVCFResonance.set_sensitive(sensitive);
948      eVCFResonanceController.set_sensitive(sensitive);      eVCFResonanceController.set_sensitive(sensitive);
949      eVCFKeyboardTracking.set_sensitive(sensitive);      eVCFKeyboardTracking.set_sensitive(sensitive);
# Line 793  void DimRegionEdit::VCFCutoffController_ Line 992  void DimRegionEdit::VCFCutoffController_
992      eVCFCutoffControllerInvert.set_sensitive(hasController);      eVCFCutoffControllerInvert.set_sensitive(hasController);
993      eVCFCutoff.set_sensitive(!hasController);      eVCFCutoff.set_sensitive(!hasController);
994      eVCFResonanceDynamic.set_sensitive(!hasController);      eVCFResonanceDynamic.set_sensitive(!hasController);
995      eVCFVelocityScale.label.set_text(hasController ? "Minimum cutoff:" :      eVCFVelocityScale.label.set_text(hasController ? _("Minimum cutoff:") :
996                                       "Velocity scale:");                                       _("Velocity scale:"));
997  }  }
998    
999  void DimRegionEdit::VCFResonanceController_changed()  void DimRegionEdit::VCFResonanceController_changed()
# Line 837  void DimRegionEdit::AttenuationControlle Line 1036  void DimRegionEdit::AttenuationControlle
1036      eCrossfade_in_end.set_sensitive(hasController);      eCrossfade_in_end.set_sensitive(hasController);
1037      eCrossfade_out_start.set_sensitive(hasController);      eCrossfade_out_start.set_sensitive(hasController);
1038      eCrossfade_out_end.set_sensitive(hasController);      eCrossfade_out_end.set_sensitive(hasController);
1039        crossfade_curve.set_sensitive(hasController);
1040  }  }
1041    
1042  void DimRegionEdit::LFO1Controller_changed()  void DimRegionEdit::LFO1Controller_changed()
# Line 958  bool DimRegionEdit::set_sample(gig::Samp Line 1158  bool DimRegionEdit::set_sample(gig::Samp
1158          // currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received()          // currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received()
1159          //dimreg_to_be_changed_signal.emit(dimregion);          //dimreg_to_be_changed_signal.emit(dimregion);
1160    
1161            // make sure stereo samples always are the same in both
1162            // dimregs in the samplechannel dimension
1163            int nbDimregs = 1;
1164            gig::DimensionRegion* d[2] = { dimregion, 0 };
1165            if (sample->Channels == 2) {
1166                gig::Region* region = dimregion->GetParent();
1167    
1168                int bitcount = 0;
1169                int stereo_bit = 0;
1170                for (int dim = 0 ; dim < region->Dimensions ; dim++) {
1171                    if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) {
1172                        stereo_bit = 1 << bitcount;
1173                        break;
1174                    }
1175                    bitcount += region->pDimensionDefinitions[dim].bits;
1176                }
1177    
1178                if (stereo_bit) {
1179                    int dimregno;
1180                    for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) {
1181                        if (region->pDimensionRegions[dimregno] == dimregion) {
1182                            break;
1183                        }
1184                    }
1185                    d[0] = region->pDimensionRegions[dimregno & ~stereo_bit];
1186                    d[1] = region->pDimensionRegions[dimregno | stereo_bit];
1187                    nbDimregs = 2;
1188                }
1189            }
1190    
1191          gig::Sample* oldref = dimregion->pSample;          gig::Sample* oldref = dimregion->pSample;
         dimregion->pSample = sample;  
1192    
1193          // copy sample information from Sample to DimensionRegion          for (int i = 0 ; i < nbDimregs ; i++) {
1194                d[i]->pSample = sample;
1195    
1196          dimregion->UnityNote = sample->MIDIUnityNote;              // copy sample information from Sample to DimensionRegion
         dimregion->FineTune = sample->FineTune;  
1197    
1198          int loops = sample->Loops ? 1 : 0;              d[i]->UnityNote = sample->MIDIUnityNote;
1199          while (dimregion->SampleLoops > loops) {              d[i]->FineTune = sample->FineTune;
1200              dimregion->DeleteSampleLoop(&dimregion->pSampleLoops[0]);  
1201          }              int loops = sample->Loops ? 1 : 0;
1202          while (dimregion->SampleLoops < sample->Loops) {              while (d[i]->SampleLoops > loops) {
1203              DLS::sample_loop_t loop;                  d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]);
1204              dimregion->AddSampleLoop(&loop);              }
1205          }              while (d[i]->SampleLoops < sample->Loops) {
1206          if (loops) {                  DLS::sample_loop_t loop;
1207              dimregion->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t);                  d[i]->AddSampleLoop(&loop);
1208              dimregion->pSampleLoops[0].LoopType = sample->LoopType;              }
1209              dimregion->pSampleLoops[0].LoopStart = sample->LoopStart;              if (loops) {
1210              dimregion->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1;                  d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t);
1211                    d[i]->pSampleLoops[0].LoopType = sample->LoopType;
1212                    d[i]->pSampleLoops[0].LoopStart = sample->LoopStart;
1213                    d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1;
1214                }
1215          }          }
1216    
1217          // update ui          // update ui

Legend:
Removed from v.1623  
changed lines
  Added in v.2430

  ViewVC Help
Powered by ViewVC