/[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 1460 by persson, Sat Oct 27 12:28:33 2007 UTC revision 2397 by persson, Wed Jan 9 20:59:29 2013 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006, 2007 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, 0.2);
59                    cr->fill();
60                } else {
61                    cr->set_line_width(3);
62                    cr->set_source_rgb(0.5, 0.44, 1.0);
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 && dimreg->Crossfade.out_end) {
86            int w = get_width();
87            int h = get_height();
88            
89            cr->translate(1.5, 0);
90            for (int pass = 0 ; pass < 2 ; pass++) {
91                cr->move_to(dimreg->Crossfade.in_start / 127.0 * (w - 3), h);
92                cr->line_to(dimreg->Crossfade.in_end / 127.0 * (w - 3), 1.5);
93                cr->line_to(dimreg->Crossfade.out_start / 127.0 * (w - 3), 1.5);
94                cr->line_to(dimreg->Crossfade.out_end / 127.0 * (w - 3), h);
95    
96                if (pass == 0) {
97                    cr->set_source_rgba(0.5, 0.44, 1.0, 0.2);
98                    cr->fill();
99                } else {
100                    cr->set_line_width(3);
101                    cr->set_source_rgb(0.5, 0.44, 1.0);
102                    cr->stroke();
103                }
104            }
105        }
106        return true;
107    }
108    
109    
110  DimRegionEdit::DimRegionEdit() :  DimRegionEdit::DimRegionEdit() :
111      eEG1PreAttack("Pre-attack", 0, 100, 2),      velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation),
112      eEG1Attack("Attack", 0, 60, 3),      release_curve(&gig::DimensionRegion::GetVelocityRelease),
113      eEG1Decay1("Decay 1", 0.005, 60, 3),      cutoff_curve(&gig::DimensionRegion::GetVelocityCutoff),
114      eEG1Decay2("Decay 2", 0, 60, 3),      eEG1PreAttack(_("Pre-attack"), 0, 100, 2),
115      eEG1InfiniteSustain("Infinite sustain"),      eEG1Attack(_("Attack"), 0, 60, 3),
116      eEG1Sustain("Sustain", 0, 100, 2),      eEG1Decay1(_("Decay 1"), 0.005, 60, 3),
117      eEG1Release("Release", 0, 60, 3),      eEG1Decay2(_("Decay 2"), 0, 60, 3),
118      eEG1Hold("Hold"),      eEG1InfiniteSustain(_("Infinite sustain")),
119      eEG1Controller("Controller"),      eEG1Sustain(_("Sustain"), 0, 100, 2),
120      eEG1ControllerInvert("Controller invert"),      eEG1Release(_("Release"), 0, 60, 3),
121      eEG1ControllerAttackInfluence("Controller attack influence", 0, 3),      eEG1Hold(_("Hold")),
122      eEG1ControllerDecayInfluence("Controller decay influence", 0, 3),      eEG1Controller(_("Controller")),
123      eEG1ControllerReleaseInfluence("Controller release influence", 0, 3),      eEG1ControllerInvert(_("Controller invert")),
124      eLFO1Frequency("Frequency", 0.1, 10, 2),      eEG1ControllerAttackInfluence(_("Controller attack influence"), 0, 3),
125      eLFO1InternalDepth("Internal depth", 0, 1200),      eEG1ControllerDecayInfluence(_("Controller decay influence"), 0, 3),
126      eLFO1ControlDepth("Control depth", 0, 1200),      eEG1ControllerReleaseInfluence(_("Controller release influence"), 0, 3),
127      eLFO1Controller("Controller"),      eLFO1Frequency(_("Frequency"), 0.1, 10, 2),
128      eLFO1FlipPhase("Flip phase"),      eLFO1InternalDepth(_("Internal depth"), 0, 1200),
129      eLFO1Sync("Sync"),      eLFO1ControlDepth(_("Control depth"), 0, 1200),
130      eEG2PreAttack("Pre-attack", 0, 100, 2),      eLFO1Controller(_("Controller")),
131      eEG2Attack("Attack", 0, 60, 3),      eLFO1FlipPhase(_("Flip phase")),
132      eEG2Decay1("Decay 1", 0.005, 60, 3),      eLFO1Sync(_("Sync")),
133      eEG2Decay2("Decay 2", 0, 60, 3),      eEG2PreAttack(_("Pre-attack"), 0, 100, 2),
134      eEG2InfiniteSustain("Infinite sustain"),      eEG2Attack(_("Attack"), 0, 60, 3),
135      eEG2Sustain("Sustain", 0, 100, 2),      eEG2Decay1(_("Decay 1"), 0.005, 60, 3),
136      eEG2Release("Release", 0, 60, 3),      eEG2Decay2(_("Decay 2"), 0, 60, 3),
137      eEG2Controller("Controller"),      eEG2InfiniteSustain(_("Infinite sustain")),
138      eEG2ControllerInvert("Controller invert"),      eEG2Sustain(_("Sustain"), 0, 100, 2),
139      eEG2ControllerAttackInfluence("Controller attack influence", 0, 3),      eEG2Release(_("Release"), 0, 60, 3),
140      eEG2ControllerDecayInfluence("Controller decay influence", 0, 3),      eEG2Controller(_("Controller")),
141      eEG2ControllerReleaseInfluence("Controller release influence", 0, 3),      eEG2ControllerInvert(_("Controller invert")),
142      eLFO2Frequency("Frequency", 0.1, 10, 2),      eEG2ControllerAttackInfluence(_("Controller attack influence"), 0, 3),
143      eLFO2InternalDepth("Internal depth", 0, 1200),      eEG2ControllerDecayInfluence(_("Controller decay influence"), 0, 3),
144      eLFO2ControlDepth("Control depth", 0, 1200),      eEG2ControllerReleaseInfluence(_("Controller release influence"), 0, 3),
145      eLFO2Controller("Controller"),      eLFO2Frequency(_("Frequency"), 0.1, 10, 2),
146      eLFO2FlipPhase("Flip phase"),      eLFO2InternalDepth(_("Internal depth"), 0, 1200),
147      eLFO2Sync("Sync"),      eLFO2ControlDepth(_("Control depth"), 0, 1200),
148      eEG3Attack("Attack", 0, 10, 3),      eLFO2Controller(_("Controller")),
149      eEG3Depth("Depth", -1200, 1200),      eLFO2FlipPhase(_("Flip phase")),
150      eLFO3Frequency("Frequency", 0.1, 10, 2),      eLFO2Sync(_("Sync")),
151      eLFO3InternalDepth("Internal depth", 0, 1200),      eEG3Attack(_("Attack"), 0, 10, 3),
152      eLFO3ControlDepth("Control depth", 0, 1200),      eEG3Depth(_("Depth"), -1200, 1200),
153      eLFO3Controller("Controller"),      eLFO3Frequency(_("Frequency"), 0.1, 10, 2),
154      eLFO3Sync("Sync"),      eLFO3InternalDepth(_("Internal depth"), 0, 1200),
155      eVCFEnabled("Enabled"),      eLFO3ControlDepth(_("Control depth"), 0, 1200),
156      eVCFType("Type"),      eLFO3Controller(_("Controller")),
157      eVCFCutoffController("Cutoff controller"),      eLFO3Sync(_("Sync")),
158      eVCFCutoffControllerInvert("Cutoff controller invert"),      eVCFEnabled(_("Enabled")),
159      eVCFCutoff("Cutoff"),      eVCFType(_("Type")),
160      eVCFVelocityCurve("Velocity curve"),      eVCFCutoffController(_("Cutoff controller")),
161      eVCFVelocityScale("Velocity scale"),      eVCFCutoffControllerInvert(_("Cutoff controller invert")),
162      eVCFVelocityDynamicRange("Velocity dynamic range", 0, 4),      eVCFCutoff(_("Cutoff")),
163      eVCFResonance("Resonance"),      eVCFVelocityCurve(_("Velocity curve")),
164      eVCFResonanceDynamic("Resonance dynamic"),      eVCFVelocityScale(_("Velocity scale")),
165      eVCFResonanceController("Resonance controller"),      eVCFVelocityDynamicRange(_("Velocity dynamic range"), 0, 4),
166      eVCFKeyboardTracking("Keyboard tracking"),      eVCFResonance(_("Resonance")),
167      eVCFKeyboardTrackingBreakpoint("Keyboard tracking breakpoint"),      eVCFResonanceDynamic(_("Resonance dynamic")),
168      eVelocityResponseCurve("Velocity response curve"),      eVCFResonanceController(_("Resonance controller")),
169      eVelocityResponseDepth("Velocity response depth", 0, 4),      eVCFKeyboardTracking(_("Keyboard tracking")),
170      eVelocityResponseCurveScaling("Velocity response curve scaling"),      eVCFKeyboardTrackingBreakpoint(_("Keyboard tracking breakpoint")),
171      eReleaseVelocityResponseCurve("Release velocity response curve"),      eVelocityResponseCurve(_("Velocity response curve")),
172      eReleaseVelocityResponseDepth("Release velocity response depth", 0, 4),      eVelocityResponseDepth(_("Velocity response depth"), 0, 4),
173      eReleaseTriggerDecay("Release trigger decay", 0, 8),      eVelocityResponseCurveScaling(_("Velocity response curve scaling")),
174      eCrossfade_in_start("Crossfade-in start"),      eReleaseVelocityResponseCurve(_("Release velocity response curve")),
175      eCrossfade_in_end("Crossfade-in end"),      eReleaseVelocityResponseDepth(_("Release velocity response depth"), 0, 4),
176      eCrossfade_out_start("Crossfade-out start"),      eReleaseTriggerDecay(_("Release trigger decay"), 0, 8),
177      eCrossfade_out_end("Crossfade-out end"),      eCrossfade_in_start(_("Crossfade-in start")),
178      ePitchTrack("Pitch track"),      eCrossfade_in_end(_("Crossfade-in end")),
179      eDimensionBypass("Dimension bypass"),      eCrossfade_out_start(_("Crossfade-out start")),
180      ePan("Pan", -64, 63),      eCrossfade_out_end(_("Crossfade-out end")),
181      eSelfMask("Self mask"),      ePitchTrack(_("Pitch track")),
182      eAttenuationController("Attenuation controller"),      eDimensionBypass(_("Dimension bypass")),
183      eInvertAttenuationController("Invert attenuation controller"),      ePan(_("Pan"), -64, 63),
184      eAttenuationControllerThreshold("Attenuation controller threshold"),      eSelfMask(_("Self mask")),
185      eChannelOffset("Channel offset", 0, 9),      eAttenuationController(_("Attenuation controller")),
186      eSustainDefeat("Sustain defeat"),      eInvertAttenuationController(_("Invert attenuation controller")),
187      eMSDecode("MS decode"),      eAttenuationControllerThreshold(_("Attenuation controller threshold")),
188      eSampleStartOffset("Sample start offset", 0, 2000),      eChannelOffset(_("Channel offset"), 0, 9),
189      eUnityNote("Unity note"),      eSustainDefeat(_("Sustain defeat")),
190      eFineTune("Fine tune", -49, 50),      eMSDecode(_("MS decode")),
191      eGain("Gain", -96, 0, 2, -655360),      eSampleStartOffset(_("Sample start offset"), 0, 2000),
192      eGainPlus6("Gain +6dB", eGain, 6 * -655360),      eUnityNote(_("Unity note")),
193      eSampleLoopEnabled("Enabled"),      eFineTune(_("Fine tune"), -49, 50),
194      eSampleLoopStart("Loop start positon"),      eGain(_("Gain"), -96, 0, 2, -655360),
195      eSampleLoopLength("Loop size"),      eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360),
196      eSampleLoopType("Loop type"),      eSampleLoopEnabled(_("Enabled")),
197      eSampleLoopInfinite("Infinite loop"),      eSampleLoopStart(_("Loop start positon")),
198      eSampleLoopPlayCount("Playback count", 1),      eSampleLoopLength(_("Loop size")),
199        eSampleLoopType(_("Loop type")),
200        eSampleLoopInfinite(_("Infinite loop")),
201        eSampleLoopPlayCount(_("Playback count"), 1),
202      update_model(0)      update_model(0)
203  {  {
204      connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack);      connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack);
# Line 265  DimRegionEdit::DimRegionEdit() : Line 354  DimRegionEdit::DimRegionEdit() :
354      firstRowInBlock = 0;      firstRowInBlock = 0;
355    
356      addHeader(_("Mandatory Settings"));      addHeader(_("Mandatory Settings"));
357      addString("Sample", lSample, wSample);      addString(_("Sample"), lSample, wSample);
358      //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);
359    #ifdef OLD_TOOLTIPS
360      tooltips.set_tip(*wSample, _("Drop a sample here"));      tooltips.set_tip(*wSample, _("Drop a sample here"));
361    #else
362        wSample->set_tooltip_text(_("Drop a sample here"));
363    #endif
364      addProp(eUnityNote);      addProp(eUnityNote);
365      addHeader(_("Optional Settings"));      addHeader(_("Optional Settings"));
366      addProp(eSampleStartOffset);      addProp(eSampleStartOffset);
367      addProp(eChannelOffset);      addProp(eChannelOffset);
368      addHeader("Loops");      addHeader(_("Loops"));
369      addProp(eSampleLoopEnabled);      addProp(eSampleLoopEnabled);
370      addProp(eSampleLoopStart);      addProp(eSampleLoopStart);
371      addProp(eSampleLoopLength);      addProp(eSampleLoopLength);
372      {      {
373          const char* choices[] = { "normal", "bidirectional", "backward", 0 };          const char* choices[] = { _("normal"), _("bidirectional"), _("backward"), 0 };
374          static const uint32_t values[] = {          static const uint32_t values[] = {
375              gig::loop_type_normal,              gig::loop_type_normal,
376              gig::loop_type_bidirectional,              gig::loop_type_bidirectional,
# Line 317  DimRegionEdit::DimRegionEdit() : Line 410  DimRegionEdit::DimRegionEdit() :
410      addProp(eLFO1InternalDepth);      addProp(eLFO1InternalDepth);
411      addProp(eLFO1ControlDepth);      addProp(eLFO1ControlDepth);
412      {      {
413          const char* choices[] = { "internal", "modwheel", "breath",          const char* choices[] = { _("internal"), _("modwheel"), _("breath"),
414                                    "internal+modwheel", "internal+breath", 0 };                                    _("internal+modwheel"), _("internal+breath"), 0 };
415          static const gig::lfo1_ctrl_t values[] = {          static const gig::lfo1_ctrl_t values[] = {
416              gig::lfo1_ctrl_internal,              gig::lfo1_ctrl_internal,
417              gig::lfo1_ctrl_modwheel,              gig::lfo1_ctrl_modwheel,
# Line 331  DimRegionEdit::DimRegionEdit() : Line 424  DimRegionEdit::DimRegionEdit() :
424      addProp(eLFO1Controller);      addProp(eLFO1Controller);
425      addProp(eLFO1FlipPhase);      addProp(eLFO1FlipPhase);
426      addProp(eLFO1Sync);      addProp(eLFO1Sync);
427      addHeader("Crossfade");      addHeader(_("Crossfade"));
428      addProp(eAttenuationController);      addProp(eAttenuationController);
429      addProp(eInvertAttenuationController);      addProp(eInvertAttenuationController);
430      addProp(eAttenuationControllerThreshold);      addProp(eAttenuationControllerThreshold);
# Line 340  DimRegionEdit::DimRegionEdit() : Line 433  DimRegionEdit::DimRegionEdit() :
433      addProp(eCrossfade_out_start);      addProp(eCrossfade_out_start);
434      addProp(eCrossfade_out_end);      addProp(eCrossfade_out_end);
435    
436        Gtk::Frame* frame = new Gtk::Frame;
437        frame->add(crossfade_curve);
438        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
439                              Gtk::SHRINK, Gtk::SHRINK);
440        rowno++;
441    
442        eCrossfade_in_start.signal_value_changed().connect(
443            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
444        eCrossfade_in_end.signal_value_changed().connect(
445            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
446        eCrossfade_out_start.signal_value_changed().connect(
447            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
448        eCrossfade_out_end.signal_value_changed().connect(
449            sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw));
450    
451      nextPage();      nextPage();
452    
453      addHeader(_("General Filter Settings"));      addHeader(_("General Filter Settings"));
454      addProp(eVCFEnabled);      addProp(eVCFEnabled);
455      {      {
456          const char* choices[] = { "lowpass", "lowpassturbo", "bandpass",          const char* choices[] = { _("lowpass"), _("lowpassturbo"), _("bandpass"),
457                                    "highpass", "bandreject", 0 };                                    _("highpass"), _("bandreject"), 0 };
458          static const gig::vcf_type_t values[] = {          static const gig::vcf_type_t values[] = {
459              gig::vcf_type_lowpass,              gig::vcf_type_lowpass,
460              gig::vcf_type_lowpassturbo,              gig::vcf_type_lowpassturbo,
# Line 358  DimRegionEdit::DimRegionEdit() : Line 466  DimRegionEdit::DimRegionEdit() :
466      }      }
467      addProp(eVCFType);      addProp(eVCFType);
468      {      {
469          const char* choices[] = { "none", "none2", "modwheel", "effect1", "effect2",          const char* choices[] = { _("none"), _("none2"), _("modwheel"), _("effect1"), _("effect2"),
470                                    "breath", "foot", "sustainpedal", "softpedal",                                    _("breath"), _("foot"), _("sustainpedal"), _("softpedal"),
471                                    "genpurpose7", "genpurpose8", "aftertouch", 0 };                                    _("genpurpose7"), _("genpurpose8"), _("aftertouch"), 0 };
472          static const gig::vcf_cutoff_ctrl_t values[] = {          static const gig::vcf_cutoff_ctrl_t values[] = {
473              gig::vcf_cutoff_ctrl_none,              gig::vcf_cutoff_ctrl_none,
474              gig::vcf_cutoff_ctrl_none2,              gig::vcf_cutoff_ctrl_none2,
# Line 380  DimRegionEdit::DimRegionEdit() : Line 488  DimRegionEdit::DimRegionEdit() :
488      addProp(eVCFCutoffController);      addProp(eVCFCutoffController);
489      addProp(eVCFCutoffControllerInvert);      addProp(eVCFCutoffControllerInvert);
490      addProp(eVCFCutoff);      addProp(eVCFCutoff);
491      const char* curve_type_texts[] = { "nonlinear", "linear", "special", 0 };      const char* curve_type_texts[] = { _("nonlinear"), _("linear"), _("special"), 0 };
492      static const gig::curve_type_t curve_type_values[] = {      static const gig::curve_type_t curve_type_values[] = {
493          gig::curve_type_nonlinear,          gig::curve_type_nonlinear,
494          gig::curve_type_linear,          gig::curve_type_linear,
# Line 390  DimRegionEdit::DimRegionEdit() : Line 498  DimRegionEdit::DimRegionEdit() :
498      addProp(eVCFVelocityCurve);      addProp(eVCFVelocityCurve);
499      addProp(eVCFVelocityScale);      addProp(eVCFVelocityScale);
500      addProp(eVCFVelocityDynamicRange);      addProp(eVCFVelocityDynamicRange);
501    
502        eVCFCutoffController.signal_value_changed().connect(
503            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
504        eVCFVelocityCurve.signal_value_changed().connect(
505            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
506        eVCFVelocityScale.signal_value_changed().connect(
507            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
508        eVCFVelocityDynamicRange.signal_value_changed().connect(
509            sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw));
510    
511        frame = new Gtk::Frame;
512        frame->add(cutoff_curve);
513        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
514                              Gtk::SHRINK, Gtk::SHRINK);
515        rowno++;
516    
517      addProp(eVCFResonance);      addProp(eVCFResonance);
518      addProp(eVCFResonanceDynamic);      addProp(eVCFResonanceDynamic);
519      {      {
520          const char* choices[] = { "none", "genpurpose3", "genpurpose4",          const char* choices[] = { _("none"), _("genpurpose3"), _("genpurpose4"),
521                                    "genpurpose5", "genpurpose6", 0 };                                    _("genpurpose5"), _("genpurpose6"), 0 };
522          static const gig::vcf_res_ctrl_t values[] = {          static const gig::vcf_res_ctrl_t values[] = {
523              gig::vcf_res_ctrl_none,              gig::vcf_res_ctrl_none,
524              gig::vcf_res_ctrl_genpurpose3,              gig::vcf_res_ctrl_genpurpose3,
# Line 410  DimRegionEdit::DimRegionEdit() : Line 534  DimRegionEdit::DimRegionEdit() :
534    
535      nextPage();      nextPage();
536    
537      addHeader(_("Filter Cutoff Envelope (EG2)"));      lEG2 = addHeader(_("Filter Cutoff Envelope (EG2)"));
538      addProp(eEG2PreAttack);      addProp(eEG2PreAttack);
539      addProp(eEG2Attack);      addProp(eEG2Attack);
540      addProp(eEG2Decay1);      addProp(eEG2Decay1);
# Line 423  DimRegionEdit::DimRegionEdit() : Line 547  DimRegionEdit::DimRegionEdit() :
547      addProp(eEG2ControllerAttackInfluence);      addProp(eEG2ControllerAttackInfluence);
548      addProp(eEG2ControllerDecayInfluence);      addProp(eEG2ControllerDecayInfluence);
549      addProp(eEG2ControllerReleaseInfluence);      addProp(eEG2ControllerReleaseInfluence);
550      addHeader(_("Filter Cutoff Oscillator (LFO2)"));      lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)"));
551      addProp(eLFO2Frequency);      addProp(eLFO2Frequency);
552      addProp(eLFO2InternalDepth);      addProp(eLFO2InternalDepth);
553      addProp(eLFO2ControlDepth);      addProp(eLFO2ControlDepth);
554      {      {
555          const char* choices[] = { "internal", "modwheel", "foot",          const char* choices[] = { _("internal"), _("modwheel"), _("foot"),
556                                    "internal+modwheel", "internal+foot", 0 };                                    _("internal+modwheel"), _("internal+foot"), 0 };
557          static const gig::lfo2_ctrl_t values[] = {          static const gig::lfo2_ctrl_t values[] = {
558              gig::lfo2_ctrl_internal,              gig::lfo2_ctrl_internal,
559              gig::lfo2_ctrl_modwheel,              gig::lfo2_ctrl_modwheel,
# Line 456  DimRegionEdit::DimRegionEdit() : Line 580  DimRegionEdit::DimRegionEdit() :
580      addProp(eLFO3InternalDepth);      addProp(eLFO3InternalDepth);
581      addProp(eLFO3ControlDepth);      addProp(eLFO3ControlDepth);
582      {      {
583          const char* choices[] = { "internal", "modwheel", "aftertouch",          const char* choices[] = { _("internal"), _("modwheel"), _("aftertouch"),
584                                    "internal+modwheel", "internal+aftertouch", 0 };                                    _("internal+modwheel"), _("internal+aftertouch"), 0 };
585          static const gig::lfo3_ctrl_t values[] = {          static const gig::lfo3_ctrl_t values[] = {
586              gig::lfo3_ctrl_internal,              gig::lfo3_ctrl_internal,
587              gig::lfo3_ctrl_modwheel,              gig::lfo3_ctrl_modwheel,
# Line 472  DimRegionEdit::DimRegionEdit() : Line 596  DimRegionEdit::DimRegionEdit() :
596    
597      nextPage();      nextPage();
598    
599        addHeader(_("Velocity Reponse"));
600      eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values);      eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values);
601      addProp(eVelocityResponseCurve);      addProp(eVelocityResponseCurve);
602      addProp(eVelocityResponseDepth);      addProp(eVelocityResponseDepth);
603      addProp(eVelocityResponseCurveScaling);      addProp(eVelocityResponseCurveScaling);
604    
605        eVelocityResponseCurve.signal_value_changed().connect(
606            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
607        eVelocityResponseDepth.signal_value_changed().connect(
608            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
609        eVelocityResponseCurveScaling.signal_value_changed().connect(
610            sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw));
611    
612        frame = new Gtk::Frame;
613        frame->add(velocity_curve);
614        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
615                              Gtk::SHRINK, Gtk::SHRINK);
616        rowno++;
617    
618        addHeader(_("Release Velocity Reponse"));
619      eReleaseVelocityResponseCurve.set_choices(curve_type_texts,      eReleaseVelocityResponseCurve.set_choices(curve_type_texts,
620                                                curve_type_values);                                                curve_type_values);
621      addProp(eReleaseVelocityResponseCurve);      addProp(eReleaseVelocityResponseCurve);
622      addProp(eReleaseVelocityResponseDepth);      addProp(eReleaseVelocityResponseDepth);
623    
624        eReleaseVelocityResponseCurve.signal_value_changed().connect(
625            sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));
626        eReleaseVelocityResponseDepth.signal_value_changed().connect(
627            sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));
628        frame = new Gtk::Frame;
629        frame->add(release_curve);
630        table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
631                              Gtk::SHRINK, Gtk::SHRINK);
632        rowno++;
633    
634      addProp(eReleaseTriggerDecay);      addProp(eReleaseTriggerDecay);
635      {      {
636          const char* choices[] = { "none", "effect4depth", "effect5depth", 0 };          const char* choices[] = { _("none"), _("effect4depth"), _("effect5depth"), 0 };
637          static const gig::dim_bypass_ctrl_t values[] = {          static const gig::dim_bypass_ctrl_t values[] = {
638              gig::dim_bypass_ctrl_none,              gig::dim_bypass_ctrl_none,
639              gig::dim_bypass_ctrl_94,              gig::dim_bypass_ctrl_94,
# Line 539  DimRegionEdit::DimRegionEdit() : Line 690  DimRegionEdit::DimRegionEdit() :
690      eSampleLoopInfinite.signal_value_changed().connect(      eSampleLoopInfinite.signal_value_changed().connect(
691          sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled));          sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled));
692    
693      append_page(*table[0], "Sample");      append_page(*table[0], _("Sample"));
694      append_page(*table[1], "Amplitude (1)");      append_page(*table[1], _("Amplitude (1)"));
695      append_page(*table[2], "Amplitude (2)");      append_page(*table[2], _("Amplitude (2)"));
696      append_page(*table[3], "Filter (1)");      append_page(*table[3], _("Filter (1)"));
697      append_page(*table[4], "Filter (2)");      append_page(*table[4], _("Filter (2)"));
698      append_page(*table[5], "Pitch");      append_page(*table[5], _("Pitch"));
699      append_page(*table[6], "Misc");      append_page(*table[6], _("Misc"));
700  }  }
701    
702  DimRegionEdit::~DimRegionEdit()  DimRegionEdit::~DimRegionEdit()
# Line 556  void DimRegionEdit::addString(const char Line 707  void DimRegionEdit::addString(const char
707                                Gtk::Entry*& widget)                                Gtk::Entry*& widget)
708  {  {
709      label = new Gtk::Label(Glib::ustring(labelText) + ":");      label = new Gtk::Label(Glib::ustring(labelText) + ":");
710      label->set_alignment(Gtk::ALIGN_LEFT);      label->set_alignment(Gtk::ALIGN_START);
711    
712      table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,      table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,
713                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
# Line 569  void DimRegionEdit::addString(const char Line 720  void DimRegionEdit::addString(const char
720      rowno++;      rowno++;
721  }  }
722    
723  void DimRegionEdit::addHeader(const char* text)  Gtk::Label* DimRegionEdit::addHeader(const char* text)
724  {  {
725      if (firstRowInBlock < rowno - 1)      if (firstRowInBlock < rowno - 1)
726      {      {
# Line 582  void DimRegionEdit::addHeader(const char Line 733  void DimRegionEdit::addHeader(const char
733      str += "</b>";      str += "</b>";
734      Gtk::Label* label = new Gtk::Label(str);      Gtk::Label* label = new Gtk::Label(str);
735      label->set_use_markup();      label->set_use_markup();
736      label->set_alignment(Gtk::ALIGN_LEFT);      label->set_alignment(Gtk::ALIGN_START);
737      table[pageno]->attach(*label, 0, 3, rowno, rowno + 1,      table[pageno]->attach(*label, 0, 3, rowno, rowno + 1,
738                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
739      rowno++;      rowno++;
740      firstRowInBlock = rowno;      firstRowInBlock = rowno;
741        return label;
742  }  }
743    
744  void DimRegionEdit::nextPage()  void DimRegionEdit::nextPage()
# Line 629  void DimRegionEdit::addProp(LabelWidget& Line 781  void DimRegionEdit::addProp(LabelWidget&
781  void DimRegionEdit::set_dim_region(gig::DimensionRegion* d)  void DimRegionEdit::set_dim_region(gig::DimensionRegion* d)
782  {  {
783      dimregion = d;      dimregion = d;
784        velocity_curve.set_dim_region(d);
785        release_curve.set_dim_region(d);
786        cutoff_curve.set_dim_region(d);
787        crossfade_curve.set_dim_region(d);
788    
789      set_sensitive(d);      set_sensitive(d);
790      if (!d) return;      if (!d) return;
791    
     // TODO: Here is where we decide which dimregions that are going  
     // to be modified when the user changes a parameter. For now, just  
     // choose the shown dimregion.  
     dimregs.clear();  
     dimregs.insert(d);  
   
792      update_model++;      update_model++;
793      eEG1PreAttack.set_value(d->EG1PreAttack);      eEG1PreAttack.set_value(d->EG1PreAttack);
794      eEG1Attack.set_value(d->EG1Attack);      eEG1Attack.set_value(d->EG1Attack);
# Line 735  void DimRegionEdit::set_dim_region(gig:: Line 885  void DimRegionEdit::set_dim_region(gig::
885          d->pSample ? d->pSample->LoopPlayCount : 0);          d->pSample ? d->pSample->LoopPlayCount : 0);
886      update_model--;      update_model--;
887    
888      wSample->set_text(d->pSample ? d->pSample->pInfo->Name.c_str() : "NULL");      wSample->set_text(d->pSample ? d->pSample->pInfo->Name.c_str() : _("NULL"));
889    
890      update_loop_elements();      update_loop_elements();
891      VCFEnabled_toggled();      VCFEnabled_toggled();
# Line 754  void DimRegionEdit::VCFEnabled_toggled() Line 904  void DimRegionEdit::VCFEnabled_toggled()
904      eVCFResonanceController.set_sensitive(sensitive);      eVCFResonanceController.set_sensitive(sensitive);
905      eVCFKeyboardTracking.set_sensitive(sensitive);      eVCFKeyboardTracking.set_sensitive(sensitive);
906      eVCFKeyboardTrackingBreakpoint.set_sensitive(sensitive);      eVCFKeyboardTrackingBreakpoint.set_sensitive(sensitive);
907        lEG2->set_sensitive(sensitive);
908      eEG2PreAttack.set_sensitive(sensitive);      eEG2PreAttack.set_sensitive(sensitive);
909      eEG2Attack.set_sensitive(sensitive);      eEG2Attack.set_sensitive(sensitive);
910      eEG2Decay1.set_sensitive(sensitive);      eEG2Decay1.set_sensitive(sensitive);
# Line 764  void DimRegionEdit::VCFEnabled_toggled() Line 915  void DimRegionEdit::VCFEnabled_toggled()
915      eEG2ControllerAttackInfluence.set_sensitive(sensitive);      eEG2ControllerAttackInfluence.set_sensitive(sensitive);
916      eEG2ControllerDecayInfluence.set_sensitive(sensitive);      eEG2ControllerDecayInfluence.set_sensitive(sensitive);
917      eEG2ControllerReleaseInfluence.set_sensitive(sensitive);      eEG2ControllerReleaseInfluence.set_sensitive(sensitive);
918        lLFO2->set_sensitive(sensitive);
919      eLFO2Frequency.set_sensitive(sensitive);      eLFO2Frequency.set_sensitive(sensitive);
920      eLFO2InternalDepth.set_sensitive(sensitive);      eLFO2InternalDepth.set_sensitive(sensitive);
921      eLFO2ControlDepth.set_sensitive(sensitive);      eLFO2ControlDepth.set_sensitive(sensitive);
# Line 796  void DimRegionEdit::VCFCutoffController_ Line 948  void DimRegionEdit::VCFCutoffController_
948      eVCFCutoffControllerInvert.set_sensitive(hasController);      eVCFCutoffControllerInvert.set_sensitive(hasController);
949      eVCFCutoff.set_sensitive(!hasController);      eVCFCutoff.set_sensitive(!hasController);
950      eVCFResonanceDynamic.set_sensitive(!hasController);      eVCFResonanceDynamic.set_sensitive(!hasController);
951      eVCFVelocityScale.label.set_text(hasController ? "Minimum cutoff:" :      eVCFVelocityScale.label.set_text(hasController ? _("Minimum cutoff:") :
952                                       "Velocity scale:");                                       _("Velocity scale:"));
953  }  }
954    
955  void DimRegionEdit::VCFResonanceController_changed()  void DimRegionEdit::VCFResonanceController_changed()
# Line 961  bool DimRegionEdit::set_sample(gig::Samp Line 1113  bool DimRegionEdit::set_sample(gig::Samp
1113          // 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()
1114          //dimreg_to_be_changed_signal.emit(dimregion);          //dimreg_to_be_changed_signal.emit(dimregion);
1115    
1116            // make sure stereo samples always are the same in both
1117            // dimregs in the samplechannel dimension
1118            int nbDimregs = 1;
1119            gig::DimensionRegion* d[2] = { dimregion, 0 };
1120            if (sample->Channels == 2) {
1121                gig::Region* region = dimregion->GetParent();
1122    
1123                int bitcount = 0;
1124                int stereo_bit = 0;
1125                for (int dim = 0 ; dim < region->Dimensions ; dim++) {
1126                    if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) {
1127                        stereo_bit = 1 << bitcount;
1128                        break;
1129                    }
1130                    bitcount += region->pDimensionDefinitions[dim].bits;
1131                }
1132    
1133                if (stereo_bit) {
1134                    int dimregno;
1135                    for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) {
1136                        if (region->pDimensionRegions[dimregno] == dimregion) {
1137                            break;
1138                        }
1139                    }
1140                    d[0] = region->pDimensionRegions[dimregno & ~stereo_bit];
1141                    d[1] = region->pDimensionRegions[dimregno | stereo_bit];
1142                    nbDimregs = 2;
1143                }
1144            }
1145    
1146          gig::Sample* oldref = dimregion->pSample;          gig::Sample* oldref = dimregion->pSample;
         dimregion->pSample = sample;  
1147    
1148          // copy sample information from Sample to DimensionRegion          for (int i = 0 ; i < nbDimregs ; i++) {
1149                d[i]->pSample = sample;
1150    
1151          dimregion->UnityNote = sample->MIDIUnityNote;              // copy sample information from Sample to DimensionRegion
         dimregion->FineTune = sample->FineTune;  
1152    
1153          int loops = sample->Loops ? 1 : 0;              d[i]->UnityNote = sample->MIDIUnityNote;
1154          while (dimregion->SampleLoops > loops) {              d[i]->FineTune = sample->FineTune;
1155              dimregion->DeleteSampleLoop(&dimregion->pSampleLoops[0]);  
1156          }              int loops = sample->Loops ? 1 : 0;
1157          while (dimregion->SampleLoops < sample->Loops) {              while (d[i]->SampleLoops > loops) {
1158              DLS::sample_loop_t loop;                  d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]);
1159              dimregion->AddSampleLoop(&loop);              }
1160          }              while (d[i]->SampleLoops < sample->Loops) {
1161          if (loops) {                  DLS::sample_loop_t loop;
1162              dimregion->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t);                  d[i]->AddSampleLoop(&loop);
1163              dimregion->pSampleLoops[0].LoopType = sample->LoopType;              }
1164              dimregion->pSampleLoops[0].LoopStart = sample->LoopStart;              if (loops) {
1165              dimregion->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1;                  d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t);
1166                    d[i]->pSampleLoops[0].LoopType = sample->LoopType;
1167                    d[i]->pSampleLoops[0].LoopStart = sample->LoopStart;
1168                    d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1;
1169                }
1170          }          }
1171    
1172          // update ui          // update ui

Legend:
Removed from v.1460  
changed lines
  Added in v.2397

  ViewVC Help
Powered by ViewVC