/[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 1533 - (show annotations) (download) (as text)
Sat Dec 1 10:21:07 2007 UTC (16 years, 4 months ago) by persson
File MIME type: text/x-c++hdr
File size: 9750 byte(s)
* parameter edits can now be applied to multiple regions and dimension
  regions simultaneously - three checkboxes were added that select
  if changes apply to all regions and/or all dimension regions

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

  ViewVC Help
Powered by ViewVC