1 |
/* |
2 |
* Copyright (C) 2006-2016 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 |
#include "dimregionedit.h" |
21 |
|
22 |
#include "global.h" |
23 |
#include "compat.h" |
24 |
|
25 |
VelocityCurve::VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t)) : |
26 |
getter(getter), dimreg(0) { |
27 |
set_size_request(80, 80); |
28 |
} |
29 |
|
30 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
31 |
bool VelocityCurve::on_expose_event(GdkEventExpose* e) { |
32 |
const Cairo::RefPtr<Cairo::Context>& cr = |
33 |
get_window()->create_cairo_context(); |
34 |
#if 0 |
35 |
} |
36 |
#endif |
37 |
#else |
38 |
bool VelocityCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { |
39 |
#endif |
40 |
if (dimreg) { |
41 |
int w = get_width(); |
42 |
int h = get_height(); |
43 |
|
44 |
for (int pass = 0 ; pass < 2 ; pass++) { |
45 |
for (double x = 0 ; x <= w ; x++) { |
46 |
int vel = int(x * (127 - 1e-10) / w + 1); |
47 |
double y = (1 - (dimreg->*getter)(vel)) * (h - 3) + 1.5; |
48 |
|
49 |
if (x < 1e-10) { |
50 |
cr->move_to(x, y); |
51 |
} else { |
52 |
cr->line_to(x, y); |
53 |
} |
54 |
} |
55 |
if (pass == 0) { |
56 |
cr->line_to(w, h); |
57 |
cr->line_to(0, h); |
58 |
cr->set_source_rgba(0.5, 0.44, 1.0, is_sensitive() ? 0.2 : 0.1); |
59 |
cr->fill(); |
60 |
} else { |
61 |
cr->set_line_width(3); |
62 |
cr->set_source_rgba(0.5, 0.44, 1.0, is_sensitive() ? 1.0 : 0.3); |
63 |
cr->stroke(); |
64 |
} |
65 |
} |
66 |
} |
67 |
return true; |
68 |
} |
69 |
|
70 |
|
71 |
CrossfadeCurve::CrossfadeCurve() : dimreg(0) { |
72 |
set_size_request(280, 80); |
73 |
} |
74 |
|
75 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
76 |
bool CrossfadeCurve::on_expose_event(GdkEventExpose* e) { |
77 |
const Cairo::RefPtr<Cairo::Context>& cr = |
78 |
get_window()->create_cairo_context(); |
79 |
#if 0 |
80 |
} |
81 |
#endif |
82 |
#else |
83 |
bool CrossfadeCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { |
84 |
#endif |
85 |
if (dimreg) { |
86 |
cr->translate(1.5, 0); |
87 |
|
88 |
// first, draw curves for the other layers |
89 |
gig::Region* region = dimreg->GetParent(); |
90 |
int dimregno; |
91 |
for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) { |
92 |
if (region->pDimensionRegions[dimregno] == dimreg) { |
93 |
break; |
94 |
} |
95 |
} |
96 |
int bitcount = 0; |
97 |
for (int dim = 0 ; dim < region->Dimensions ; dim++) { |
98 |
if (region->pDimensionDefinitions[dim].dimension == |
99 |
gig::dimension_layer) { |
100 |
int mask = |
101 |
~(((1 << region->pDimensionDefinitions[dim].bits) - 1) << |
102 |
bitcount); |
103 |
int c = dimregno & mask; // mask away the layer dimension |
104 |
|
105 |
for (int i = 0 ; i < region->pDimensionDefinitions[dim].zones ; |
106 |
i++) { |
107 |
gig::DimensionRegion* d = |
108 |
region->pDimensionRegions[c + (i << bitcount)]; |
109 |
if (d != dimreg) { |
110 |
draw_one_curve(cr, d, false); |
111 |
} |
112 |
} |
113 |
break; |
114 |
} |
115 |
bitcount += region->pDimensionDefinitions[dim].bits; |
116 |
} |
117 |
|
118 |
// then, draw the currently selected layer |
119 |
draw_one_curve(cr, dimreg, is_sensitive()); |
120 |
} |
121 |
return true; |
122 |
} |
123 |
|
124 |
void CrossfadeCurve::draw_one_curve(const Cairo::RefPtr<Cairo::Context>& cr, |
125 |
const gig::DimensionRegion* d, |
126 |
bool sensitive) { |
127 |
int w = get_width(); |
128 |
int h = get_height(); |
129 |
|
130 |
if (d->Crossfade.out_end) { |
131 |
for (int pass = 0 ; pass < 2 ; pass++) { |
132 |
cr->move_to(d->Crossfade.in_start / 127.0 * (w - 3), h); |
133 |
cr->line_to(d->Crossfade.in_end / 127.0 * (w - 3), 1.5); |
134 |
cr->line_to(d->Crossfade.out_start / 127.0 * (w - 3), 1.5); |
135 |
cr->line_to(d->Crossfade.out_end / 127.0 * (w - 3), h); |
136 |
|
137 |
if (pass == 0) { |
138 |
cr->set_source_rgba(0.5, 0.44, 1.0, sensitive ? 0.2 : 0.1); |
139 |
cr->fill(); |
140 |
} else { |
141 |
cr->set_line_width(3); |
142 |
cr->set_source_rgba(0.5, 0.44, 1.0, sensitive ? 1.0 : 0.3); |
143 |
cr->stroke(); |
144 |
} |
145 |
} |
146 |
} |
147 |
} |
148 |
|
149 |
|
150 |
DimRegionEdit::DimRegionEdit() : |
151 |
velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation), |
152 |
release_curve(&gig::DimensionRegion::GetVelocityRelease), |
153 |
cutoff_curve(&gig::DimensionRegion::GetVelocityCutoff), |
154 |
eEG1PreAttack(_("Pre-attack Level (%)"), 0, 100, 2), |
155 |
eEG1Attack(_("Attack Time (seconds)"), 0, 60, 3), |
156 |
eEG1Decay1(_("Decay 1 Time (seconds)"), 0.005, 60, 3), |
157 |
eEG1Decay2(_("Decay 2 Time (seconds)"), 0, 60, 3), |
158 |
eEG1InfiniteSustain(_("Infinite sustain")), |
159 |
eEG1Sustain(_("Sustain Level (%)"), 0, 100, 2), |
160 |
eEG1Release(_("Release Time (seconds)"), 0, 60, 3), |
161 |
eEG1Hold(_("Hold Attack Stage until Loop End")), |
162 |
eEG1Controller(_("Controller")), |
163 |
eEG1ControllerInvert(_("Controller invert")), |
164 |
eEG1ControllerAttackInfluence(_("Controller attack influence"), 0, 3), |
165 |
eEG1ControllerDecayInfluence(_("Controller decay influence"), 0, 3), |
166 |
eEG1ControllerReleaseInfluence(_("Controller release influence"), 0, 3), |
167 |
eLFO1Frequency(_("Frequency"), 0.1, 10, 2), |
168 |
eLFO1InternalDepth(_("Internal depth"), 0, 1200), |
169 |
eLFO1ControlDepth(_("Control depth"), 0, 1200), |
170 |
eLFO1Controller(_("Controller")), |
171 |
eLFO1FlipPhase(_("Flip phase")), |
172 |
eLFO1Sync(_("Sync")), |
173 |
eEG2PreAttack(_("Pre-attack Level (%)"), 0, 100, 2), |
174 |
eEG2Attack(_("Attack Time (seconds)"), 0, 60, 3), |
175 |
eEG2Decay1(_("Decay 1 Time (seconds)"), 0.005, 60, 3), |
176 |
eEG2Decay2(_("Decay 2 Time (seconds)"), 0, 60, 3), |
177 |
eEG2InfiniteSustain(_("Infinite sustain")), |
178 |
eEG2Sustain(_("Sustain Level (%)"), 0, 100, 2), |
179 |
eEG2Release(_("Release Time (seconds)"), 0, 60, 3), |
180 |
eEG2Controller(_("Controller")), |
181 |
eEG2ControllerInvert(_("Controller invert")), |
182 |
eEG2ControllerAttackInfluence(_("Controller attack influence"), 0, 3), |
183 |
eEG2ControllerDecayInfluence(_("Controller decay influence"), 0, 3), |
184 |
eEG2ControllerReleaseInfluence(_("Controller release influence"), 0, 3), |
185 |
eLFO2Frequency(_("Frequency"), 0.1, 10, 2), |
186 |
eLFO2InternalDepth(_("Internal depth"), 0, 1200), |
187 |
eLFO2ControlDepth(_("Control depth"), 0, 1200), |
188 |
eLFO2Controller(_("Controller")), |
189 |
eLFO2FlipPhase(_("Flip phase")), |
190 |
eLFO2Sync(_("Sync")), |
191 |
eEG3Attack(_("Attack"), 0, 10, 3), |
192 |
eEG3Depth(_("Depth"), -1200, 1200), |
193 |
eLFO3Frequency(_("Frequency"), 0.1, 10, 2), |
194 |
eLFO3InternalDepth(_("Internal depth"), 0, 1200), |
195 |
eLFO3ControlDepth(_("Control depth"), 0, 1200), |
196 |
eLFO3Controller(_("Controller")), |
197 |
eLFO3Sync(_("Sync")), |
198 |
eVCFEnabled(_("Enabled")), |
199 |
eVCFType(_("Type")), |
200 |
eVCFCutoffController(_("Cutoff controller")), |
201 |
eVCFCutoffControllerInvert(_("Cutoff controller invert")), |
202 |
eVCFCutoff(_("Cutoff")), |
203 |
eVCFVelocityCurve(_("Velocity curve")), |
204 |
eVCFVelocityScale(_("Velocity scale")), |
205 |
eVCFVelocityDynamicRange(_("Velocity dynamic range"), 0, 4), |
206 |
eVCFResonance(_("Resonance")), |
207 |
eVCFResonanceDynamic(_("Resonance dynamic")), |
208 |
eVCFResonanceController(_("Resonance controller")), |
209 |
eVCFKeyboardTracking(_("Keyboard tracking")), |
210 |
eVCFKeyboardTrackingBreakpoint(_("Keyboard tracking breakpoint")), |
211 |
eVelocityResponseCurve(_("Velocity response curve")), |
212 |
eVelocityResponseDepth(_("Velocity response depth"), 0, 4), |
213 |
eVelocityResponseCurveScaling(_("Velocity response curve scaling")), |
214 |
eReleaseVelocityResponseCurve(_("Release velocity response curve")), |
215 |
eReleaseVelocityResponseDepth(_("Release velocity response depth"), 0, 4), |
216 |
eReleaseTriggerDecay(_("Release trigger decay"), 0, 8), |
217 |
eCrossfade_in_start(_("Crossfade-in start")), |
218 |
eCrossfade_in_end(_("Crossfade-in end")), |
219 |
eCrossfade_out_start(_("Crossfade-out start")), |
220 |
eCrossfade_out_end(_("Crossfade-out end")), |
221 |
ePitchTrack(_("Pitch track")), |
222 |
eDimensionBypass(_("Dimension bypass")), |
223 |
ePan(_("Pan"), -64, 63), |
224 |
eSelfMask(_("Kill lower velocity voices (a.k.a \"Self mask\")")), |
225 |
eAttenuationController(_("Attenuation controller")), |
226 |
eInvertAttenuationController(_("Invert attenuation controller")), |
227 |
eAttenuationControllerThreshold(_("Attenuation controller threshold")), |
228 |
eChannelOffset(_("Channel offset"), 0, 9), |
229 |
eSustainDefeat(_("Ignore Hold Pedal (a.k.a. \"Sustain defeat\")")), |
230 |
eMSDecode(_("Decode Mid/Side Recordings")), |
231 |
eSampleStartOffset(_("Sample start offset"), 0, 2000), |
232 |
eUnityNote(_("Unity note")), |
233 |
eSampleFormatInfo(_("Sample Format")), |
234 |
eSampleID("Sample ID"), |
235 |
eFineTune(_("Fine tune"), -49, 50), |
236 |
eGain(_("Gain"), -96, 0, 2, -655360), |
237 |
eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360), |
238 |
eSampleLoopEnabled(_("Enabled")), |
239 |
eSampleLoopStart(_("Loop start positon")), |
240 |
eSampleLoopLength(_("Loop size")), |
241 |
eSampleLoopType(_("Loop type")), |
242 |
eSampleLoopInfinite(_("Infinite loop")), |
243 |
eSampleLoopPlayCount(_("Playback count"), 1), |
244 |
buttonSelectSample(UNICODE_LEFT_ARROW + " " + _("Select Sample")), |
245 |
update_model(0) |
246 |
{ |
247 |
// make synthesis parameter page tabs scrollable |
248 |
// (workaround for GTK3: default theme uses huge tabs which breaks layout) |
249 |
set_scrollable(); |
250 |
|
251 |
connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack); |
252 |
connect(eEG1Attack, &gig::DimensionRegion::EG1Attack); |
253 |
connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1); |
254 |
connect(eEG1Decay2, &gig::DimensionRegion::EG1Decay2); |
255 |
connect(eEG1InfiniteSustain, &gig::DimensionRegion::EG1InfiniteSustain); |
256 |
connect(eEG1Sustain, &gig::DimensionRegion::EG1Sustain); |
257 |
connect(eEG1Release, &gig::DimensionRegion::EG1Release); |
258 |
connect(eEG1Hold, &gig::DimensionRegion::EG1Hold); |
259 |
connect(eEG1Controller, &gig::DimensionRegion::EG1Controller); |
260 |
connect(eEG1ControllerInvert, &gig::DimensionRegion::EG1ControllerInvert); |
261 |
connect(eEG1ControllerAttackInfluence, |
262 |
&gig::DimensionRegion::EG1ControllerAttackInfluence); |
263 |
connect(eEG1ControllerDecayInfluence, |
264 |
&gig::DimensionRegion::EG1ControllerDecayInfluence); |
265 |
connect(eEG1ControllerReleaseInfluence, |
266 |
&gig::DimensionRegion::EG1ControllerReleaseInfluence); |
267 |
connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency); |
268 |
connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth); |
269 |
connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth); |
270 |
connect(eLFO1Controller, &gig::DimensionRegion::LFO1Controller); |
271 |
connect(eLFO1FlipPhase, &gig::DimensionRegion::LFO1FlipPhase); |
272 |
connect(eLFO1Sync, &gig::DimensionRegion::LFO1Sync); |
273 |
connect(eEG2PreAttack, &gig::DimensionRegion::EG2PreAttack); |
274 |
connect(eEG2Attack, &gig::DimensionRegion::EG2Attack); |
275 |
connect(eEG2Decay1, &gig::DimensionRegion::EG2Decay1); |
276 |
connect(eEG2Decay2, &gig::DimensionRegion::EG2Decay2); |
277 |
connect(eEG2InfiniteSustain, &gig::DimensionRegion::EG2InfiniteSustain); |
278 |
connect(eEG2Sustain, &gig::DimensionRegion::EG2Sustain); |
279 |
connect(eEG2Release, &gig::DimensionRegion::EG2Release); |
280 |
connect(eEG2Controller, &gig::DimensionRegion::EG2Controller); |
281 |
connect(eEG2ControllerInvert, &gig::DimensionRegion::EG2ControllerInvert); |
282 |
connect(eEG2ControllerAttackInfluence, |
283 |
&gig::DimensionRegion::EG2ControllerAttackInfluence); |
284 |
connect(eEG2ControllerDecayInfluence, |
285 |
&gig::DimensionRegion::EG2ControllerDecayInfluence); |
286 |
connect(eEG2ControllerReleaseInfluence, |
287 |
&gig::DimensionRegion::EG2ControllerReleaseInfluence); |
288 |
connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency); |
289 |
connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth); |
290 |
connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth); |
291 |
connect(eLFO2Controller, &gig::DimensionRegion::LFO2Controller); |
292 |
connect(eLFO2FlipPhase, &gig::DimensionRegion::LFO2FlipPhase); |
293 |
connect(eLFO2Sync, &gig::DimensionRegion::LFO2Sync); |
294 |
connect(eEG3Attack, &gig::DimensionRegion::EG3Attack); |
295 |
connect(eEG3Depth, &gig::DimensionRegion::EG3Depth); |
296 |
connect(eLFO3Frequency, &gig::DimensionRegion::LFO3Frequency); |
297 |
connect(eLFO3InternalDepth, &gig::DimensionRegion::LFO3InternalDepth); |
298 |
connect(eLFO3ControlDepth, &gig::DimensionRegion::LFO3ControlDepth); |
299 |
connect(eLFO3Controller, &gig::DimensionRegion::LFO3Controller); |
300 |
connect(eLFO3Sync, &gig::DimensionRegion::LFO3Sync); |
301 |
connect(eVCFEnabled, &gig::DimensionRegion::VCFEnabled); |
302 |
connect(eVCFType, &gig::DimensionRegion::VCFType); |
303 |
connect(eVCFCutoffController, |
304 |
&gig::DimensionRegion::SetVCFCutoffController); |
305 |
connect(eVCFCutoffControllerInvert, |
306 |
&gig::DimensionRegion::VCFCutoffControllerInvert); |
307 |
connect(eVCFCutoff, &gig::DimensionRegion::VCFCutoff); |
308 |
connect(eVCFVelocityCurve, &gig::DimensionRegion::SetVCFVelocityCurve); |
309 |
connect(eVCFVelocityScale, &gig::DimensionRegion::SetVCFVelocityScale); |
310 |
connect(eVCFVelocityDynamicRange, |
311 |
&gig::DimensionRegion::SetVCFVelocityDynamicRange); |
312 |
connect(eVCFResonance, &gig::DimensionRegion::VCFResonance); |
313 |
connect(eVCFResonanceDynamic, &gig::DimensionRegion::VCFResonanceDynamic); |
314 |
connect(eVCFResonanceController, |
315 |
&gig::DimensionRegion::VCFResonanceController); |
316 |
connect(eVCFKeyboardTracking, &gig::DimensionRegion::VCFKeyboardTracking); |
317 |
connect(eVCFKeyboardTrackingBreakpoint, |
318 |
&gig::DimensionRegion::VCFKeyboardTrackingBreakpoint); |
319 |
connect(eVelocityResponseCurve, |
320 |
&gig::DimensionRegion::SetVelocityResponseCurve); |
321 |
connect(eVelocityResponseDepth, |
322 |
&gig::DimensionRegion::SetVelocityResponseDepth); |
323 |
connect(eVelocityResponseCurveScaling, |
324 |
&gig::DimensionRegion::SetVelocityResponseCurveScaling); |
325 |
connect(eReleaseVelocityResponseCurve, |
326 |
&gig::DimensionRegion::SetReleaseVelocityResponseCurve); |
327 |
connect(eReleaseVelocityResponseDepth, |
328 |
&gig::DimensionRegion::SetReleaseVelocityResponseDepth); |
329 |
connect(eReleaseTriggerDecay, &gig::DimensionRegion::ReleaseTriggerDecay); |
330 |
connect(eCrossfade_in_start, &DimRegionEdit::set_Crossfade_in_start); |
331 |
connect(eCrossfade_in_end, &DimRegionEdit::set_Crossfade_in_end); |
332 |
connect(eCrossfade_out_start, &DimRegionEdit::set_Crossfade_out_start); |
333 |
connect(eCrossfade_out_end, &DimRegionEdit::set_Crossfade_out_end); |
334 |
connect(ePitchTrack, &gig::DimensionRegion::PitchTrack); |
335 |
connect(eDimensionBypass, &gig::DimensionRegion::DimensionBypass); |
336 |
connect(ePan, &gig::DimensionRegion::Pan); |
337 |
connect(eSelfMask, &gig::DimensionRegion::SelfMask); |
338 |
connect(eAttenuationController, |
339 |
&gig::DimensionRegion::AttenuationController); |
340 |
connect(eInvertAttenuationController, |
341 |
&gig::DimensionRegion::InvertAttenuationController); |
342 |
connect(eAttenuationControllerThreshold, |
343 |
&gig::DimensionRegion::AttenuationControllerThreshold); |
344 |
connect(eChannelOffset, &gig::DimensionRegion::ChannelOffset); |
345 |
connect(eSustainDefeat, &gig::DimensionRegion::SustainDefeat); |
346 |
connect(eMSDecode, &gig::DimensionRegion::MSDecode); |
347 |
connect(eSampleStartOffset, &gig::DimensionRegion::SampleStartOffset); |
348 |
connect(eUnityNote, &DimRegionEdit::set_UnityNote); |
349 |
connect(eFineTune, &DimRegionEdit::set_FineTune); |
350 |
connect(eGain, &DimRegionEdit::set_Gain); |
351 |
connect(eGainPlus6, &DimRegionEdit::set_Gain); |
352 |
connect(eSampleLoopEnabled, &DimRegionEdit::set_LoopEnabled); |
353 |
connect(eSampleLoopType, &DimRegionEdit::set_LoopType); |
354 |
connect(eSampleLoopStart, &DimRegionEdit::set_LoopStart); |
355 |
connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength); |
356 |
connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite); |
357 |
connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount); |
358 |
buttonSelectSample.signal_clicked().connect( |
359 |
sigc::mem_fun(*this, &DimRegionEdit::onButtonSelectSamplePressed) |
360 |
); |
361 |
|
362 |
for (int i = 0 ; i < 7 ; i++) { |
363 |
table[i] = new Gtk::Table(3, 1); |
364 |
table[i]->set_col_spacings(7); |
365 |
} |
366 |
|
367 |
// set tooltips |
368 |
eUnityNote.set_tip( |
369 |
_("Note this sample is associated with (a.k.a. 'root note')") |
370 |
); |
371 |
buttonSelectSample.set_tooltip_text( |
372 |
_("Selects the sample of this dimension region on the left hand side's sample tree view.") |
373 |
); |
374 |
eSampleStartOffset.set_tip(_("Sample position at which playback should be started")); |
375 |
ePan.set_tip(_("Stereo balance (left/right)")); |
376 |
eChannelOffset.set_tip( |
377 |
_("Output channel where the audio signal should be routed to (0 - 9)") |
378 |
); |
379 |
ePitchTrack.set_tip( |
380 |
_("If true: sample will be pitched according to the key position " |
381 |
"(this would be disabled for drums for example)") |
382 |
); |
383 |
eSampleLoopEnabled.set_tip(_("If enabled: repeats to playback the sample")); |
384 |
eSampleLoopStart.set_tip( |
385 |
_("Start position within the sample (in sample points) of the area to " |
386 |
"be looped") |
387 |
); |
388 |
eSampleLoopLength.set_tip( |
389 |
_("Duration (in sample points) of the area to be looped") |
390 |
); |
391 |
eSampleLoopType.set_tip( |
392 |
_("Direction in which the loop area in the sample should be played back") |
393 |
); |
394 |
eSampleLoopInfinite.set_tip( |
395 |
_("Whether the loop area should be played back forever\n" |
396 |
"Caution: this setting is stored on Sample side, thus is shared " |
397 |
"among all dimension regions that use this sample!") |
398 |
); |
399 |
eSampleLoopPlayCount.set_tip( |
400 |
_("How many times the loop area should be played back\n" |
401 |
"Caution: this setting is stored on Sample side, thus is shared " |
402 |
"among all dimension regions that use this sample!") |
403 |
); |
404 |
|
405 |
eEG1PreAttack.set_tip( |
406 |
"Very first level this EG starts with. It rises then in Attack Time " |
407 |
"seconds from this initial level to 100%." |
408 |
); |
409 |
eEG1Attack.set_tip( |
410 |
"Duration of the EG's Attack stage, which raises its level from " |
411 |
"Pre-Attack Level to 100%." |
412 |
); |
413 |
eEG1Hold.set_tip( |
414 |
"On looped sounds, enabling this will cause the Decay 1 stage not to " |
415 |
"enter before the loop has been passed one time." |
416 |
); |
417 |
eAttenuationController.set_tip(_( |
418 |
"If you are not using the 'Layer' dimension, then this controller " |
419 |
"simply alters the volume. If you are using the 'Layer' dimension, " |
420 |
"then this controller is controlling the crossfade between Layers in " |
421 |
"real-time." |
422 |
)); |
423 |
|
424 |
eLFO1Sync.set_tip( |
425 |
"If not checked, every voice will use its own LFO instance, which " |
426 |
"causes voices triggered at different points in time to have different " |
427 |
"LFO levels. By enabling 'Sync' here the voices will instead use and " |
428 |
"share one single LFO, causing all voices to have the same LFO level, " |
429 |
"no matter when the individual notes have been triggered." |
430 |
); |
431 |
eLFO2Sync.set_tip( |
432 |
"If not checked, every voice will use its own LFO instance, which " |
433 |
"causes voices triggered at different points in time to have different " |
434 |
"LFO levels. By enabling 'Sync' here the voices will instead use and " |
435 |
"share one single LFO, causing all voices to have the same LFO level, " |
436 |
"no matter when the individual notes have been triggered." |
437 |
); |
438 |
eLFO3Sync.set_tip( |
439 |
"If not checked, every voice will use its own LFO instance, which " |
440 |
"causes voices triggered at different points in time to have different " |
441 |
"LFO levels. By enabling 'Sync' here the voices will instead use and " |
442 |
"share one single LFO, causing all voices to have the same LFO level, " |
443 |
"no matter when the individual notes have been triggered." |
444 |
); |
445 |
eLFO1FlipPhase.set_tip( |
446 |
"Inverts the LFO's generated wave vertically." |
447 |
); |
448 |
eLFO2FlipPhase.set_tip( |
449 |
"Inverts the LFO's generated wave vertically." |
450 |
); |
451 |
|
452 |
pageno = 0; |
453 |
rowno = 0; |
454 |
firstRowInBlock = 0; |
455 |
|
456 |
addHeader(_("Mandatory Settings")); |
457 |
addString(_("Sample"), lSample, wSample, buttonNullSampleReference); |
458 |
buttonNullSampleReference->set_label("X"); |
459 |
buttonNullSampleReference->set_tooltip_text(_("Remove current sample reference (NULL reference). This can be used to define a \"silent\" case where no sample shall be played.")); |
460 |
buttonNullSampleReference->signal_clicked().connect( |
461 |
sigc::mem_fun(*this, &DimRegionEdit::nullOutSampleReference) |
462 |
); |
463 |
//TODO: the following would break drag&drop: wSample->property_editable().set_value(false); or this: wSample->set_editable(false); |
464 |
#ifdef OLD_TOOLTIPS |
465 |
tooltips.set_tip(*wSample, _("Drag & drop a sample here")); |
466 |
#else |
467 |
wSample->set_tooltip_text(_("Drag & drop a sample here")); |
468 |
#endif |
469 |
addProp(eUnityNote); |
470 |
addProp(eSampleFormatInfo); |
471 |
addProp(eSampleID); |
472 |
addRightHandSide(buttonSelectSample); |
473 |
addHeader(_("Optional Settings")); |
474 |
addProp(eSampleStartOffset); |
475 |
addProp(eChannelOffset); |
476 |
addHeader(_("Loops")); |
477 |
addProp(eSampleLoopEnabled); |
478 |
addProp(eSampleLoopStart); |
479 |
addProp(eSampleLoopLength); |
480 |
{ |
481 |
const char* choices[] = { _("normal"), _("bidirectional"), _("backward"), 0 }; |
482 |
static const uint32_t values[] = { |
483 |
gig::loop_type_normal, |
484 |
gig::loop_type_bidirectional, |
485 |
gig::loop_type_backward |
486 |
}; |
487 |
eSampleLoopType.set_choices(choices, values); |
488 |
} |
489 |
addProp(eSampleLoopType); |
490 |
addProp(eSampleLoopInfinite); |
491 |
addProp(eSampleLoopPlayCount); |
492 |
|
493 |
nextPage(); |
494 |
|
495 |
addHeader(_("General Amplitude Settings")); |
496 |
addProp(eGain); |
497 |
addProp(eGainPlus6); |
498 |
addProp(ePan); |
499 |
addHeader(_("Amplitude Envelope (EG1)")); |
500 |
addProp(eEG1PreAttack); |
501 |
addProp(eEG1Attack); |
502 |
addProp(eEG1Hold); |
503 |
addProp(eEG1Decay1); |
504 |
addProp(eEG1Decay2); |
505 |
addProp(eEG1InfiniteSustain); |
506 |
addProp(eEG1Sustain); |
507 |
addProp(eEG1Release); |
508 |
addProp(eEG1Controller); |
509 |
addProp(eEG1ControllerInvert); |
510 |
addProp(eEG1ControllerAttackInfluence); |
511 |
addProp(eEG1ControllerDecayInfluence); |
512 |
addProp(eEG1ControllerReleaseInfluence); |
513 |
|
514 |
nextPage(); |
515 |
|
516 |
addHeader(_("Amplitude Oscillator (LFO1)")); |
517 |
addProp(eLFO1Frequency); |
518 |
addProp(eLFO1InternalDepth); |
519 |
addProp(eLFO1ControlDepth); |
520 |
{ |
521 |
const char* choices[] = { _("internal"), _("modwheel"), _("breath"), |
522 |
_("internal+modwheel"), _("internal+breath"), 0 }; |
523 |
static const gig::lfo1_ctrl_t values[] = { |
524 |
gig::lfo1_ctrl_internal, |
525 |
gig::lfo1_ctrl_modwheel, |
526 |
gig::lfo1_ctrl_breath, |
527 |
gig::lfo1_ctrl_internal_modwheel, |
528 |
gig::lfo1_ctrl_internal_breath |
529 |
}; |
530 |
eLFO1Controller.set_choices(choices, values); |
531 |
} |
532 |
addProp(eLFO1Controller); |
533 |
addProp(eLFO1FlipPhase); |
534 |
addProp(eLFO1Sync); |
535 |
addHeader(_("Crossfade")); |
536 |
addProp(eAttenuationController); |
537 |
addProp(eInvertAttenuationController); |
538 |
addProp(eAttenuationControllerThreshold); |
539 |
addProp(eCrossfade_in_start); |
540 |
addProp(eCrossfade_in_end); |
541 |
addProp(eCrossfade_out_start); |
542 |
addProp(eCrossfade_out_end); |
543 |
|
544 |
Gtk::Frame* frame = new Gtk::Frame; |
545 |
frame->add(crossfade_curve); |
546 |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
547 |
Gtk::SHRINK, Gtk::SHRINK); |
548 |
rowno++; |
549 |
|
550 |
eCrossfade_in_start.signal_value_changed().connect( |
551 |
sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw)); |
552 |
eCrossfade_in_end.signal_value_changed().connect( |
553 |
sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw)); |
554 |
eCrossfade_out_start.signal_value_changed().connect( |
555 |
sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw)); |
556 |
eCrossfade_out_end.signal_value_changed().connect( |
557 |
sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw)); |
558 |
|
559 |
nextPage(); |
560 |
|
561 |
addHeader(_("General Filter Settings")); |
562 |
addProp(eVCFEnabled); |
563 |
{ |
564 |
const char* choices[] = { _("lowpass"), _("lowpassturbo"), _("bandpass"), |
565 |
_("highpass"), _("bandreject"), 0 }; |
566 |
static const gig::vcf_type_t values[] = { |
567 |
gig::vcf_type_lowpass, |
568 |
gig::vcf_type_lowpassturbo, |
569 |
gig::vcf_type_bandpass, |
570 |
gig::vcf_type_highpass, |
571 |
gig::vcf_type_bandreject |
572 |
}; |
573 |
eVCFType.set_choices(choices, values); |
574 |
} |
575 |
addProp(eVCFType); |
576 |
{ |
577 |
const char* choices[] = { _("none"), _("none2"), _("modwheel"), _("effect1"), _("effect2"), |
578 |
_("breath"), _("foot"), _("sustainpedal"), _("softpedal"), |
579 |
_("genpurpose7"), _("genpurpose8"), _("aftertouch"), 0 }; |
580 |
static const gig::vcf_cutoff_ctrl_t values[] = { |
581 |
gig::vcf_cutoff_ctrl_none, |
582 |
gig::vcf_cutoff_ctrl_none2, |
583 |
gig::vcf_cutoff_ctrl_modwheel, |
584 |
gig::vcf_cutoff_ctrl_effect1, |
585 |
gig::vcf_cutoff_ctrl_effect2, |
586 |
gig::vcf_cutoff_ctrl_breath, |
587 |
gig::vcf_cutoff_ctrl_foot, |
588 |
gig::vcf_cutoff_ctrl_sustainpedal, |
589 |
gig::vcf_cutoff_ctrl_softpedal, |
590 |
gig::vcf_cutoff_ctrl_genpurpose7, |
591 |
gig::vcf_cutoff_ctrl_genpurpose8, |
592 |
gig::vcf_cutoff_ctrl_aftertouch |
593 |
}; |
594 |
eVCFCutoffController.set_choices(choices, values); |
595 |
} |
596 |
addProp(eVCFCutoffController); |
597 |
addProp(eVCFCutoffControllerInvert); |
598 |
addProp(eVCFCutoff); |
599 |
const char* curve_type_texts[] = { _("nonlinear"), _("linear"), _("special"), 0 }; |
600 |
static const gig::curve_type_t curve_type_values[] = { |
601 |
gig::curve_type_nonlinear, |
602 |
gig::curve_type_linear, |
603 |
gig::curve_type_special |
604 |
}; |
605 |
eVCFVelocityCurve.set_choices(curve_type_texts, curve_type_values); |
606 |
addProp(eVCFVelocityCurve); |
607 |
addProp(eVCFVelocityScale); |
608 |
addProp(eVCFVelocityDynamicRange); |
609 |
|
610 |
eVCFCutoffController.signal_value_changed().connect( |
611 |
sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw)); |
612 |
eVCFVelocityCurve.signal_value_changed().connect( |
613 |
sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw)); |
614 |
eVCFVelocityScale.signal_value_changed().connect( |
615 |
sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw)); |
616 |
eVCFVelocityDynamicRange.signal_value_changed().connect( |
617 |
sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw)); |
618 |
|
619 |
frame = new Gtk::Frame; |
620 |
frame->add(cutoff_curve); |
621 |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
622 |
Gtk::SHRINK, Gtk::SHRINK); |
623 |
rowno++; |
624 |
|
625 |
addProp(eVCFResonance); |
626 |
addProp(eVCFResonanceDynamic); |
627 |
{ |
628 |
const char* choices[] = { _("none"), _("genpurpose3"), _("genpurpose4"), |
629 |
_("genpurpose5"), _("genpurpose6"), 0 }; |
630 |
static const gig::vcf_res_ctrl_t values[] = { |
631 |
gig::vcf_res_ctrl_none, |
632 |
gig::vcf_res_ctrl_genpurpose3, |
633 |
gig::vcf_res_ctrl_genpurpose4, |
634 |
gig::vcf_res_ctrl_genpurpose5, |
635 |
gig::vcf_res_ctrl_genpurpose6 |
636 |
}; |
637 |
eVCFResonanceController.set_choices(choices, values); |
638 |
} |
639 |
addProp(eVCFResonanceController); |
640 |
addProp(eVCFKeyboardTracking); |
641 |
addProp(eVCFKeyboardTrackingBreakpoint); |
642 |
|
643 |
nextPage(); |
644 |
|
645 |
lEG2 = addHeader(_("Filter Cutoff Envelope (EG2)")); |
646 |
addProp(eEG2PreAttack); |
647 |
addProp(eEG2Attack); |
648 |
addProp(eEG2Decay1); |
649 |
addProp(eEG2Decay2); |
650 |
addProp(eEG2InfiniteSustain); |
651 |
addProp(eEG2Sustain); |
652 |
addProp(eEG2Release); |
653 |
addProp(eEG2Controller); |
654 |
addProp(eEG2ControllerInvert); |
655 |
addProp(eEG2ControllerAttackInfluence); |
656 |
addProp(eEG2ControllerDecayInfluence); |
657 |
addProp(eEG2ControllerReleaseInfluence); |
658 |
lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)")); |
659 |
addProp(eLFO2Frequency); |
660 |
addProp(eLFO2InternalDepth); |
661 |
addProp(eLFO2ControlDepth); |
662 |
{ |
663 |
const char* choices[] = { _("internal"), _("modwheel"), _("foot"), |
664 |
_("internal+modwheel"), _("internal+foot"), 0 }; |
665 |
static const gig::lfo2_ctrl_t values[] = { |
666 |
gig::lfo2_ctrl_internal, |
667 |
gig::lfo2_ctrl_modwheel, |
668 |
gig::lfo2_ctrl_foot, |
669 |
gig::lfo2_ctrl_internal_modwheel, |
670 |
gig::lfo2_ctrl_internal_foot |
671 |
}; |
672 |
eLFO2Controller.set_choices(choices, values); |
673 |
} |
674 |
addProp(eLFO2Controller); |
675 |
addProp(eLFO2FlipPhase); |
676 |
addProp(eLFO2Sync); |
677 |
|
678 |
nextPage(); |
679 |
|
680 |
addHeader(_("General Pitch Settings")); |
681 |
addProp(eFineTune); |
682 |
addProp(ePitchTrack); |
683 |
addHeader(_("Pitch Envelope (EG3)")); |
684 |
addProp(eEG3Attack); |
685 |
addProp(eEG3Depth); |
686 |
addHeader(_("Pitch Oscillator (LFO3)")); |
687 |
addProp(eLFO3Frequency); |
688 |
addProp(eLFO3InternalDepth); |
689 |
addProp(eLFO3ControlDepth); |
690 |
{ |
691 |
const char* choices[] = { _("internal"), _("modwheel"), _("aftertouch"), |
692 |
_("internal+modwheel"), _("internal+aftertouch"), 0 }; |
693 |
static const gig::lfo3_ctrl_t values[] = { |
694 |
gig::lfo3_ctrl_internal, |
695 |
gig::lfo3_ctrl_modwheel, |
696 |
gig::lfo3_ctrl_aftertouch, |
697 |
gig::lfo3_ctrl_internal_modwheel, |
698 |
gig::lfo3_ctrl_internal_aftertouch |
699 |
}; |
700 |
eLFO3Controller.set_choices(choices, values); |
701 |
} |
702 |
addProp(eLFO3Controller); |
703 |
addProp(eLFO3Sync); |
704 |
|
705 |
nextPage(); |
706 |
|
707 |
addHeader(_("Velocity Response")); |
708 |
eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values); |
709 |
addProp(eVelocityResponseCurve); |
710 |
addProp(eVelocityResponseDepth); |
711 |
addProp(eVelocityResponseCurveScaling); |
712 |
|
713 |
eVelocityResponseCurve.signal_value_changed().connect( |
714 |
sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw)); |
715 |
eVelocityResponseDepth.signal_value_changed().connect( |
716 |
sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw)); |
717 |
eVelocityResponseCurveScaling.signal_value_changed().connect( |
718 |
sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw)); |
719 |
|
720 |
frame = new Gtk::Frame; |
721 |
frame->add(velocity_curve); |
722 |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
723 |
Gtk::SHRINK, Gtk::SHRINK); |
724 |
rowno++; |
725 |
|
726 |
addHeader(_("Release Velocity Response")); |
727 |
eReleaseVelocityResponseCurve.set_choices(curve_type_texts, |
728 |
curve_type_values); |
729 |
addProp(eReleaseVelocityResponseCurve); |
730 |
addProp(eReleaseVelocityResponseDepth); |
731 |
|
732 |
eReleaseVelocityResponseCurve.signal_value_changed().connect( |
733 |
sigc::mem_fun(release_curve, &VelocityCurve::queue_draw)); |
734 |
eReleaseVelocityResponseDepth.signal_value_changed().connect( |
735 |
sigc::mem_fun(release_curve, &VelocityCurve::queue_draw)); |
736 |
frame = new Gtk::Frame; |
737 |
frame->add(release_curve); |
738 |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
739 |
Gtk::SHRINK, Gtk::SHRINK); |
740 |
rowno++; |
741 |
|
742 |
addProp(eReleaseTriggerDecay); |
743 |
{ |
744 |
const char* choices[] = { _("none"), _("effect4depth"), _("effect5depth"), 0 }; |
745 |
static const gig::dim_bypass_ctrl_t values[] = { |
746 |
gig::dim_bypass_ctrl_none, |
747 |
gig::dim_bypass_ctrl_94, |
748 |
gig::dim_bypass_ctrl_95 |
749 |
}; |
750 |
eDimensionBypass.set_choices(choices, values); |
751 |
} |
752 |
addProp(eDimensionBypass); |
753 |
eSelfMask.widget.set_tooltip_text(_( |
754 |
"If enabled: new notes with higher velocity value will stop older " |
755 |
"notes with lower velocity values, that way you can save voices that " |
756 |
"would barely be audible. This is also useful for certain drum sounds." |
757 |
)); |
758 |
addProp(eSelfMask); |
759 |
eSustainDefeat.widget.set_tooltip_text(_( |
760 |
"If enabled: sustain pedal will not hold a note. This way you can use " |
761 |
"the sustain pedal for other purposes, for example to switch among " |
762 |
"dimension regions." |
763 |
)); |
764 |
addProp(eSustainDefeat); |
765 |
eMSDecode.widget.set_tooltip_text(_( |
766 |
"Defines if Mid/Side Recordings should be decoded. Mid/Side Recordings " |
767 |
"are an alternative way to record sounds in stereo. The sampler needs " |
768 |
"to decode such samples to actually make use of them. Note: this " |
769 |
"feature is currently not supported by LinuxSampler." |
770 |
)); |
771 |
addProp(eMSDecode); |
772 |
|
773 |
nextPage(); |
774 |
|
775 |
|
776 |
eEG1InfiniteSustain.signal_value_changed().connect( |
777 |
sigc::mem_fun(*this, &DimRegionEdit::EG1InfiniteSustain_toggled)); |
778 |
eEG2InfiniteSustain.signal_value_changed().connect( |
779 |
sigc::mem_fun(*this, &DimRegionEdit::EG2InfiniteSustain_toggled)); |
780 |
eEG1Controller.signal_value_changed().connect( |
781 |
sigc::mem_fun(*this, &DimRegionEdit::EG1Controller_changed)); |
782 |
eEG2Controller.signal_value_changed().connect( |
783 |
sigc::mem_fun(*this, &DimRegionEdit::EG2Controller_changed)); |
784 |
eLFO1Controller.signal_value_changed().connect( |
785 |
sigc::mem_fun(*this, &DimRegionEdit::LFO1Controller_changed)); |
786 |
eLFO2Controller.signal_value_changed().connect( |
787 |
sigc::mem_fun(*this, &DimRegionEdit::LFO2Controller_changed)); |
788 |
eLFO3Controller.signal_value_changed().connect( |
789 |
sigc::mem_fun(*this, &DimRegionEdit::LFO3Controller_changed)); |
790 |
eAttenuationController.signal_value_changed().connect( |
791 |
sigc::mem_fun(*this, &DimRegionEdit::AttenuationController_changed)); |
792 |
eVCFEnabled.signal_value_changed().connect( |
793 |
sigc::mem_fun(*this, &DimRegionEdit::VCFEnabled_toggled)); |
794 |
eVCFCutoffController.signal_value_changed().connect( |
795 |
sigc::mem_fun(*this, &DimRegionEdit::VCFCutoffController_changed)); |
796 |
eVCFResonanceController.signal_value_changed().connect( |
797 |
sigc::mem_fun(*this, &DimRegionEdit::VCFResonanceController_changed)); |
798 |
|
799 |
eCrossfade_in_start.signal_value_changed().connect( |
800 |
sigc::mem_fun(*this, &DimRegionEdit::crossfade1_changed)); |
801 |
eCrossfade_in_end.signal_value_changed().connect( |
802 |
sigc::mem_fun(*this, &DimRegionEdit::crossfade2_changed)); |
803 |
eCrossfade_out_start.signal_value_changed().connect( |
804 |
sigc::mem_fun(*this, &DimRegionEdit::crossfade3_changed)); |
805 |
eCrossfade_out_end.signal_value_changed().connect( |
806 |
sigc::mem_fun(*this, &DimRegionEdit::crossfade4_changed)); |
807 |
|
808 |
eSampleLoopEnabled.signal_value_changed().connect( |
809 |
sigc::mem_fun(*this, &DimRegionEdit::update_loop_elements)); |
810 |
eSampleLoopStart.signal_value_changed().connect( |
811 |
sigc::mem_fun(*this, &DimRegionEdit::loop_start_changed)); |
812 |
eSampleLoopLength.signal_value_changed().connect( |
813 |
sigc::mem_fun(*this, &DimRegionEdit::loop_length_changed)); |
814 |
eSampleLoopInfinite.signal_value_changed().connect( |
815 |
sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled)); |
816 |
|
817 |
append_page(*table[0], _("Sample")); |
818 |
append_page(*table[1], _("Amplitude (1)")); |
819 |
append_page(*table[2], _("Amplitude (2)")); |
820 |
append_page(*table[3], _("Filter (1)")); |
821 |
append_page(*table[4], _("Filter (2)")); |
822 |
append_page(*table[5], _("Pitch")); |
823 |
append_page(*table[6], _("Misc")); |
824 |
} |
825 |
|
826 |
DimRegionEdit::~DimRegionEdit() |
827 |
{ |
828 |
} |
829 |
|
830 |
void DimRegionEdit::addString(const char* labelText, Gtk::Label*& label, |
831 |
Gtk::Entry*& widget) |
832 |
{ |
833 |
label = new Gtk::Label(Glib::ustring(labelText) + ":"); |
834 |
label->set_alignment(Gtk::ALIGN_START); |
835 |
|
836 |
table[pageno]->attach(*label, 1, 2, rowno, rowno + 1, |
837 |
Gtk::FILL, Gtk::SHRINK); |
838 |
|
839 |
widget = new Gtk::Entry(); |
840 |
|
841 |
table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1, |
842 |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
843 |
|
844 |
rowno++; |
845 |
} |
846 |
|
847 |
void DimRegionEdit::addString(const char* labelText, Gtk::Label*& label, |
848 |
Gtk::Entry*& widget, Gtk::Button*& button) |
849 |
{ |
850 |
label = new Gtk::Label(Glib::ustring(labelText) + ":"); |
851 |
label->set_alignment(Gtk::ALIGN_START); |
852 |
|
853 |
table[pageno]->attach(*label, 1, 2, rowno, rowno + 1, |
854 |
Gtk::FILL, Gtk::SHRINK); |
855 |
|
856 |
widget = new Gtk::Entry(); |
857 |
button = new Gtk::Button(); |
858 |
|
859 |
Gtk::HBox* hbox = new Gtk::HBox; |
860 |
hbox->pack_start(*widget); |
861 |
hbox->pack_start(*button, Gtk::PACK_SHRINK); |
862 |
|
863 |
table[pageno]->attach(*hbox, 2, 3, rowno, rowno + 1, |
864 |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
865 |
|
866 |
rowno++; |
867 |
} |
868 |
|
869 |
Gtk::Label* DimRegionEdit::addHeader(const char* text) |
870 |
{ |
871 |
if (firstRowInBlock < rowno - 1) |
872 |
{ |
873 |
Gtk::Label* filler = new Gtk::Label(" "); |
874 |
table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno, |
875 |
Gtk::FILL, Gtk::SHRINK); |
876 |
} |
877 |
Glib::ustring str = "<b>"; |
878 |
str += text; |
879 |
str += "</b>"; |
880 |
Gtk::Label* label = new Gtk::Label(str); |
881 |
label->set_use_markup(); |
882 |
label->set_alignment(Gtk::ALIGN_START); |
883 |
table[pageno]->attach(*label, 0, 3, rowno, rowno + 1, |
884 |
Gtk::FILL, Gtk::SHRINK); |
885 |
rowno++; |
886 |
firstRowInBlock = rowno; |
887 |
return label; |
888 |
} |
889 |
|
890 |
void DimRegionEdit::nextPage() |
891 |
{ |
892 |
if (firstRowInBlock < rowno - 1) |
893 |
{ |
894 |
Gtk::Label* filler = new Gtk::Label(" "); |
895 |
table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno, |
896 |
Gtk::FILL, Gtk::SHRINK); |
897 |
} |
898 |
pageno++; |
899 |
rowno = 0; |
900 |
firstRowInBlock = 0; |
901 |
} |
902 |
|
903 |
void DimRegionEdit::addProp(BoolEntry& boolentry) |
904 |
{ |
905 |
table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1, |
906 |
Gtk::FILL, Gtk::SHRINK); |
907 |
rowno++; |
908 |
} |
909 |
|
910 |
void DimRegionEdit::addProp(BoolEntryPlus6& boolentry) |
911 |
{ |
912 |
table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1, |
913 |
Gtk::FILL, Gtk::SHRINK); |
914 |
rowno++; |
915 |
} |
916 |
|
917 |
void DimRegionEdit::addProp(LabelWidget& prop) |
918 |
{ |
919 |
table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1, |
920 |
Gtk::FILL, Gtk::SHRINK); |
921 |
table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1, |
922 |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
923 |
rowno++; |
924 |
} |
925 |
|
926 |
void DimRegionEdit::addRightHandSide(Gtk::Widget& widget) |
927 |
{ |
928 |
table[pageno]->attach(widget, 2, 3, rowno, rowno + 1, |
929 |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
930 |
rowno++; |
931 |
} |
932 |
|
933 |
void DimRegionEdit::set_dim_region(gig::DimensionRegion* d) |
934 |
{ |
935 |
dimregion = d; |
936 |
velocity_curve.set_dim_region(d); |
937 |
release_curve.set_dim_region(d); |
938 |
cutoff_curve.set_dim_region(d); |
939 |
crossfade_curve.set_dim_region(d); |
940 |
|
941 |
set_sensitive(d); |
942 |
if (!d) return; |
943 |
|
944 |
update_model++; |
945 |
eEG1PreAttack.set_value(d->EG1PreAttack); |
946 |
eEG1Attack.set_value(d->EG1Attack); |
947 |
eEG1Decay1.set_value(d->EG1Decay1); |
948 |
eEG1Decay2.set_value(d->EG1Decay2); |
949 |
eEG1InfiniteSustain.set_value(d->EG1InfiniteSustain); |
950 |
eEG1Sustain.set_value(d->EG1Sustain); |
951 |
eEG1Release.set_value(d->EG1Release); |
952 |
eEG1Hold.set_value(d->EG1Hold); |
953 |
eEG1Controller.set_value(d->EG1Controller); |
954 |
eEG1ControllerInvert.set_value(d->EG1ControllerInvert); |
955 |
eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence); |
956 |
eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence); |
957 |
eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence); |
958 |
eLFO1Frequency.set_value(d->LFO1Frequency); |
959 |
eLFO1InternalDepth.set_value(d->LFO1InternalDepth); |
960 |
eLFO1ControlDepth.set_value(d->LFO1ControlDepth); |
961 |
eLFO1Controller.set_value(d->LFO1Controller); |
962 |
eLFO1FlipPhase.set_value(d->LFO1FlipPhase); |
963 |
eLFO1Sync.set_value(d->LFO1Sync); |
964 |
eEG2PreAttack.set_value(d->EG2PreAttack); |
965 |
eEG2Attack.set_value(d->EG2Attack); |
966 |
eEG2Decay1.set_value(d->EG2Decay1); |
967 |
eEG2Decay2.set_value(d->EG2Decay2); |
968 |
eEG2InfiniteSustain.set_value(d->EG2InfiniteSustain); |
969 |
eEG2Sustain.set_value(d->EG2Sustain); |
970 |
eEG2Release.set_value(d->EG2Release); |
971 |
eEG2Controller.set_value(d->EG2Controller); |
972 |
eEG2ControllerInvert.set_value(d->EG2ControllerInvert); |
973 |
eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence); |
974 |
eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence); |
975 |
eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence); |
976 |
eLFO2Frequency.set_value(d->LFO2Frequency); |
977 |
eLFO2InternalDepth.set_value(d->LFO2InternalDepth); |
978 |
eLFO2ControlDepth.set_value(d->LFO2ControlDepth); |
979 |
eLFO2Controller.set_value(d->LFO2Controller); |
980 |
eLFO2FlipPhase.set_value(d->LFO2FlipPhase); |
981 |
eLFO2Sync.set_value(d->LFO2Sync); |
982 |
eEG3Attack.set_value(d->EG3Attack); |
983 |
eEG3Depth.set_value(d->EG3Depth); |
984 |
eLFO3Frequency.set_value(d->LFO3Frequency); |
985 |
eLFO3InternalDepth.set_value(d->LFO3InternalDepth); |
986 |
eLFO3ControlDepth.set_value(d->LFO3ControlDepth); |
987 |
eLFO3Controller.set_value(d->LFO3Controller); |
988 |
eLFO3Sync.set_value(d->LFO3Sync); |
989 |
eVCFEnabled.set_value(d->VCFEnabled); |
990 |
eVCFType.set_value(d->VCFType); |
991 |
eVCFCutoffController.set_value(d->VCFCutoffController); |
992 |
eVCFCutoffControllerInvert.set_value(d->VCFCutoffControllerInvert); |
993 |
eVCFCutoff.set_value(d->VCFCutoff); |
994 |
eVCFVelocityCurve.set_value(d->VCFVelocityCurve); |
995 |
eVCFVelocityScale.set_value(d->VCFVelocityScale); |
996 |
eVCFVelocityDynamicRange.set_value(d->VCFVelocityDynamicRange); |
997 |
eVCFResonance.set_value(d->VCFResonance); |
998 |
eVCFResonanceDynamic.set_value(d->VCFResonanceDynamic); |
999 |
eVCFResonanceController.set_value(d->VCFResonanceController); |
1000 |
eVCFKeyboardTracking.set_value(d->VCFKeyboardTracking); |
1001 |
eVCFKeyboardTrackingBreakpoint.set_value(d->VCFKeyboardTrackingBreakpoint); |
1002 |
eVelocityResponseCurve.set_value(d->VelocityResponseCurve); |
1003 |
eVelocityResponseDepth.set_value(d->VelocityResponseDepth); |
1004 |
eVelocityResponseCurveScaling.set_value(d->VelocityResponseCurveScaling); |
1005 |
eReleaseVelocityResponseCurve.set_value(d->ReleaseVelocityResponseCurve); |
1006 |
eReleaseVelocityResponseDepth.set_value(d->ReleaseVelocityResponseDepth); |
1007 |
eReleaseTriggerDecay.set_value(d->ReleaseTriggerDecay); |
1008 |
eCrossfade_in_start.set_value(d->Crossfade.in_start); |
1009 |
eCrossfade_in_end.set_value(d->Crossfade.in_end); |
1010 |
eCrossfade_out_start.set_value(d->Crossfade.out_start); |
1011 |
eCrossfade_out_end.set_value(d->Crossfade.out_end); |
1012 |
ePitchTrack.set_value(d->PitchTrack); |
1013 |
eDimensionBypass.set_value(d->DimensionBypass); |
1014 |
ePan.set_value(d->Pan); |
1015 |
eSelfMask.set_value(d->SelfMask); |
1016 |
eAttenuationController.set_value(d->AttenuationController); |
1017 |
eInvertAttenuationController.set_value(d->InvertAttenuationController); |
1018 |
eAttenuationControllerThreshold.set_value(d->AttenuationControllerThreshold); |
1019 |
eChannelOffset.set_value(d->ChannelOffset); |
1020 |
eSustainDefeat.set_value(d->SustainDefeat); |
1021 |
eMSDecode.set_value(d->MSDecode); |
1022 |
eSampleStartOffset.set_value(d->SampleStartOffset); |
1023 |
eUnityNote.set_value(d->UnityNote); |
1024 |
// assemble sample format info string |
1025 |
{ |
1026 |
Glib::ustring s; |
1027 |
if (d->pSample) { |
1028 |
switch (d->pSample->Channels) { |
1029 |
case 1: s = _("Mono"); break; |
1030 |
case 2: s = _("Stereo"); break; |
1031 |
default: |
1032 |
s = ToString(d->pSample->Channels) + _(" audio channels"); |
1033 |
break; |
1034 |
} |
1035 |
s += " " + ToString(d->pSample->BitDepth) + " Bits"; |
1036 |
s += " " + ToString(d->pSample->SamplesPerSecond/1000) + "." |
1037 |
+ ToString((d->pSample->SamplesPerSecond%1000)/100) + " kHz"; |
1038 |
} else { |
1039 |
s = _("No sample assigned to this dimension region."); |
1040 |
} |
1041 |
eSampleFormatInfo.text.set_text(s); |
1042 |
} |
1043 |
// generate sample's memory address pointer string |
1044 |
{ |
1045 |
Glib::ustring s; |
1046 |
if (d->pSample) { |
1047 |
char buf[64] = {}; |
1048 |
snprintf(buf, sizeof(buf), "%p", d->pSample); |
1049 |
s = buf; |
1050 |
} else { |
1051 |
s = "---"; |
1052 |
} |
1053 |
eSampleID.text.set_text(s); |
1054 |
} |
1055 |
buttonSelectSample.set_sensitive(d && d->pSample); |
1056 |
eFineTune.set_value(d->FineTune); |
1057 |
eGain.set_value(d->Gain); |
1058 |
eGainPlus6.set_value(d->Gain); |
1059 |
eSampleLoopEnabled.set_value(d->SampleLoops); |
1060 |
eSampleLoopType.set_value( |
1061 |
d->SampleLoops ? d->pSampleLoops[0].LoopType : 0); |
1062 |
eSampleLoopStart.set_value( |
1063 |
d->SampleLoops ? d->pSampleLoops[0].LoopStart : 0); |
1064 |
eSampleLoopLength.set_value( |
1065 |
d->SampleLoops ? d->pSampleLoops[0].LoopLength : 0); |
1066 |
eSampleLoopInfinite.set_value( |
1067 |
d->pSample && d->pSample->LoopPlayCount == 0); |
1068 |
eSampleLoopPlayCount.set_value( |
1069 |
d->pSample ? d->pSample->LoopPlayCount : 0); |
1070 |
update_model--; |
1071 |
|
1072 |
wSample->set_text(d->pSample ? gig_to_utf8(d->pSample->pInfo->Name) : |
1073 |
_("NULL")); |
1074 |
|
1075 |
update_loop_elements(); |
1076 |
VCFEnabled_toggled(); |
1077 |
} |
1078 |
|
1079 |
|
1080 |
void DimRegionEdit::VCFEnabled_toggled() |
1081 |
{ |
1082 |
bool sensitive = eVCFEnabled.get_value(); |
1083 |
eVCFType.set_sensitive(sensitive); |
1084 |
eVCFCutoffController.set_sensitive(sensitive); |
1085 |
eVCFVelocityCurve.set_sensitive(sensitive); |
1086 |
eVCFVelocityScale.set_sensitive(sensitive); |
1087 |
eVCFVelocityDynamicRange.set_sensitive(sensitive); |
1088 |
cutoff_curve.set_sensitive(sensitive); |
1089 |
eVCFResonance.set_sensitive(sensitive); |
1090 |
eVCFResonanceController.set_sensitive(sensitive); |
1091 |
eVCFKeyboardTracking.set_sensitive(sensitive); |
1092 |
eVCFKeyboardTrackingBreakpoint.set_sensitive(sensitive); |
1093 |
lEG2->set_sensitive(sensitive); |
1094 |
eEG2PreAttack.set_sensitive(sensitive); |
1095 |
eEG2Attack.set_sensitive(sensitive); |
1096 |
eEG2Decay1.set_sensitive(sensitive); |
1097 |
eEG2InfiniteSustain.set_sensitive(sensitive); |
1098 |
eEG2Sustain.set_sensitive(sensitive); |
1099 |
eEG2Release.set_sensitive(sensitive); |
1100 |
eEG2Controller.set_sensitive(sensitive); |
1101 |
eEG2ControllerAttackInfluence.set_sensitive(sensitive); |
1102 |
eEG2ControllerDecayInfluence.set_sensitive(sensitive); |
1103 |
eEG2ControllerReleaseInfluence.set_sensitive(sensitive); |
1104 |
lLFO2->set_sensitive(sensitive); |
1105 |
eLFO2Frequency.set_sensitive(sensitive); |
1106 |
eLFO2InternalDepth.set_sensitive(sensitive); |
1107 |
eLFO2ControlDepth.set_sensitive(sensitive); |
1108 |
eLFO2Controller.set_sensitive(sensitive); |
1109 |
eLFO2FlipPhase.set_sensitive(sensitive); |
1110 |
eLFO2Sync.set_sensitive(sensitive); |
1111 |
if (sensitive) { |
1112 |
VCFCutoffController_changed(); |
1113 |
VCFResonanceController_changed(); |
1114 |
EG2InfiniteSustain_toggled(); |
1115 |
EG2Controller_changed(); |
1116 |
LFO2Controller_changed(); |
1117 |
} else { |
1118 |
eVCFCutoffControllerInvert.set_sensitive(false); |
1119 |
eVCFCutoff.set_sensitive(false); |
1120 |
eVCFResonanceDynamic.set_sensitive(false); |
1121 |
eVCFResonance.set_sensitive(false); |
1122 |
eEG2Decay2.set_sensitive(false); |
1123 |
eEG2ControllerInvert.set_sensitive(false); |
1124 |
eLFO2InternalDepth.set_sensitive(false); |
1125 |
eLFO2ControlDepth.set_sensitive(false); |
1126 |
} |
1127 |
} |
1128 |
|
1129 |
void DimRegionEdit::VCFCutoffController_changed() |
1130 |
{ |
1131 |
gig::vcf_cutoff_ctrl_t ctrl = eVCFCutoffController.get_value(); |
1132 |
bool hasController = ctrl != gig::vcf_cutoff_ctrl_none && ctrl != gig::vcf_cutoff_ctrl_none2; |
1133 |
|
1134 |
eVCFCutoffControllerInvert.set_sensitive(hasController); |
1135 |
eVCFCutoff.set_sensitive(!hasController); |
1136 |
eVCFResonanceDynamic.set_sensitive(!hasController); |
1137 |
eVCFVelocityScale.label.set_text(hasController ? _("Minimum cutoff:") : |
1138 |
_("Velocity scale:")); |
1139 |
} |
1140 |
|
1141 |
void DimRegionEdit::VCFResonanceController_changed() |
1142 |
{ |
1143 |
bool hasController = eVCFResonanceController.get_value() != gig::vcf_res_ctrl_none; |
1144 |
eVCFResonance.set_sensitive(!hasController); |
1145 |
} |
1146 |
|
1147 |
void DimRegionEdit::EG1InfiniteSustain_toggled() |
1148 |
{ |
1149 |
bool infSus = eEG1InfiniteSustain.get_value(); |
1150 |
eEG1Decay2.set_sensitive(!infSus); |
1151 |
} |
1152 |
|
1153 |
void DimRegionEdit::EG2InfiniteSustain_toggled() |
1154 |
{ |
1155 |
bool infSus = eEG2InfiniteSustain.get_value(); |
1156 |
eEG2Decay2.set_sensitive(!infSus); |
1157 |
} |
1158 |
|
1159 |
void DimRegionEdit::EG1Controller_changed() |
1160 |
{ |
1161 |
bool hasController = eEG1Controller.get_value().type != gig::leverage_ctrl_t::type_none; |
1162 |
eEG1ControllerInvert.set_sensitive(hasController); |
1163 |
} |
1164 |
|
1165 |
void DimRegionEdit::EG2Controller_changed() |
1166 |
{ |
1167 |
bool hasController = eEG2Controller.get_value().type != gig::leverage_ctrl_t::type_none; |
1168 |
eEG2ControllerInvert.set_sensitive(hasController); |
1169 |
} |
1170 |
|
1171 |
void DimRegionEdit::AttenuationController_changed() |
1172 |
{ |
1173 |
bool hasController = |
1174 |
eAttenuationController.get_value().type != gig::leverage_ctrl_t::type_none; |
1175 |
eInvertAttenuationController.set_sensitive(hasController); |
1176 |
eAttenuationControllerThreshold.set_sensitive(hasController); |
1177 |
eCrossfade_in_start.set_sensitive(hasController); |
1178 |
eCrossfade_in_end.set_sensitive(hasController); |
1179 |
eCrossfade_out_start.set_sensitive(hasController); |
1180 |
eCrossfade_out_end.set_sensitive(hasController); |
1181 |
crossfade_curve.set_sensitive(hasController); |
1182 |
} |
1183 |
|
1184 |
void DimRegionEdit::LFO1Controller_changed() |
1185 |
{ |
1186 |
gig::lfo1_ctrl_t ctrl = eLFO1Controller.get_value(); |
1187 |
eLFO1ControlDepth.set_sensitive(ctrl != gig::lfo1_ctrl_internal); |
1188 |
eLFO1InternalDepth.set_sensitive(ctrl != gig::lfo1_ctrl_modwheel && |
1189 |
ctrl != gig::lfo1_ctrl_breath); |
1190 |
} |
1191 |
|
1192 |
void DimRegionEdit::LFO2Controller_changed() |
1193 |
{ |
1194 |
gig::lfo2_ctrl_t ctrl = eLFO2Controller.get_value(); |
1195 |
eLFO2ControlDepth.set_sensitive(ctrl != gig::lfo2_ctrl_internal); |
1196 |
eLFO2InternalDepth.set_sensitive(ctrl != gig::lfo2_ctrl_modwheel && |
1197 |
ctrl != gig::lfo2_ctrl_foot); |
1198 |
} |
1199 |
|
1200 |
void DimRegionEdit::LFO3Controller_changed() |
1201 |
{ |
1202 |
gig::lfo3_ctrl_t ctrl = eLFO3Controller.get_value(); |
1203 |
eLFO3ControlDepth.set_sensitive(ctrl != gig::lfo3_ctrl_internal); |
1204 |
eLFO3InternalDepth.set_sensitive(ctrl != gig::lfo3_ctrl_modwheel && |
1205 |
ctrl != gig::lfo3_ctrl_aftertouch); |
1206 |
} |
1207 |
|
1208 |
void DimRegionEdit::crossfade1_changed() |
1209 |
{ |
1210 |
update_model++; |
1211 |
eCrossfade_in_end.set_value(dimregion->Crossfade.in_end); |
1212 |
eCrossfade_out_start.set_value(dimregion->Crossfade.out_start); |
1213 |
eCrossfade_out_end.set_value(dimregion->Crossfade.out_end); |
1214 |
update_model--; |
1215 |
} |
1216 |
|
1217 |
void DimRegionEdit::crossfade2_changed() |
1218 |
{ |
1219 |
update_model++; |
1220 |
eCrossfade_in_start.set_value(dimregion->Crossfade.in_start); |
1221 |
eCrossfade_out_start.set_value(dimregion->Crossfade.out_start); |
1222 |
eCrossfade_out_end.set_value(dimregion->Crossfade.out_end); |
1223 |
update_model--; |
1224 |
} |
1225 |
|
1226 |
void DimRegionEdit::crossfade3_changed() |
1227 |
{ |
1228 |
update_model++; |
1229 |
eCrossfade_in_start.set_value(dimregion->Crossfade.in_start); |
1230 |
eCrossfade_in_end.set_value(dimregion->Crossfade.in_end); |
1231 |
eCrossfade_out_end.set_value(dimregion->Crossfade.out_end); |
1232 |
update_model--; |
1233 |
} |
1234 |
|
1235 |
void DimRegionEdit::crossfade4_changed() |
1236 |
{ |
1237 |
update_model++; |
1238 |
eCrossfade_in_start.set_value(dimregion->Crossfade.in_start); |
1239 |
eCrossfade_in_end.set_value(dimregion->Crossfade.in_end); |
1240 |
eCrossfade_out_start.set_value(dimregion->Crossfade.out_start); |
1241 |
update_model--; |
1242 |
} |
1243 |
|
1244 |
void DimRegionEdit::update_loop_elements() |
1245 |
{ |
1246 |
update_model++; |
1247 |
const bool active = eSampleLoopEnabled.get_value(); |
1248 |
eSampleLoopStart.set_sensitive(active); |
1249 |
eSampleLoopLength.set_sensitive(active); |
1250 |
eSampleLoopType.set_sensitive(active); |
1251 |
eSampleLoopInfinite.set_sensitive(active && dimregion && dimregion->pSample); |
1252 |
// sample loop shall never be longer than the actual sample size |
1253 |
loop_start_changed(); |
1254 |
loop_length_changed(); |
1255 |
eSampleLoopStart.set_value( |
1256 |
dimregion->SampleLoops ? dimregion->pSampleLoops[0].LoopStart : 0); |
1257 |
eSampleLoopLength.set_value( |
1258 |
dimregion->SampleLoops ? dimregion->pSampleLoops[0].LoopLength : 0); |
1259 |
|
1260 |
eSampleLoopInfinite.set_value( |
1261 |
dimregion->pSample && dimregion->pSample->LoopPlayCount == 0); |
1262 |
|
1263 |
loop_infinite_toggled(); |
1264 |
update_model--; |
1265 |
} |
1266 |
|
1267 |
void DimRegionEdit::loop_start_changed() { |
1268 |
if (dimregion && dimregion->SampleLoops) { |
1269 |
eSampleLoopLength.set_upper(dimregion->pSample ? |
1270 |
dimregion->pSample->SamplesTotal - |
1271 |
dimregion->pSampleLoops[0].LoopStart : 0); |
1272 |
} |
1273 |
} |
1274 |
|
1275 |
void DimRegionEdit::loop_length_changed() { |
1276 |
if (dimregion && dimregion->SampleLoops) { |
1277 |
eSampleLoopStart.set_upper(dimregion->pSample ? |
1278 |
dimregion->pSample->SamplesTotal - |
1279 |
dimregion->pSampleLoops[0].LoopLength : 0); |
1280 |
} |
1281 |
} |
1282 |
|
1283 |
void DimRegionEdit::loop_infinite_toggled() { |
1284 |
eSampleLoopPlayCount.set_sensitive( |
1285 |
dimregion && dimregion->pSample && |
1286 |
!eSampleLoopInfinite.get_value() && |
1287 |
eSampleLoopEnabled.get_value() |
1288 |
); |
1289 |
update_model++; |
1290 |
eSampleLoopPlayCount.set_value( |
1291 |
dimregion->pSample ? dimregion->pSample->LoopPlayCount : 0); |
1292 |
update_model--; |
1293 |
} |
1294 |
|
1295 |
bool DimRegionEdit::set_sample(gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop) |
1296 |
{ |
1297 |
for (std::set<gig::DimensionRegion*>::iterator itDimReg = dimregs.begin(); |
1298 |
itDimReg != dimregs.end(); ++itDimReg) |
1299 |
{ |
1300 |
set_sample(*itDimReg, sample, copy_sample_unity, copy_sample_tune, copy_sample_loop); |
1301 |
} |
1302 |
} |
1303 |
|
1304 |
bool DimRegionEdit::set_sample(gig::DimensionRegion* dimreg, gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop) |
1305 |
{ |
1306 |
if (dimreg) { |
1307 |
//TODO: we should better move the code from MainWindow::on_sample_label_drop_drag_data_received() here |
1308 |
|
1309 |
// currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received() |
1310 |
//dimreg_to_be_changed_signal.emit(dimregion); |
1311 |
|
1312 |
// make sure stereo samples always are the same in both |
1313 |
// dimregs in the samplechannel dimension |
1314 |
int nbDimregs = 1; |
1315 |
gig::DimensionRegion* d[2] = { dimreg, 0 }; |
1316 |
if (sample->Channels == 2) { |
1317 |
gig::Region* region = dimreg->GetParent(); |
1318 |
|
1319 |
int bitcount = 0; |
1320 |
int stereo_bit = 0; |
1321 |
for (int dim = 0 ; dim < region->Dimensions ; dim++) { |
1322 |
if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) { |
1323 |
stereo_bit = 1 << bitcount; |
1324 |
break; |
1325 |
} |
1326 |
bitcount += region->pDimensionDefinitions[dim].bits; |
1327 |
} |
1328 |
|
1329 |
if (stereo_bit) { |
1330 |
int dimregno; |
1331 |
for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) { |
1332 |
if (region->pDimensionRegions[dimregno] == dimreg) { |
1333 |
break; |
1334 |
} |
1335 |
} |
1336 |
d[0] = region->pDimensionRegions[dimregno & ~stereo_bit]; |
1337 |
d[1] = region->pDimensionRegions[dimregno | stereo_bit]; |
1338 |
nbDimregs = 2; |
1339 |
} |
1340 |
} |
1341 |
|
1342 |
gig::Sample* oldref = dimreg->pSample; |
1343 |
|
1344 |
for (int i = 0 ; i < nbDimregs ; i++) { |
1345 |
d[i]->pSample = sample; |
1346 |
|
1347 |
// copy sample information from Sample to DimensionRegion |
1348 |
if (copy_sample_unity) |
1349 |
d[i]->UnityNote = sample->MIDIUnityNote; |
1350 |
if (copy_sample_tune) |
1351 |
d[i]->FineTune = sample->FineTune; |
1352 |
if (copy_sample_loop) { |
1353 |
int loops = sample->Loops ? 1 : 0; |
1354 |
while (d[i]->SampleLoops > loops) { |
1355 |
d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]); |
1356 |
} |
1357 |
while (d[i]->SampleLoops < sample->Loops) { |
1358 |
DLS::sample_loop_t loop; |
1359 |
d[i]->AddSampleLoop(&loop); |
1360 |
} |
1361 |
if (loops) { |
1362 |
d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t); |
1363 |
d[i]->pSampleLoops[0].LoopType = sample->LoopType; |
1364 |
d[i]->pSampleLoops[0].LoopStart = sample->LoopStart; |
1365 |
d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1; |
1366 |
} |
1367 |
} |
1368 |
} |
1369 |
|
1370 |
// update ui |
1371 |
update_model++; |
1372 |
wSample->set_text(gig_to_utf8(dimreg->pSample->pInfo->Name)); |
1373 |
eUnityNote.set_value(dimreg->UnityNote); |
1374 |
eFineTune.set_value(dimreg->FineTune); |
1375 |
eSampleLoopEnabled.set_value(dimreg->SampleLoops); |
1376 |
update_loop_elements(); |
1377 |
update_model--; |
1378 |
|
1379 |
sample_ref_changed_signal.emit(oldref, sample); |
1380 |
// currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received() |
1381 |
//dimreg_changed_signal.emit(dimreg); |
1382 |
return true; |
1383 |
} |
1384 |
return false; |
1385 |
} |
1386 |
|
1387 |
sigc::signal<void, gig::DimensionRegion*>& DimRegionEdit::signal_dimreg_to_be_changed() { |
1388 |
return dimreg_to_be_changed_signal; |
1389 |
} |
1390 |
|
1391 |
sigc::signal<void, gig::DimensionRegion*>& DimRegionEdit::signal_dimreg_changed() { |
1392 |
return dimreg_changed_signal; |
1393 |
} |
1394 |
|
1395 |
sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& DimRegionEdit::signal_sample_ref_changed() { |
1396 |
return sample_ref_changed_signal; |
1397 |
} |
1398 |
|
1399 |
|
1400 |
void DimRegionEdit::set_UnityNote(gig::DimensionRegion* d, uint8_t value) |
1401 |
{ |
1402 |
d->UnityNote = value; |
1403 |
} |
1404 |
|
1405 |
void DimRegionEdit::set_FineTune(gig::DimensionRegion* d, int16_t value) |
1406 |
{ |
1407 |
d->FineTune = value; |
1408 |
} |
1409 |
|
1410 |
void DimRegionEdit::set_Crossfade_in_start(gig::DimensionRegion* d, |
1411 |
uint8_t value) |
1412 |
{ |
1413 |
d->Crossfade.in_start = value; |
1414 |
if (d->Crossfade.in_end < value) set_Crossfade_in_end(d, value); |
1415 |
} |
1416 |
|
1417 |
void DimRegionEdit::set_Crossfade_in_end(gig::DimensionRegion* d, |
1418 |
uint8_t value) |
1419 |
{ |
1420 |
d->Crossfade.in_end = value; |
1421 |
if (value < d->Crossfade.in_start) set_Crossfade_in_start(d, value); |
1422 |
if (value > d->Crossfade.out_start) set_Crossfade_out_start(d, value); |
1423 |
} |
1424 |
|
1425 |
void DimRegionEdit::set_Crossfade_out_start(gig::DimensionRegion* d, |
1426 |
uint8_t value) |
1427 |
{ |
1428 |
d->Crossfade.out_start = value; |
1429 |
if (value < d->Crossfade.in_end) set_Crossfade_in_end(d, value); |
1430 |
if (value > d->Crossfade.out_end) set_Crossfade_out_end(d, value); |
1431 |
} |
1432 |
|
1433 |
void DimRegionEdit::set_Crossfade_out_end(gig::DimensionRegion* d, |
1434 |
uint8_t value) |
1435 |
{ |
1436 |
d->Crossfade.out_end = value; |
1437 |
if (value < d->Crossfade.out_start) set_Crossfade_out_start(d, value); |
1438 |
} |
1439 |
|
1440 |
void DimRegionEdit::set_Gain(gig::DimensionRegion* d, int32_t value) |
1441 |
{ |
1442 |
d->SetGain(value); |
1443 |
} |
1444 |
|
1445 |
void DimRegionEdit::set_LoopEnabled(gig::DimensionRegion* d, bool value) |
1446 |
{ |
1447 |
if (value) { |
1448 |
// create a new sample loop in case there is none yet |
1449 |
if (!d->SampleLoops) { |
1450 |
DLS::sample_loop_t loop; |
1451 |
loop.LoopType = gig::loop_type_normal; |
1452 |
// loop the whole sample by default |
1453 |
loop.LoopStart = 0; |
1454 |
loop.LoopLength = |
1455 |
(d->pSample) ? d->pSample->SamplesTotal : 0; |
1456 |
dimreg_to_be_changed_signal.emit(d); |
1457 |
d->AddSampleLoop(&loop); |
1458 |
dimreg_changed_signal.emit(d); |
1459 |
} |
1460 |
} else { |
1461 |
if (d->SampleLoops) { |
1462 |
dimreg_to_be_changed_signal.emit(d); |
1463 |
// delete ALL existing sample loops |
1464 |
while (d->SampleLoops) { |
1465 |
d->DeleteSampleLoop(&d->pSampleLoops[0]); |
1466 |
} |
1467 |
dimreg_changed_signal.emit(d); |
1468 |
} |
1469 |
} |
1470 |
} |
1471 |
|
1472 |
void DimRegionEdit::set_LoopType(gig::DimensionRegion* d, uint32_t value) |
1473 |
{ |
1474 |
if (d->SampleLoops) d->pSampleLoops[0].LoopType = value; |
1475 |
} |
1476 |
|
1477 |
void DimRegionEdit::set_LoopStart(gig::DimensionRegion* d, uint32_t value) |
1478 |
{ |
1479 |
if (d->SampleLoops) { |
1480 |
d->pSampleLoops[0].LoopStart = |
1481 |
d->pSample ? |
1482 |
std::min(value, uint32_t(d->pSample->SamplesTotal - |
1483 |
d->pSampleLoops[0].LoopLength)) : |
1484 |
0; |
1485 |
} |
1486 |
} |
1487 |
|
1488 |
void DimRegionEdit::set_LoopLength(gig::DimensionRegion* d, uint32_t value) |
1489 |
{ |
1490 |
if (d->SampleLoops) { |
1491 |
d->pSampleLoops[0].LoopLength = |
1492 |
d->pSample ? |
1493 |
std::min(value, uint32_t(d->pSample->SamplesTotal - |
1494 |
d->pSampleLoops[0].LoopStart)) : |
1495 |
0; |
1496 |
} |
1497 |
} |
1498 |
|
1499 |
void DimRegionEdit::set_LoopInfinite(gig::DimensionRegion* d, bool value) |
1500 |
{ |
1501 |
if (d->pSample) { |
1502 |
if (value) d->pSample->LoopPlayCount = 0; |
1503 |
else if (d->pSample->LoopPlayCount == 0) d->pSample->LoopPlayCount = 1; |
1504 |
} |
1505 |
} |
1506 |
|
1507 |
void DimRegionEdit::set_LoopPlayCount(gig::DimensionRegion* d, uint32_t value) |
1508 |
{ |
1509 |
if (d->pSample) d->pSample->LoopPlayCount = value; |
1510 |
} |
1511 |
|
1512 |
void DimRegionEdit::nullOutSampleReference() { |
1513 |
if (!dimregion) return; |
1514 |
gig::Sample* oldref = dimregion->pSample; |
1515 |
if (!oldref) return; |
1516 |
|
1517 |
dimreg_to_be_changed_signal.emit(dimregion); |
1518 |
|
1519 |
// in case currently assigned sample is a stereo one, then remove both |
1520 |
// references (expected to be due to a "stereo dimension") |
1521 |
gig::DimensionRegion* d[2] = { dimregion, NULL }; |
1522 |
if (oldref->Channels == 2) { |
1523 |
gig::Region* region = dimregion->GetParent(); |
1524 |
{ |
1525 |
int stereo_bit = 0; |
1526 |
int bitcount = 0; |
1527 |
for (int dim = 0 ; dim < region->Dimensions ; dim++) { |
1528 |
if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) { |
1529 |
stereo_bit = 1 << bitcount; |
1530 |
break; |
1531 |
} |
1532 |
bitcount += region->pDimensionDefinitions[dim].bits; |
1533 |
} |
1534 |
|
1535 |
if (stereo_bit) { |
1536 |
int dimregno; |
1537 |
for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) { |
1538 |
if (region->pDimensionRegions[dimregno] == dimregion) { |
1539 |
break; |
1540 |
} |
1541 |
} |
1542 |
d[0] = region->pDimensionRegions[dimregno & ~stereo_bit]; |
1543 |
d[1] = region->pDimensionRegions[dimregno | stereo_bit]; |
1544 |
} |
1545 |
} |
1546 |
} |
1547 |
|
1548 |
if (d[0]) d[0]->pSample = NULL; |
1549 |
if (d[1]) d[1]->pSample = NULL; |
1550 |
|
1551 |
// update UI elements |
1552 |
set_dim_region(dimregion); |
1553 |
|
1554 |
sample_ref_changed_signal.emit(oldref, NULL); |
1555 |
dimreg_changed_signal.emit(dimregion); |
1556 |
} |
1557 |
|
1558 |
void DimRegionEdit::onButtonSelectSamplePressed() { |
1559 |
if (!dimregion) return; |
1560 |
if (!dimregion->pSample) return; |
1561 |
select_sample_signal.emit(dimregion->pSample); |
1562 |
} |
1563 |
|
1564 |
sigc::signal<void, gig::Sample*>& DimRegionEdit::signal_select_sample() { |
1565 |
return select_sample_signal; |
1566 |
} |