/[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 2690 - (hide annotations) (download) (as text)
Sun Jan 4 18:36:42 2015 UTC (9 years, 2 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 11224 byte(s)
* Dimension Region Editor: Show coarse sample format info (audio channels,
  bit depth, sample rate) and unique sample ID (since the gig format allows
  different samples to have the same name).

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

  ViewVC Help
Powered by ViewVC