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

Annotation of /gigedit/trunk/src/gigedit/dimregionedit.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2392 - (hide annotations) (download) (as text)
Mon Jan 7 20:41:16 2013 UTC (11 years, 2 months ago) by persson
File MIME type: text/x-c++hdr
File size: 10886 byte(s)
* added graphical curves for velocity response and crossfade

1 schoenebeck 1225 /* -*- c++ -*-
2 persson 2392 * Copyright (C) 2006-2013 Andreas Persson
3 schoenebeck 1225 *
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     #ifndef GIGEDIT_DIMREGIONEDIT_H
21     #define GIGEDIT_DIMREGIONEDIT_H
22    
23     #include <gig.h>
24    
25 persson 2392 #include <gtkmm/drawingarea.h>
26 schoenebeck 1225 #include <gtkmm/entry.h>
27     #include <gtkmm/label.h>
28     #include <gtkmm/notebook.h>
29     #include <gtkmm/table.h>
30    
31 persson 1460 #include <set>
32    
33 schoenebeck 1225 #include "paramedit.h"
34    
35 persson 2392 class VelocityCurve : public Gtk::DrawingArea {
36     public:
37     VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t));
38     void set_dim_region(gig::DimensionRegion* d) { dimreg = d; }
39    
40     protected:
41     #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
42     bool on_expose_event(GdkEventExpose* e);
43     #else
44     bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
45     #endif
46    
47     private:
48     double (gig::DimensionRegion::* const getter)(uint8_t);
49     gig::DimensionRegion* dimreg;
50     };
51    
52     class CrossfadeCurve : public Gtk::DrawingArea {
53     public:
54     CrossfadeCurve();
55     void set_dim_region(gig::DimensionRegion* d) { dimreg = d; }
56    
57     protected:
58     #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
59     bool on_expose_event(GdkEventExpose* e);
60     #else
61     bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
62     #endif
63    
64     private:
65     gig::DimensionRegion* dimreg;
66     };
67    
68 schoenebeck 1225 class DimRegionEdit : public Gtk::Notebook
69     {
70     public:
71     DimRegionEdit();
72     virtual ~DimRegionEdit();
73     void set_dim_region(gig::DimensionRegion* d);
74 persson 1265 bool set_sample(gig::Sample* sample);
75 schoenebeck 1225 Gtk::Entry* wSample;
76 schoenebeck 1339 sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_to_be_changed();
77     sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_changed();
78     sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& signal_sample_ref_changed();
79 schoenebeck 1225
80 persson 1533 std::set<gig::DimensionRegion*> dimregs;
81    
82 schoenebeck 1225 protected:
83 schoenebeck 1322 sigc::signal<void, gig::DimensionRegion*> dimreg_to_be_changed_signal;
84     sigc::signal<void, gig::DimensionRegion*> dimreg_changed_signal;
85     sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/> sample_ref_changed_signal;
86 persson 1261 sigc::signal<void> instrument_changed;
87    
88 schoenebeck 1225 gig::DimensionRegion* dimregion;
89    
90 persson 2151 #ifdef OLD_TOOLTIPS
91 schoenebeck 1225 Gtk::Tooltips tooltips;
92 persson 2151 #endif
93 schoenebeck 1225
94     Gtk::Table* table[7];
95    
96     Gtk::Label* lSample;
97    
98 persson 2392 VelocityCurve velocity_curve;
99     VelocityCurve release_curve;
100     VelocityCurve cutoff_curve;
101     CrossfadeCurve crossfade_curve;
102    
103 schoenebeck 1225 NumEntryPermille eEG1PreAttack;
104     NumEntryTemp<double> eEG1Attack;
105     NumEntryTemp<double> eEG1Decay1;
106     NumEntryTemp<double> eEG1Decay2;
107     BoolEntry eEG1InfiniteSustain;
108     NumEntryPermille eEG1Sustain;
109     NumEntryTemp<double> eEG1Release;
110     BoolEntry eEG1Hold;
111     ChoiceEntryLeverageCtrl eEG1Controller;
112     BoolEntry eEG1ControllerInvert;
113     NumEntryTemp<uint8_t> eEG1ControllerAttackInfluence;
114     NumEntryTemp<uint8_t> eEG1ControllerDecayInfluence;
115     NumEntryTemp<uint8_t> eEG1ControllerReleaseInfluence;
116     NumEntryTemp<double> eLFO1Frequency;
117     NumEntryTemp<uint16_t> eLFO1InternalDepth;
118     NumEntryTemp<uint16_t> eLFO1ControlDepth;
119     ChoiceEntry<gig::lfo1_ctrl_t> eLFO1Controller;
120     BoolEntry eLFO1FlipPhase;
121     BoolEntry eLFO1Sync;
122     NumEntryPermille eEG2PreAttack;
123     NumEntryTemp<double> eEG2Attack;
124     NumEntryTemp<double> eEG2Decay1;
125     NumEntryTemp<double> eEG2Decay2;
126     BoolEntry eEG2InfiniteSustain;
127     NumEntryPermille eEG2Sustain;
128     NumEntryTemp<double> eEG2Release;
129     ChoiceEntryLeverageCtrl eEG2Controller;
130     BoolEntry eEG2ControllerInvert;
131     NumEntryTemp<uint8_t> eEG2ControllerAttackInfluence;
132     NumEntryTemp<uint8_t> eEG2ControllerDecayInfluence;
133     NumEntryTemp<uint8_t> eEG2ControllerReleaseInfluence;
134     NumEntryTemp<double> eLFO2Frequency;
135     NumEntryTemp<uint16_t> eLFO2InternalDepth;
136     NumEntryTemp<uint16_t> eLFO2ControlDepth;
137     ChoiceEntry<gig::lfo2_ctrl_t> eLFO2Controller;
138     BoolEntry eLFO2FlipPhase;
139     BoolEntry eLFO2Sync;
140     NumEntryTemp<double> eEG3Attack;
141     NumEntryTemp<int16_t> eEG3Depth;
142     NumEntryTemp<double> eLFO3Frequency;
143     NumEntryTemp<int16_t> eLFO3InternalDepth;
144     NumEntryTemp<int16_t> eLFO3ControlDepth;
145     ChoiceEntry<gig::lfo3_ctrl_t> eLFO3Controller;
146     BoolEntry eLFO3Sync;
147     BoolEntry eVCFEnabled;
148     ChoiceEntry<gig::vcf_type_t> eVCFType;
149     ChoiceEntry<gig::vcf_cutoff_ctrl_t> eVCFCutoffController;
150     BoolEntry eVCFCutoffControllerInvert;
151     NumEntryTemp<uint8_t> eVCFCutoff;
152     ChoiceEntry<gig::curve_type_t> eVCFVelocityCurve;
153     NumEntryTemp<uint8_t> eVCFVelocityScale;
154     NumEntryTemp<uint8_t> eVCFVelocityDynamicRange;
155     NumEntryTemp<uint8_t> eVCFResonance;
156     BoolEntry eVCFResonanceDynamic;
157     ChoiceEntry<gig::vcf_res_ctrl_t> eVCFResonanceController;
158     BoolEntry eVCFKeyboardTracking;
159     NumEntryTemp<uint8_t> eVCFKeyboardTrackingBreakpoint;
160     ChoiceEntry<gig::curve_type_t> eVelocityResponseCurve;
161     NumEntryTemp<uint8_t> eVelocityResponseDepth;
162     NumEntryTemp<uint8_t> eVelocityResponseCurveScaling;
163     ChoiceEntry<gig::curve_type_t> eReleaseVelocityResponseCurve;
164     NumEntryTemp<uint8_t> eReleaseVelocityResponseDepth;
165     NumEntryTemp<uint8_t> eReleaseTriggerDecay;
166     NumEntryTemp<uint8_t> eCrossfade_in_start;
167     NumEntryTemp<uint8_t> eCrossfade_in_end;
168     NumEntryTemp<uint8_t> eCrossfade_out_start;
169     NumEntryTemp<uint8_t> eCrossfade_out_end;
170     BoolEntry ePitchTrack;
171     ChoiceEntry<gig::dim_bypass_ctrl_t> eDimensionBypass;
172     NumEntryTemp<int8_t> ePan;
173     BoolEntry eSelfMask;
174     ChoiceEntryLeverageCtrl eAttenuationController;
175     BoolEntry eInvertAttenuationController;
176     NumEntryTemp<uint8_t> eAttenuationControllerThreshold;
177     NumEntryTemp<uint8_t> eChannelOffset;
178     BoolEntry eSustainDefeat;
179     BoolEntry eMSDecode;
180     NumEntryTemp<uint16_t> eSampleStartOffset;
181     NoteEntry eUnityNote;
182     NumEntryTemp<int16_t> eFineTune;
183     NumEntryGain eGain;
184     BoolEntryPlus6 eGainPlus6;
185     BoolEntry eSampleLoopEnabled;
186     NumEntryTemp<uint32_t> eSampleLoopStart;
187     NumEntryTemp<uint32_t> eSampleLoopLength;
188     ChoiceEntry<uint32_t> eSampleLoopType;
189     BoolEntry eSampleLoopInfinite;
190     NumEntryTemp<uint32_t> eSampleLoopPlayCount;
191 persson 1623 Gtk::Label* lEG2;
192     Gtk::Label* lLFO2;
193 schoenebeck 1225
194     int rowno;
195     int pageno;
196     int firstRowInBlock;
197    
198    
199     void addProp(BoolEntry& boolentry);
200 persson 1262 void addProp(BoolEntryPlus6& boolentry);
201 schoenebeck 1225 void addProp(LabelWidget& labelwidget);
202     void addString(const char* labelText, Gtk::Label*& label,
203     Gtk::Entry*& widget);
204 persson 1623 Gtk::Label* addHeader(const char* text);
205 schoenebeck 1225 void nextPage();
206    
207     void VCFEnabled_toggled();
208     void VCFCutoffController_changed();
209     void VCFResonanceController_changed();
210     void EG1InfiniteSustain_toggled();
211     void EG2InfiniteSustain_toggled();
212     void EG1Controller_changed();
213     void EG2Controller_changed();
214     void AttenuationController_changed();
215     void LFO1Controller_changed();
216     void LFO2Controller_changed();
217     void LFO3Controller_changed();
218     void crossfade1_changed();
219     void crossfade2_changed();
220     void crossfade3_changed();
221     void crossfade4_changed();
222 persson 1460 void update_loop_elements();
223     void loop_start_changed();
224     void loop_length_changed();
225 schoenebeck 1225 void loop_infinite_toggled();
226    
227 persson 1460 int update_model;
228    
229     // connect a widget to a setter function in DimRegionEdit
230     template<typename C, typename T>
231     void connect(C& widget,
232     void (DimRegionEdit::*setter)(gig::DimensionRegion*, T)) {
233     connect<C, T>(widget,
234     sigc::mem_fun(setter));
235     }
236    
237     // connect a widget to a member variable in gig::DimensionRegion
238     template<typename C, typename T>
239     void connect(C& widget, T gig::DimensionRegion::* member) {
240     connect<C, T>(widget,
241     sigc::bind(sigc::mem_fun(&DimRegionEdit::set_member<T>), member));
242     }
243    
244     // connect a widget to a setter function in gig::DimensionRegion
245     template<typename C, typename T>
246     void connect(C& widget,
247     void (gig::DimensionRegion::*setter)(T)) {
248     connect<C, T>(widget,
249     sigc::hide<0>(sigc::mem_fun(setter)));
250     }
251    
252     // helper function for the connect functions above
253     template<typename C, typename T>
254     void connect(C& widget,
255     sigc::slot<void, DimRegionEdit*, gig::DimensionRegion*, T> setter) {
256     widget.signal_value_changed().connect(
257     sigc::compose(sigc::bind(sigc::mem_fun(*this, &DimRegionEdit::set_many<T>), setter),
258     sigc::mem_fun(widget, &C::get_value)));
259     }
260    
261     // loop through all dimregions being edited ant set a value in
262     // each of them
263     template<typename T>
264     void set_many(T value,
265     sigc::slot<void, DimRegionEdit*, gig::DimensionRegion*, T> setter) {
266     if (update_model == 0) {
267     for (std::set<gig::DimensionRegion*>::iterator i = dimregs.begin() ;
268     i != dimregs.end() ; i++)
269     {
270     dimreg_changed_signal(*i);
271     setter(this, *i, value);
272     }
273     }
274     }
275    
276     // set a value of a member variable in the given dimregion
277     template<typename T>
278     void set_member(gig::DimensionRegion* d, T value,
279     T gig::DimensionRegion::* member) {
280     d->*member = value;
281     }
282    
283     // setters for specific dimregion parameters
284    
285     void set_UnityNote(gig::DimensionRegion* d, uint8_t value);
286     void set_FineTune(gig::DimensionRegion* d, int16_t value);
287     void set_Crossfade_in_start(gig::DimensionRegion* d, uint8_t value);
288     void set_Crossfade_in_end(gig::DimensionRegion* d, uint8_t value);
289     void set_Crossfade_out_start(gig::DimensionRegion* d, uint8_t value);
290     void set_Crossfade_out_end(gig::DimensionRegion* d, uint8_t value);
291     void set_Gain(gig::DimensionRegion* d, int32_t value);
292     void set_LoopEnabled(gig::DimensionRegion* d, bool value);
293     void set_LoopType(gig::DimensionRegion* d, uint32_t value);
294     void set_LoopStart(gig::DimensionRegion* d, uint32_t value);
295     void set_LoopLength(gig::DimensionRegion* d, uint32_t value);
296     void set_LoopInfinite(gig::DimensionRegion* d, bool value);
297     void set_LoopPlayCount(gig::DimensionRegion* d, uint32_t value);
298 schoenebeck 1225 };
299    
300     #endif

  ViewVC Help
Powered by ViewVC