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 |
2844 |
#include <gtkmm/box.h> |
27 |
persson |
2392 |
#include <gtkmm/drawingarea.h> |
28 |
schoenebeck |
1225 |
#include <gtkmm/entry.h> |
29 |
|
|
#include <gtkmm/label.h> |
30 |
|
|
#include <gtkmm/notebook.h> |
31 |
|
|
#include <gtkmm/table.h> |
32 |
|
|
|
33 |
persson |
1460 |
#include <set> |
34 |
|
|
|
35 |
schoenebeck |
1225 |
#include "paramedit.h" |
36 |
|
|
|
37 |
persson |
2392 |
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 |
persson |
2430 |
void draw_one_curve(const Cairo::RefPtr<Cairo::Context>& cr, |
69 |
|
|
const gig::DimensionRegion* d, |
70 |
|
|
bool sensitive); |
71 |
persson |
2392 |
}; |
72 |
|
|
|
73 |
schoenebeck |
1225 |
class DimRegionEdit : public Gtk::Notebook |
74 |
|
|
{ |
75 |
|
|
public: |
76 |
|
|
DimRegionEdit(); |
77 |
|
|
virtual ~DimRegionEdit(); |
78 |
|
|
void set_dim_region(gig::DimensionRegion* d); |
79 |
schoenebeck |
2464 |
bool set_sample(gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop); |
80 |
schoenebeck |
2925 |
bool set_sample(gig::DimensionRegion* dimreg, gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop); |
81 |
schoenebeck |
1225 |
Gtk::Entry* wSample; |
82 |
schoenebeck |
2720 |
Gtk::Button* buttonNullSampleReference; |
83 |
schoenebeck |
1339 |
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 |
schoenebeck |
2691 |
sigc::signal<void, gig::Sample*>& signal_select_sample(); |
87 |
schoenebeck |
1225 |
|
88 |
persson |
1533 |
std::set<gig::DimensionRegion*> dimregs; |
89 |
|
|
|
90 |
schoenebeck |
1225 |
protected: |
91 |
schoenebeck |
1322 |
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 |
persson |
1261 |
sigc::signal<void> instrument_changed; |
95 |
schoenebeck |
2691 |
sigc::signal<void, gig::Sample*> select_sample_signal; |
96 |
persson |
1261 |
|
97 |
schoenebeck |
1225 |
gig::DimensionRegion* dimregion; |
98 |
|
|
|
99 |
persson |
2151 |
#ifdef OLD_TOOLTIPS |
100 |
schoenebeck |
1225 |
Gtk::Tooltips tooltips; |
101 |
persson |
2151 |
#endif |
102 |
schoenebeck |
1225 |
|
103 |
|
|
Gtk::Table* table[7]; |
104 |
|
|
|
105 |
|
|
Gtk::Label* lSample; |
106 |
|
|
|
107 |
persson |
2392 |
VelocityCurve velocity_curve; |
108 |
|
|
VelocityCurve release_curve; |
109 |
|
|
VelocityCurve cutoff_curve; |
110 |
|
|
CrossfadeCurve crossfade_curve; |
111 |
|
|
|
112 |
schoenebeck |
1225 |
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 |
schoenebeck |
2991 |
ReadOnlyLabelWidget eSampleGroup; |
192 |
schoenebeck |
2690 |
ReadOnlyLabelWidget eSampleFormatInfo; |
193 |
|
|
ReadOnlyLabelWidget eSampleID; |
194 |
schoenebeck |
2991 |
ReadOnlyLabelWidget eChecksum; |
195 |
schoenebeck |
1225 |
NumEntryTemp<int16_t> eFineTune; |
196 |
|
|
NumEntryGain eGain; |
197 |
|
|
BoolEntryPlus6 eGainPlus6; |
198 |
|
|
BoolEntry eSampleLoopEnabled; |
199 |
|
|
NumEntryTemp<uint32_t> eSampleLoopStart; |
200 |
|
|
NumEntryTemp<uint32_t> eSampleLoopLength; |
201 |
|
|
ChoiceEntry<uint32_t> eSampleLoopType; |
202 |
|
|
BoolEntry eSampleLoopInfinite; |
203 |
|
|
NumEntryTemp<uint32_t> eSampleLoopPlayCount; |
204 |
persson |
1623 |
Gtk::Label* lEG2; |
205 |
|
|
Gtk::Label* lLFO2; |
206 |
schoenebeck |
1225 |
|
207 |
schoenebeck |
2691 |
Gtk::Button buttonSelectSample; |
208 |
|
|
|
209 |
schoenebeck |
1225 |
int rowno; |
210 |
|
|
int pageno; |
211 |
|
|
int firstRowInBlock; |
212 |
|
|
|
213 |
|
|
|
214 |
|
|
void addProp(BoolEntry& boolentry); |
215 |
persson |
1262 |
void addProp(BoolEntryPlus6& boolentry); |
216 |
schoenebeck |
1225 |
void addProp(LabelWidget& labelwidget); |
217 |
|
|
void addString(const char* labelText, Gtk::Label*& label, |
218 |
|
|
Gtk::Entry*& widget); |
219 |
schoenebeck |
2720 |
void addString(const char* labelText, Gtk::Label*& label, |
220 |
|
|
Gtk::Entry*& widget, Gtk::Button*& button); |
221 |
persson |
1623 |
Gtk::Label* addHeader(const char* text); |
222 |
schoenebeck |
2691 |
void addRightHandSide(Gtk::Widget& widget); |
223 |
schoenebeck |
1225 |
void nextPage(); |
224 |
|
|
|
225 |
|
|
void VCFEnabled_toggled(); |
226 |
|
|
void VCFCutoffController_changed(); |
227 |
|
|
void VCFResonanceController_changed(); |
228 |
|
|
void EG1InfiniteSustain_toggled(); |
229 |
|
|
void EG2InfiniteSustain_toggled(); |
230 |
|
|
void EG1Controller_changed(); |
231 |
|
|
void EG2Controller_changed(); |
232 |
|
|
void AttenuationController_changed(); |
233 |
|
|
void LFO1Controller_changed(); |
234 |
|
|
void LFO2Controller_changed(); |
235 |
|
|
void LFO3Controller_changed(); |
236 |
|
|
void crossfade1_changed(); |
237 |
|
|
void crossfade2_changed(); |
238 |
|
|
void crossfade3_changed(); |
239 |
|
|
void crossfade4_changed(); |
240 |
persson |
1460 |
void update_loop_elements(); |
241 |
|
|
void loop_start_changed(); |
242 |
|
|
void loop_length_changed(); |
243 |
schoenebeck |
1225 |
void loop_infinite_toggled(); |
244 |
schoenebeck |
2720 |
void nullOutSampleReference(); |
245 |
schoenebeck |
1225 |
|
246 |
persson |
1460 |
int update_model; |
247 |
|
|
|
248 |
|
|
// connect a widget to a setter function in DimRegionEdit |
249 |
|
|
template<typename C, typename T> |
250 |
|
|
void connect(C& widget, |
251 |
|
|
void (DimRegionEdit::*setter)(gig::DimensionRegion*, T)) { |
252 |
|
|
connect<C, T>(widget, |
253 |
|
|
sigc::mem_fun(setter)); |
254 |
|
|
} |
255 |
|
|
|
256 |
|
|
// connect a widget to a member variable in gig::DimensionRegion |
257 |
|
|
template<typename C, typename T> |
258 |
|
|
void connect(C& widget, T gig::DimensionRegion::* member) { |
259 |
|
|
connect<C, T>(widget, |
260 |
|
|
sigc::bind(sigc::mem_fun(&DimRegionEdit::set_member<T>), member)); |
261 |
|
|
} |
262 |
|
|
|
263 |
|
|
// connect a widget to a setter function in gig::DimensionRegion |
264 |
|
|
template<typename C, typename T> |
265 |
|
|
void connect(C& widget, |
266 |
|
|
void (gig::DimensionRegion::*setter)(T)) { |
267 |
|
|
connect<C, T>(widget, |
268 |
|
|
sigc::hide<0>(sigc::mem_fun(setter))); |
269 |
|
|
} |
270 |
|
|
|
271 |
|
|
// helper function for the connect functions above |
272 |
|
|
template<typename C, typename T> |
273 |
|
|
void connect(C& widget, |
274 |
|
|
sigc::slot<void, DimRegionEdit*, gig::DimensionRegion*, T> setter) { |
275 |
|
|
widget.signal_value_changed().connect( |
276 |
|
|
sigc::compose(sigc::bind(sigc::mem_fun(*this, &DimRegionEdit::set_many<T>), setter), |
277 |
|
|
sigc::mem_fun(widget, &C::get_value))); |
278 |
|
|
} |
279 |
|
|
|
280 |
schoenebeck |
2925 |
// loop through all dimregions being edited and set a value in |
281 |
persson |
1460 |
// each of them |
282 |
|
|
template<typename T> |
283 |
|
|
void set_many(T value, |
284 |
|
|
sigc::slot<void, DimRegionEdit*, gig::DimensionRegion*, T> setter) { |
285 |
|
|
if (update_model == 0) { |
286 |
|
|
for (std::set<gig::DimensionRegion*>::iterator i = dimregs.begin() ; |
287 |
persson |
2841 |
i != dimregs.end() ; ++i) |
288 |
persson |
1460 |
{ |
289 |
|
|
dimreg_changed_signal(*i); |
290 |
|
|
setter(this, *i, value); |
291 |
|
|
} |
292 |
|
|
} |
293 |
|
|
} |
294 |
|
|
|
295 |
|
|
// set a value of a member variable in the given dimregion |
296 |
|
|
template<typename T> |
297 |
|
|
void set_member(gig::DimensionRegion* d, T value, |
298 |
|
|
T gig::DimensionRegion::* member) { |
299 |
|
|
d->*member = value; |
300 |
|
|
} |
301 |
|
|
|
302 |
|
|
// setters for specific dimregion parameters |
303 |
|
|
|
304 |
|
|
void set_UnityNote(gig::DimensionRegion* d, uint8_t value); |
305 |
|
|
void set_FineTune(gig::DimensionRegion* d, int16_t value); |
306 |
|
|
void set_Crossfade_in_start(gig::DimensionRegion* d, uint8_t value); |
307 |
|
|
void set_Crossfade_in_end(gig::DimensionRegion* d, uint8_t value); |
308 |
|
|
void set_Crossfade_out_start(gig::DimensionRegion* d, uint8_t value); |
309 |
|
|
void set_Crossfade_out_end(gig::DimensionRegion* d, uint8_t value); |
310 |
|
|
void set_Gain(gig::DimensionRegion* d, int32_t value); |
311 |
|
|
void set_LoopEnabled(gig::DimensionRegion* d, bool value); |
312 |
|
|
void set_LoopType(gig::DimensionRegion* d, uint32_t value); |
313 |
|
|
void set_LoopStart(gig::DimensionRegion* d, uint32_t value); |
314 |
|
|
void set_LoopLength(gig::DimensionRegion* d, uint32_t value); |
315 |
|
|
void set_LoopInfinite(gig::DimensionRegion* d, bool value); |
316 |
|
|
void set_LoopPlayCount(gig::DimensionRegion* d, uint32_t value); |
317 |
schoenebeck |
2691 |
|
318 |
|
|
void onButtonSelectSamplePressed(); |
319 |
schoenebeck |
1225 |
}; |
320 |
|
|
|
321 |
|
|
#endif |