/[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 2430 - (hide annotations) (download) (as text)
Sun Mar 3 17:26:11 2013 UTC (11 years, 1 month ago) by persson
File MIME type: text/x-c++hdr
File size: 11047 byte(s)
* cross fade graph: draw curves of all layers in the same graph

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

  ViewVC Help
Powered by ViewVC