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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2925 - (show annotations) (download) (as text)
Sun Jun 5 13:17:28 2016 UTC (2 years, 3 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 11840 byte(s)
* Dimension Region Editor: when assigning a new sample to a dimension
  region, apply the sample to all currently selected dimension regions
  (i.e. when Ctrl select was used on the dimension selector widget).
* Bumped version (1.0.0.svn16).

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

  ViewVC Help
Powered by ViewVC