1 |
schoenebeck |
1225 |
/* -*- 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 |
persson |
1460 |
#include <set> |
32 |
|
|
|
33 |
schoenebeck |
1225 |
#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 |
persson |
1265 |
bool set_sample(gig::Sample* sample); |
42 |
schoenebeck |
1225 |
Gtk::Entry* wSample; |
43 |
schoenebeck |
1339 |
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 |
schoenebeck |
1225 |
|
47 |
|
|
protected: |
48 |
schoenebeck |
1322 |
sigc::signal<void, gig::DimensionRegion*> dimreg_to_be_changed_signal; |
49 |
|
|
sigc::signal<void, gig::DimensionRegion*> dimreg_changed_signal; |
50 |
|
|
sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/> sample_ref_changed_signal; |
51 |
persson |
1261 |
sigc::signal<void> instrument_changed; |
52 |
|
|
|
53 |
schoenebeck |
1225 |
gig::DimensionRegion* dimregion; |
54 |
|
|
|
55 |
|
|
Gtk::Tooltips tooltips; |
56 |
|
|
|
57 |
|
|
Gtk::Table* table[7]; |
58 |
|
|
|
59 |
|
|
Gtk::Label* lSample; |
60 |
|
|
|
61 |
|
|
NumEntryPermille eEG1PreAttack; |
62 |
|
|
NumEntryTemp<double> eEG1Attack; |
63 |
|
|
NumEntryTemp<double> eEG1Decay1; |
64 |
|
|
NumEntryTemp<double> eEG1Decay2; |
65 |
|
|
BoolEntry eEG1InfiniteSustain; |
66 |
|
|
NumEntryPermille eEG1Sustain; |
67 |
|
|
NumEntryTemp<double> eEG1Release; |
68 |
|
|
BoolEntry eEG1Hold; |
69 |
|
|
ChoiceEntryLeverageCtrl eEG1Controller; |
70 |
|
|
BoolEntry eEG1ControllerInvert; |
71 |
|
|
NumEntryTemp<uint8_t> eEG1ControllerAttackInfluence; |
72 |
|
|
NumEntryTemp<uint8_t> eEG1ControllerDecayInfluence; |
73 |
|
|
NumEntryTemp<uint8_t> eEG1ControllerReleaseInfluence; |
74 |
|
|
NumEntryTemp<double> eLFO1Frequency; |
75 |
|
|
NumEntryTemp<uint16_t> eLFO1InternalDepth; |
76 |
|
|
NumEntryTemp<uint16_t> eLFO1ControlDepth; |
77 |
|
|
ChoiceEntry<gig::lfo1_ctrl_t> eLFO1Controller; |
78 |
|
|
BoolEntry eLFO1FlipPhase; |
79 |
|
|
BoolEntry eLFO1Sync; |
80 |
|
|
NumEntryPermille eEG2PreAttack; |
81 |
|
|
NumEntryTemp<double> eEG2Attack; |
82 |
|
|
NumEntryTemp<double> eEG2Decay1; |
83 |
|
|
NumEntryTemp<double> eEG2Decay2; |
84 |
|
|
BoolEntry eEG2InfiniteSustain; |
85 |
|
|
NumEntryPermille eEG2Sustain; |
86 |
|
|
NumEntryTemp<double> eEG2Release; |
87 |
|
|
ChoiceEntryLeverageCtrl eEG2Controller; |
88 |
|
|
BoolEntry eEG2ControllerInvert; |
89 |
|
|
NumEntryTemp<uint8_t> eEG2ControllerAttackInfluence; |
90 |
|
|
NumEntryTemp<uint8_t> eEG2ControllerDecayInfluence; |
91 |
|
|
NumEntryTemp<uint8_t> eEG2ControllerReleaseInfluence; |
92 |
|
|
NumEntryTemp<double> eLFO2Frequency; |
93 |
|
|
NumEntryTemp<uint16_t> eLFO2InternalDepth; |
94 |
|
|
NumEntryTemp<uint16_t> eLFO2ControlDepth; |
95 |
|
|
ChoiceEntry<gig::lfo2_ctrl_t> eLFO2Controller; |
96 |
|
|
BoolEntry eLFO2FlipPhase; |
97 |
|
|
BoolEntry eLFO2Sync; |
98 |
|
|
NumEntryTemp<double> eEG3Attack; |
99 |
|
|
NumEntryTemp<int16_t> eEG3Depth; |
100 |
|
|
NumEntryTemp<double> eLFO3Frequency; |
101 |
|
|
NumEntryTemp<int16_t> eLFO3InternalDepth; |
102 |
|
|
NumEntryTemp<int16_t> eLFO3ControlDepth; |
103 |
|
|
ChoiceEntry<gig::lfo3_ctrl_t> eLFO3Controller; |
104 |
|
|
BoolEntry eLFO3Sync; |
105 |
|
|
BoolEntry eVCFEnabled; |
106 |
|
|
ChoiceEntry<gig::vcf_type_t> eVCFType; |
107 |
|
|
ChoiceEntry<gig::vcf_cutoff_ctrl_t> eVCFCutoffController; |
108 |
|
|
BoolEntry eVCFCutoffControllerInvert; |
109 |
|
|
NumEntryTemp<uint8_t> eVCFCutoff; |
110 |
|
|
ChoiceEntry<gig::curve_type_t> eVCFVelocityCurve; |
111 |
|
|
NumEntryTemp<uint8_t> eVCFVelocityScale; |
112 |
|
|
NumEntryTemp<uint8_t> eVCFVelocityDynamicRange; |
113 |
|
|
NumEntryTemp<uint8_t> eVCFResonance; |
114 |
|
|
BoolEntry eVCFResonanceDynamic; |
115 |
|
|
ChoiceEntry<gig::vcf_res_ctrl_t> eVCFResonanceController; |
116 |
|
|
BoolEntry eVCFKeyboardTracking; |
117 |
|
|
NumEntryTemp<uint8_t> eVCFKeyboardTrackingBreakpoint; |
118 |
|
|
ChoiceEntry<gig::curve_type_t> eVelocityResponseCurve; |
119 |
|
|
NumEntryTemp<uint8_t> eVelocityResponseDepth; |
120 |
|
|
NumEntryTemp<uint8_t> eVelocityResponseCurveScaling; |
121 |
|
|
ChoiceEntry<gig::curve_type_t> eReleaseVelocityResponseCurve; |
122 |
|
|
NumEntryTemp<uint8_t> eReleaseVelocityResponseDepth; |
123 |
|
|
NumEntryTemp<uint8_t> eReleaseTriggerDecay; |
124 |
|
|
NumEntryTemp<uint8_t> eCrossfade_in_start; |
125 |
|
|
NumEntryTemp<uint8_t> eCrossfade_in_end; |
126 |
|
|
NumEntryTemp<uint8_t> eCrossfade_out_start; |
127 |
|
|
NumEntryTemp<uint8_t> eCrossfade_out_end; |
128 |
|
|
BoolEntry ePitchTrack; |
129 |
|
|
ChoiceEntry<gig::dim_bypass_ctrl_t> eDimensionBypass; |
130 |
|
|
NumEntryTemp<int8_t> ePan; |
131 |
|
|
BoolEntry eSelfMask; |
132 |
|
|
ChoiceEntryLeverageCtrl eAttenuationController; |
133 |
|
|
BoolEntry eInvertAttenuationController; |
134 |
|
|
NumEntryTemp<uint8_t> eAttenuationControllerThreshold; |
135 |
|
|
NumEntryTemp<uint8_t> eChannelOffset; |
136 |
|
|
BoolEntry eSustainDefeat; |
137 |
|
|
BoolEntry eMSDecode; |
138 |
|
|
NumEntryTemp<uint16_t> eSampleStartOffset; |
139 |
|
|
NoteEntry eUnityNote; |
140 |
|
|
NumEntryTemp<int16_t> eFineTune; |
141 |
|
|
NumEntryGain eGain; |
142 |
|
|
BoolEntryPlus6 eGainPlus6; |
143 |
|
|
BoolEntry eSampleLoopEnabled; |
144 |
|
|
NumEntryTemp<uint32_t> eSampleLoopStart; |
145 |
|
|
NumEntryTemp<uint32_t> eSampleLoopLength; |
146 |
|
|
ChoiceEntry<uint32_t> eSampleLoopType; |
147 |
|
|
BoolEntry eSampleLoopInfinite; |
148 |
|
|
NumEntryTemp<uint32_t> eSampleLoopPlayCount; |
149 |
|
|
|
150 |
|
|
int rowno; |
151 |
|
|
int pageno; |
152 |
|
|
int firstRowInBlock; |
153 |
|
|
|
154 |
|
|
|
155 |
|
|
void addProp(BoolEntry& boolentry); |
156 |
persson |
1262 |
void addProp(BoolEntryPlus6& boolentry); |
157 |
schoenebeck |
1225 |
void addProp(LabelWidget& labelwidget); |
158 |
|
|
void addString(const char* labelText, Gtk::Label*& label, |
159 |
|
|
Gtk::Entry*& widget); |
160 |
|
|
void addHeader(const char* text); |
161 |
|
|
void nextPage(); |
162 |
|
|
|
163 |
|
|
void VCFEnabled_toggled(); |
164 |
|
|
void VCFCutoffController_changed(); |
165 |
|
|
void VCFResonanceController_changed(); |
166 |
|
|
void EG1InfiniteSustain_toggled(); |
167 |
|
|
void EG2InfiniteSustain_toggled(); |
168 |
|
|
void EG1Controller_changed(); |
169 |
|
|
void EG2Controller_changed(); |
170 |
|
|
void AttenuationController_changed(); |
171 |
|
|
void LFO1Controller_changed(); |
172 |
|
|
void LFO2Controller_changed(); |
173 |
|
|
void LFO3Controller_changed(); |
174 |
|
|
void crossfade1_changed(); |
175 |
|
|
void crossfade2_changed(); |
176 |
|
|
void crossfade3_changed(); |
177 |
|
|
void crossfade4_changed(); |
178 |
persson |
1460 |
void update_loop_elements(); |
179 |
|
|
void loop_start_changed(); |
180 |
|
|
void loop_length_changed(); |
181 |
schoenebeck |
1225 |
void loop_infinite_toggled(); |
182 |
|
|
|
183 |
persson |
1460 |
std::set<gig::DimensionRegion*> dimregs; |
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 |
schoenebeck |
1225 |
}; |
257 |
|
|
|
258 |
|
|
#endif |