1 |
/* |
/* |
2 |
* Copyright (C) 2006-2013 Andreas Persson |
* Copyright (C) 2006-2017 Andreas Persson |
3 |
* |
* |
4 |
* This program is free software; you can redistribute it and/or |
* This program is free software; you can redistribute it and/or |
5 |
* modify it under the terms of the GNU General Public License as |
* modify it under the terms of the GNU General Public License as |
17 |
* 02110-1301 USA. |
* 02110-1301 USA. |
18 |
*/ |
*/ |
19 |
|
|
20 |
|
#include "global.h" |
21 |
#include "dimregionedit.h" |
#include "dimregionedit.h" |
22 |
|
|
|
#include "global.h" |
|
23 |
#include "compat.h" |
#include "compat.h" |
24 |
|
|
25 |
VelocityCurve::VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t)) : |
VelocityCurve::VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t)) : |
42 |
int h = get_height(); |
int h = get_height(); |
43 |
|
|
44 |
for (int pass = 0 ; pass < 2 ; pass++) { |
for (int pass = 0 ; pass < 2 ; pass++) { |
45 |
for (int x = 0 ; x < w ; x++) { |
for (double x = 0 ; x <= w ; x++) { |
46 |
int vel = int(x * 126.0 / w + 1.5); |
int vel = int(x * (127 - 1e-10) / w + 1); |
47 |
int y = int((1 - (dimreg->*getter)(vel)) * (h - 1)); |
double y = (1 - (dimreg->*getter)(vel)) * (h - 3) + 1.5; |
48 |
|
|
49 |
if (x == 0) { |
if (x < 1e-10) { |
50 |
cr->move_to(x, y); |
cr->move_to(x, y); |
51 |
} else { |
} else { |
52 |
cr->line_to(x, y); |
cr->line_to(x, y); |
53 |
} |
} |
54 |
} |
} |
55 |
if (pass == 0) { |
if (pass == 0) { |
56 |
cr->line_to(w - 1, h - 1); |
cr->line_to(w, h); |
57 |
cr->line_to(0, h - 1); |
cr->line_to(0, h); |
58 |
cr->set_source_rgba(0.5, 0.44, 1.0, 0.2); |
cr->set_source_rgba(0.5, 0.44, 1.0, is_sensitive() ? 0.2 : 0.1); |
59 |
cr->fill(); |
cr->fill(); |
60 |
} else { |
} else { |
61 |
cr->set_line_width(3); |
cr->set_line_width(3); |
62 |
cr->set_source_rgb(0.5, 0.44, 1.0); |
cr->set_source_rgba(0.5, 0.44, 1.0, is_sensitive() ? 1.0 : 0.3); |
63 |
cr->stroke(); |
cr->stroke(); |
64 |
} |
} |
65 |
} |
} |
82 |
#else |
#else |
83 |
bool CrossfadeCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { |
bool CrossfadeCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { |
84 |
#endif |
#endif |
85 |
if (dimreg && dimreg->Crossfade.out_end) { |
if (dimreg) { |
86 |
int w = get_width(); |
cr->translate(1.5, 0); |
87 |
int h = get_height(); |
|
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++) { |
for (int pass = 0 ; pass < 2 ; pass++) { |
132 |
cr->move_to(dimreg->Crossfade.in_start / 127.0 * (w - 4) + 2, h); |
cr->move_to(d->Crossfade.in_start / 127.0 * (w - 3), h); |
133 |
cr->line_to(dimreg->Crossfade.in_end / 127.0 * (w - 4) + 2, 2); |
cr->line_to(d->Crossfade.in_end / 127.0 * (w - 3), 1.5); |
134 |
cr->line_to(dimreg->Crossfade.out_start / 127.0 * (w - 4) + 2, 2); |
cr->line_to(d->Crossfade.out_start / 127.0 * (w - 3), 1.5); |
135 |
cr->line_to(dimreg->Crossfade.out_end / 127.0 * (w - 4) + 2, h); |
cr->line_to(d->Crossfade.out_end / 127.0 * (w - 3), h); |
136 |
|
|
137 |
if (pass == 0) { |
if (pass == 0) { |
138 |
cr->line_to(dimreg->Crossfade.in_start / 127.0 * (w - 4) + 2, |
cr->set_source_rgba(0.5, 0.44, 1.0, sensitive ? 0.2 : 0.1); |
|
h); |
|
|
cr->set_source_rgba(0.5, 0.44, 1.0, 0.2); |
|
139 |
cr->fill(); |
cr->fill(); |
140 |
} else { |
} else { |
141 |
cr->set_line_width(3); |
cr->set_line_width(3); |
142 |
cr->set_source_rgb(0.5, 0.44, 1.0); |
cr->set_source_rgba(0.5, 0.44, 1.0, sensitive ? 1.0 : 0.3); |
143 |
cr->stroke(); |
cr->stroke(); |
144 |
} |
} |
145 |
} |
} |
146 |
} |
} |
147 |
return true; |
} |
148 |
|
|
149 |
|
|
150 |
|
EGStateOptions::EGStateOptions() : HBox(), |
151 |
|
label(_("May be cancelled: ")), |
152 |
|
checkBoxAttack(_("Attack")), |
153 |
|
checkBoxAttackHold(_("Attack Hold")), |
154 |
|
checkBoxDecay1(_("Decay 1")), |
155 |
|
checkBoxDecay2(_("Decay 2")), |
156 |
|
checkBoxRelease(_("Release")) |
157 |
|
{ |
158 |
|
set_spacing(6); |
159 |
|
|
160 |
|
pack_start(label); |
161 |
|
pack_start(checkBoxAttack, Gtk::PACK_SHRINK); |
162 |
|
pack_start(checkBoxAttackHold, Gtk::PACK_SHRINK); |
163 |
|
pack_start(checkBoxDecay1, Gtk::PACK_SHRINK); |
164 |
|
pack_start(checkBoxDecay2, Gtk::PACK_SHRINK); |
165 |
|
pack_start(checkBoxRelease, Gtk::PACK_SHRINK); |
166 |
|
|
167 |
|
checkBoxAttack.set_tooltip_text(_( |
168 |
|
"If checked: a note-off aborts the 'attack' stage." |
169 |
|
)); |
170 |
|
checkBoxAttackHold.set_tooltip_text(_( |
171 |
|
"If checked: a note-off aborts the 'attack hold' stage." |
172 |
|
)); |
173 |
|
checkBoxDecay1.set_tooltip_text(_( |
174 |
|
"If checked: a note-off aborts the 'decay 1' stage." |
175 |
|
)); |
176 |
|
checkBoxDecay2.set_tooltip_text(_( |
177 |
|
"If checked: a note-off aborts the 'decay 2' stage." |
178 |
|
)); |
179 |
|
checkBoxRelease.set_tooltip_text(_( |
180 |
|
"If checked: a note-on reverts back from the 'release' stage." |
181 |
|
)); |
182 |
} |
} |
183 |
|
|
184 |
|
|
186 |
velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation), |
velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation), |
187 |
release_curve(&gig::DimensionRegion::GetVelocityRelease), |
release_curve(&gig::DimensionRegion::GetVelocityRelease), |
188 |
cutoff_curve(&gig::DimensionRegion::GetVelocityCutoff), |
cutoff_curve(&gig::DimensionRegion::GetVelocityCutoff), |
189 |
eEG1PreAttack(_("Pre-attack"), 0, 100, 2), |
eEG1PreAttack(_("Pre-attack Level (%)"), 0, 100, 2), |
190 |
eEG1Attack(_("Attack"), 0, 60, 3), |
eEG1Attack(_("Attack Time (seconds)"), 0, 60, 3), |
191 |
eEG1Decay1(_("Decay 1"), 0.005, 60, 3), |
eEG1Decay1(_("Decay 1 Time (seconds)"), 0.005, 60, 3), |
192 |
eEG1Decay2(_("Decay 2"), 0, 60, 3), |
eEG1Decay2(_("Decay 2 Time (seconds)"), 0, 60, 3), |
193 |
eEG1InfiniteSustain(_("Infinite sustain")), |
eEG1InfiniteSustain(_("Infinite sustain")), |
194 |
eEG1Sustain(_("Sustain"), 0, 100, 2), |
eEG1Sustain(_("Sustain Level (%)"), 0, 100, 2), |
195 |
eEG1Release(_("Release"), 0, 60, 3), |
eEG1Release(_("Release Time (seconds)"), 0, 60, 3), |
196 |
eEG1Hold(_("Hold")), |
eEG1Hold(_("Hold Attack Stage until Loop End")), |
197 |
eEG1Controller(_("Controller")), |
eEG1Controller(_("Controller")), |
198 |
eEG1ControllerInvert(_("Controller invert")), |
eEG1ControllerInvert(_("Controller invert")), |
199 |
eEG1ControllerAttackInfluence(_("Controller attack influence"), 0, 3), |
eEG1ControllerAttackInfluence(_("Controller attack influence"), 0, 3), |
205 |
eLFO1Controller(_("Controller")), |
eLFO1Controller(_("Controller")), |
206 |
eLFO1FlipPhase(_("Flip phase")), |
eLFO1FlipPhase(_("Flip phase")), |
207 |
eLFO1Sync(_("Sync")), |
eLFO1Sync(_("Sync")), |
208 |
eEG2PreAttack(_("Pre-attack"), 0, 100, 2), |
eEG2PreAttack(_("Pre-attack Level (%)"), 0, 100, 2), |
209 |
eEG2Attack(_("Attack"), 0, 60, 3), |
eEG2Attack(_("Attack Time (seconds)"), 0, 60, 3), |
210 |
eEG2Decay1(_("Decay 1"), 0.005, 60, 3), |
eEG2Decay1(_("Decay 1 Time (seconds)"), 0.005, 60, 3), |
211 |
eEG2Decay2(_("Decay 2"), 0, 60, 3), |
eEG2Decay2(_("Decay 2 Time (seconds)"), 0, 60, 3), |
212 |
eEG2InfiniteSustain(_("Infinite sustain")), |
eEG2InfiniteSustain(_("Infinite sustain")), |
213 |
eEG2Sustain(_("Sustain"), 0, 100, 2), |
eEG2Sustain(_("Sustain Level (%)"), 0, 100, 2), |
214 |
eEG2Release(_("Release"), 0, 60, 3), |
eEG2Release(_("Release Time (seconds)"), 0, 60, 3), |
215 |
eEG2Controller(_("Controller")), |
eEG2Controller(_("Controller")), |
216 |
eEG2ControllerInvert(_("Controller invert")), |
eEG2ControllerInvert(_("Controller invert")), |
217 |
eEG2ControllerAttackInfluence(_("Controller attack influence"), 0, 3), |
eEG2ControllerAttackInfluence(_("Controller attack influence"), 0, 3), |
256 |
ePitchTrack(_("Pitch track")), |
ePitchTrack(_("Pitch track")), |
257 |
eDimensionBypass(_("Dimension bypass")), |
eDimensionBypass(_("Dimension bypass")), |
258 |
ePan(_("Pan"), -64, 63), |
ePan(_("Pan"), -64, 63), |
259 |
eSelfMask(_("Self mask")), |
eSelfMask(_("Kill lower velocity voices (a.k.a \"Self mask\")")), |
260 |
eAttenuationController(_("Attenuation controller")), |
eAttenuationController(_("Attenuation controller")), |
261 |
eInvertAttenuationController(_("Invert attenuation controller")), |
eInvertAttenuationController(_("Invert attenuation controller")), |
262 |
eAttenuationControllerThreshold(_("Attenuation controller threshold")), |
eAttenuationControllerThreshold(_("Attenuation controller threshold")), |
263 |
eChannelOffset(_("Channel offset"), 0, 9), |
eChannelOffset(_("Channel offset"), 0, 9), |
264 |
eSustainDefeat(_("Sustain defeat")), |
eSustainDefeat(_("Ignore Hold Pedal (a.k.a. \"Sustain defeat\")")), |
265 |
eMSDecode(_("MS decode")), |
eMSDecode(_("Decode Mid/Side Recordings")), |
266 |
eSampleStartOffset(_("Sample start offset"), 0, 2000), |
eSampleStartOffset(_("Sample start offset"), 0, 2000), |
267 |
eUnityNote(_("Unity note")), |
eUnityNote(_("Unity note")), |
268 |
|
eSampleGroup(_("Sample Group")), |
269 |
|
eSampleFormatInfo(_("Sample Format")), |
270 |
|
eSampleID("Sample ID"), |
271 |
|
eChecksum("Wave Data CRC-32"), |
272 |
eFineTune(_("Fine tune"), -49, 50), |
eFineTune(_("Fine tune"), -49, 50), |
273 |
eGain(_("Gain"), -96, 0, 2, -655360), |
eGain(_("Gain"), -96, 0, 2, -655360), |
274 |
eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360), |
eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360), |
278 |
eSampleLoopType(_("Loop type")), |
eSampleLoopType(_("Loop type")), |
279 |
eSampleLoopInfinite(_("Infinite loop")), |
eSampleLoopInfinite(_("Infinite loop")), |
280 |
eSampleLoopPlayCount(_("Playback count"), 1), |
eSampleLoopPlayCount(_("Playback count"), 1), |
281 |
|
buttonSelectSample(UNICODE_LEFT_ARROW + " " + _("Select Sample")), |
282 |
update_model(0) |
update_model(0) |
283 |
{ |
{ |
284 |
|
// make synthesis parameter page tabs scrollable |
285 |
|
// (workaround for GTK3: default theme uses huge tabs which breaks layout) |
286 |
|
set_scrollable(); |
287 |
|
|
288 |
connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack); |
connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack); |
289 |
connect(eEG1Attack, &gig::DimensionRegion::EG1Attack); |
connect(eEG1Attack, &gig::DimensionRegion::EG1Attack); |
290 |
connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1); |
connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1); |
301 |
&gig::DimensionRegion::EG1ControllerDecayInfluence); |
&gig::DimensionRegion::EG1ControllerDecayInfluence); |
302 |
connect(eEG1ControllerReleaseInfluence, |
connect(eEG1ControllerReleaseInfluence, |
303 |
&gig::DimensionRegion::EG1ControllerReleaseInfluence); |
&gig::DimensionRegion::EG1ControllerReleaseInfluence); |
304 |
|
{ |
305 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.AttackCancel)); |
306 |
|
connect(eEG1StateOptions.checkBoxAttack, mp.pmember); |
307 |
|
} |
308 |
|
{ |
309 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.AttackHoldCancel)); |
310 |
|
connect(eEG1StateOptions.checkBoxAttackHold, mp.pmember); |
311 |
|
} |
312 |
|
{ |
313 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.Decay1Cancel)); |
314 |
|
connect(eEG1StateOptions.checkBoxDecay1, mp.pmember); |
315 |
|
} |
316 |
|
{ |
317 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.Decay2Cancel)); |
318 |
|
connect(eEG1StateOptions.checkBoxDecay2, mp.pmember); |
319 |
|
} |
320 |
|
{ |
321 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.ReleaseCancel)); |
322 |
|
connect(eEG1StateOptions.checkBoxRelease, mp.pmember); |
323 |
|
} |
324 |
connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency); |
connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency); |
325 |
connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth); |
connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth); |
326 |
connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth); |
connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth); |
342 |
&gig::DimensionRegion::EG2ControllerDecayInfluence); |
&gig::DimensionRegion::EG2ControllerDecayInfluence); |
343 |
connect(eEG2ControllerReleaseInfluence, |
connect(eEG2ControllerReleaseInfluence, |
344 |
&gig::DimensionRegion::EG2ControllerReleaseInfluence); |
&gig::DimensionRegion::EG2ControllerReleaseInfluence); |
345 |
|
{ |
346 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.AttackCancel)); |
347 |
|
connect(eEG2StateOptions.checkBoxAttack, mp.pmember); |
348 |
|
} |
349 |
|
{ |
350 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.AttackHoldCancel)); |
351 |
|
connect(eEG2StateOptions.checkBoxAttackHold, mp.pmember); |
352 |
|
} |
353 |
|
{ |
354 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.Decay1Cancel)); |
355 |
|
connect(eEG2StateOptions.checkBoxDecay1, mp.pmember); |
356 |
|
} |
357 |
|
{ |
358 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.Decay2Cancel)); |
359 |
|
connect(eEG2StateOptions.checkBoxDecay2, mp.pmember); |
360 |
|
} |
361 |
|
{ |
362 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.ReleaseCancel)); |
363 |
|
connect(eEG2StateOptions.checkBoxRelease, mp.pmember); |
364 |
|
} |
365 |
connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency); |
connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency); |
366 |
connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth); |
connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth); |
367 |
connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth); |
connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth); |
432 |
connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength); |
connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength); |
433 |
connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite); |
connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite); |
434 |
connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount); |
connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount); |
435 |
|
buttonSelectSample.signal_clicked().connect( |
436 |
|
sigc::mem_fun(*this, &DimRegionEdit::onButtonSelectSamplePressed) |
437 |
|
); |
438 |
|
|
439 |
for (int i = 0 ; i < 7 ; i++) { |
for (int i = 0 ; i < 7 ; i++) { |
440 |
table[i] = new Gtk::Table(3, 1); |
table[i] = new Gtk::Table(3, 1); |
445 |
eUnityNote.set_tip( |
eUnityNote.set_tip( |
446 |
_("Note this sample is associated with (a.k.a. 'root note')") |
_("Note this sample is associated with (a.k.a. 'root note')") |
447 |
); |
); |
448 |
|
buttonSelectSample.set_tooltip_text( |
449 |
|
_("Selects the sample of this dimension region on the left hand side's sample tree view.") |
450 |
|
); |
451 |
eSampleStartOffset.set_tip(_("Sample position at which playback should be started")); |
eSampleStartOffset.set_tip(_("Sample position at which playback should be started")); |
452 |
ePan.set_tip(_("Stereo balance (left/right)")); |
ePan.set_tip(_("Stereo balance (left/right)")); |
453 |
eChannelOffset.set_tip( |
eChannelOffset.set_tip( |
478 |
"Caution: this setting is stored on Sample side, thus is shared " |
"Caution: this setting is stored on Sample side, thus is shared " |
479 |
"among all dimension regions that use this sample!") |
"among all dimension regions that use this sample!") |
480 |
); |
); |
481 |
|
|
482 |
|
eEG1PreAttack.set_tip( |
483 |
|
"Very first level this EG starts with. It rises then in Attack Time " |
484 |
|
"seconds from this initial level to 100%." |
485 |
|
); |
486 |
|
eEG1Attack.set_tip( |
487 |
|
"Duration of the EG's Attack stage, which raises its level from " |
488 |
|
"Pre-Attack Level to 100%." |
489 |
|
); |
490 |
|
eEG1Hold.set_tip( |
491 |
|
"On looped sounds, enabling this will cause the Decay 1 stage not to " |
492 |
|
"enter before the loop has been passed one time." |
493 |
|
); |
494 |
|
eAttenuationController.set_tip(_( |
495 |
|
"If you are not using the 'Layer' dimension, then this controller " |
496 |
|
"simply alters the volume. If you are using the 'Layer' dimension, " |
497 |
|
"then this controller is controlling the crossfade between Layers in " |
498 |
|
"real-time." |
499 |
|
)); |
500 |
|
|
501 |
|
eLFO1Sync.set_tip( |
502 |
|
"If not checked, every voice will use its own LFO instance, which " |
503 |
|
"causes voices triggered at different points in time to have different " |
504 |
|
"LFO levels. By enabling 'Sync' here the voices will instead use and " |
505 |
|
"share one single LFO, causing all voices to have the same LFO level, " |
506 |
|
"no matter when the individual notes have been triggered." |
507 |
|
); |
508 |
|
eLFO2Sync.set_tip( |
509 |
|
"If not checked, every voice will use its own LFO instance, which " |
510 |
|
"causes voices triggered at different points in time to have different " |
511 |
|
"LFO levels. By enabling 'Sync' here the voices will instead use and " |
512 |
|
"share one single LFO, causing all voices to have the same LFO level, " |
513 |
|
"no matter when the individual notes have been triggered." |
514 |
|
); |
515 |
|
eLFO3Sync.set_tip( |
516 |
|
"If not checked, every voice will use its own LFO instance, which " |
517 |
|
"causes voices triggered at different points in time to have different " |
518 |
|
"LFO levels. By enabling 'Sync' here the voices will instead use and " |
519 |
|
"share one single LFO, causing all voices to have the same LFO level, " |
520 |
|
"no matter when the individual notes have been triggered." |
521 |
|
); |
522 |
|
eLFO1FlipPhase.set_tip( |
523 |
|
"Inverts the LFO's generated wave vertically." |
524 |
|
); |
525 |
|
eLFO2FlipPhase.set_tip( |
526 |
|
"Inverts the LFO's generated wave vertically." |
527 |
|
); |
528 |
|
|
529 |
pageno = 0; |
pageno = 0; |
530 |
rowno = 0; |
rowno = 0; |
531 |
firstRowInBlock = 0; |
firstRowInBlock = 0; |
532 |
|
|
533 |
addHeader(_("Mandatory Settings")); |
addHeader(_("Mandatory Settings")); |
534 |
addString(_("Sample"), lSample, wSample); |
addString(_("Sample"), lSample, wSample, buttonNullSampleReference); |
535 |
|
buttonNullSampleReference->set_label("X"); |
536 |
|
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.")); |
537 |
|
buttonNullSampleReference->signal_clicked().connect( |
538 |
|
sigc::mem_fun(*this, &DimRegionEdit::nullOutSampleReference) |
539 |
|
); |
540 |
//TODO: the following would break drag&drop: wSample->property_editable().set_value(false); or this: wSample->set_editable(false); |
//TODO: the following would break drag&drop: wSample->property_editable().set_value(false); or this: wSample->set_editable(false); |
541 |
#ifdef OLD_TOOLTIPS |
#ifdef OLD_TOOLTIPS |
542 |
tooltips.set_tip(*wSample, _("Drop a sample here")); |
tooltips.set_tip(*wSample, _("Drag & drop a sample here")); |
543 |
#else |
#else |
544 |
wSample->set_tooltip_text(_("Drop a sample here")); |
wSample->set_tooltip_text(_("Drag & drop a sample here")); |
545 |
#endif |
#endif |
546 |
addProp(eUnityNote); |
addProp(eUnityNote); |
547 |
|
addProp(eSampleGroup); |
548 |
|
addProp(eSampleFormatInfo); |
549 |
|
addProp(eSampleID); |
550 |
|
addProp(eChecksum); |
551 |
|
addRightHandSide(buttonSelectSample); |
552 |
addHeader(_("Optional Settings")); |
addHeader(_("Optional Settings")); |
553 |
addProp(eSampleStartOffset); |
addProp(eSampleStartOffset); |
554 |
addProp(eChannelOffset); |
addProp(eChannelOffset); |
578 |
addHeader(_("Amplitude Envelope (EG1)")); |
addHeader(_("Amplitude Envelope (EG1)")); |
579 |
addProp(eEG1PreAttack); |
addProp(eEG1PreAttack); |
580 |
addProp(eEG1Attack); |
addProp(eEG1Attack); |
581 |
|
addProp(eEG1Hold); |
582 |
addProp(eEG1Decay1); |
addProp(eEG1Decay1); |
583 |
addProp(eEG1Decay2); |
addProp(eEG1Decay2); |
584 |
addProp(eEG1InfiniteSustain); |
addProp(eEG1InfiniteSustain); |
585 |
addProp(eEG1Sustain); |
addProp(eEG1Sustain); |
586 |
addProp(eEG1Release); |
addProp(eEG1Release); |
|
addProp(eEG1Hold); |
|
587 |
addProp(eEG1Controller); |
addProp(eEG1Controller); |
588 |
addProp(eEG1ControllerInvert); |
addProp(eEG1ControllerInvert); |
589 |
addProp(eEG1ControllerAttackInfluence); |
addProp(eEG1ControllerAttackInfluence); |
590 |
addProp(eEG1ControllerDecayInfluence); |
addProp(eEG1ControllerDecayInfluence); |
591 |
addProp(eEG1ControllerReleaseInfluence); |
addProp(eEG1ControllerReleaseInfluence); |
592 |
|
addLine(eEG1StateOptions); |
593 |
|
|
594 |
nextPage(); |
nextPage(); |
595 |
|
|
735 |
addProp(eEG2ControllerAttackInfluence); |
addProp(eEG2ControllerAttackInfluence); |
736 |
addProp(eEG2ControllerDecayInfluence); |
addProp(eEG2ControllerDecayInfluence); |
737 |
addProp(eEG2ControllerReleaseInfluence); |
addProp(eEG2ControllerReleaseInfluence); |
738 |
|
addLine(eEG2StateOptions); |
739 |
lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)")); |
lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)")); |
740 |
addProp(eLFO2Frequency); |
addProp(eLFO2Frequency); |
741 |
addProp(eLFO2InternalDepth); |
addProp(eLFO2InternalDepth); |
785 |
|
|
786 |
nextPage(); |
nextPage(); |
787 |
|
|
788 |
addHeader(_("Velocity Reponse")); |
addHeader(_("Velocity Response")); |
789 |
eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values); |
eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values); |
790 |
addProp(eVelocityResponseCurve); |
addProp(eVelocityResponseCurve); |
791 |
addProp(eVelocityResponseDepth); |
addProp(eVelocityResponseDepth); |
804 |
Gtk::SHRINK, Gtk::SHRINK); |
Gtk::SHRINK, Gtk::SHRINK); |
805 |
rowno++; |
rowno++; |
806 |
|
|
807 |
addHeader(_("Release Velocity Reponse")); |
addHeader(_("Release Velocity Response")); |
808 |
eReleaseVelocityResponseCurve.set_choices(curve_type_texts, |
eReleaseVelocityResponseCurve.set_choices(curve_type_texts, |
809 |
curve_type_values); |
curve_type_values); |
810 |
addProp(eReleaseVelocityResponseCurve); |
addProp(eReleaseVelocityResponseCurve); |
831 |
eDimensionBypass.set_choices(choices, values); |
eDimensionBypass.set_choices(choices, values); |
832 |
} |
} |
833 |
addProp(eDimensionBypass); |
addProp(eDimensionBypass); |
834 |
|
eSelfMask.widget.set_tooltip_text(_( |
835 |
|
"If enabled: new notes with higher velocity value will stop older " |
836 |
|
"notes with lower velocity values, that way you can save voices that " |
837 |
|
"would barely be audible. This is also useful for certain drum sounds." |
838 |
|
)); |
839 |
addProp(eSelfMask); |
addProp(eSelfMask); |
840 |
|
eSustainDefeat.widget.set_tooltip_text(_( |
841 |
|
"If enabled: sustain pedal will not hold a note. This way you can use " |
842 |
|
"the sustain pedal for other purposes, for example to switch among " |
843 |
|
"dimension regions." |
844 |
|
)); |
845 |
addProp(eSustainDefeat); |
addProp(eSustainDefeat); |
846 |
|
eMSDecode.widget.set_tooltip_text(_( |
847 |
|
"Defines if Mid/Side Recordings should be decoded. Mid/Side Recordings " |
848 |
|
"are an alternative way to record sounds in stereo. The sampler needs " |
849 |
|
"to decode such samples to actually make use of them. Note: this " |
850 |
|
"feature is currently not supported by LinuxSampler." |
851 |
|
)); |
852 |
addProp(eMSDecode); |
addProp(eMSDecode); |
853 |
|
|
854 |
nextPage(); |
nextPage(); |
925 |
rowno++; |
rowno++; |
926 |
} |
} |
927 |
|
|
928 |
|
void DimRegionEdit::addString(const char* labelText, Gtk::Label*& label, |
929 |
|
Gtk::Entry*& widget, Gtk::Button*& button) |
930 |
|
{ |
931 |
|
label = new Gtk::Label(Glib::ustring(labelText) + ":"); |
932 |
|
label->set_alignment(Gtk::ALIGN_START); |
933 |
|
|
934 |
|
table[pageno]->attach(*label, 1, 2, rowno, rowno + 1, |
935 |
|
Gtk::FILL, Gtk::SHRINK); |
936 |
|
|
937 |
|
widget = new Gtk::Entry(); |
938 |
|
button = new Gtk::Button(); |
939 |
|
|
940 |
|
Gtk::HBox* hbox = new Gtk::HBox; |
941 |
|
hbox->pack_start(*widget); |
942 |
|
hbox->pack_start(*button, Gtk::PACK_SHRINK); |
943 |
|
|
944 |
|
table[pageno]->attach(*hbox, 2, 3, rowno, rowno + 1, |
945 |
|
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
946 |
|
|
947 |
|
rowno++; |
948 |
|
} |
949 |
|
|
950 |
Gtk::Label* DimRegionEdit::addHeader(const char* text) |
Gtk::Label* DimRegionEdit::addHeader(const char* text) |
951 |
{ |
{ |
952 |
if (firstRowInBlock < rowno - 1) |
if (firstRowInBlock < rowno - 1) |
1004 |
rowno++; |
rowno++; |
1005 |
} |
} |
1006 |
|
|
1007 |
|
void DimRegionEdit::addLine(Gtk::HBox& line) |
1008 |
|
{ |
1009 |
|
table[pageno]->attach(line, 1, 3, rowno, rowno + 1, |
1010 |
|
Gtk::FILL, Gtk::SHRINK); |
1011 |
|
rowno++; |
1012 |
|
} |
1013 |
|
|
1014 |
|
void DimRegionEdit::addRightHandSide(Gtk::Widget& widget) |
1015 |
|
{ |
1016 |
|
table[pageno]->attach(widget, 2, 3, rowno, rowno + 1, |
1017 |
|
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
1018 |
|
rowno++; |
1019 |
|
} |
1020 |
|
|
1021 |
void DimRegionEdit::set_dim_region(gig::DimensionRegion* d) |
void DimRegionEdit::set_dim_region(gig::DimensionRegion* d) |
1022 |
{ |
{ |
1043 |
eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence); |
eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence); |
1044 |
eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence); |
eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence); |
1045 |
eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence); |
eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence); |
1046 |
|
eEG1StateOptions.checkBoxAttack.set_value(d->EG1Options.AttackCancel); |
1047 |
|
eEG1StateOptions.checkBoxAttackHold.set_value(d->EG1Options.AttackHoldCancel); |
1048 |
|
eEG1StateOptions.checkBoxDecay1.set_value(d->EG1Options.Decay1Cancel); |
1049 |
|
eEG1StateOptions.checkBoxDecay2.set_value(d->EG1Options.Decay2Cancel); |
1050 |
|
eEG1StateOptions.checkBoxRelease.set_value(d->EG1Options.ReleaseCancel); |
1051 |
eLFO1Frequency.set_value(d->LFO1Frequency); |
eLFO1Frequency.set_value(d->LFO1Frequency); |
1052 |
eLFO1InternalDepth.set_value(d->LFO1InternalDepth); |
eLFO1InternalDepth.set_value(d->LFO1InternalDepth); |
1053 |
eLFO1ControlDepth.set_value(d->LFO1ControlDepth); |
eLFO1ControlDepth.set_value(d->LFO1ControlDepth); |
1066 |
eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence); |
eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence); |
1067 |
eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence); |
eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence); |
1068 |
eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence); |
eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence); |
1069 |
|
eEG2StateOptions.checkBoxAttack.set_value(d->EG2Options.AttackCancel); |
1070 |
|
eEG2StateOptions.checkBoxAttackHold.set_value(d->EG2Options.AttackHoldCancel); |
1071 |
|
eEG2StateOptions.checkBoxDecay1.set_value(d->EG2Options.Decay1Cancel); |
1072 |
|
eEG2StateOptions.checkBoxDecay2.set_value(d->EG2Options.Decay2Cancel); |
1073 |
|
eEG2StateOptions.checkBoxRelease.set_value(d->EG2Options.ReleaseCancel); |
1074 |
eLFO2Frequency.set_value(d->LFO2Frequency); |
eLFO2Frequency.set_value(d->LFO2Frequency); |
1075 |
eLFO2InternalDepth.set_value(d->LFO2InternalDepth); |
eLFO2InternalDepth.set_value(d->LFO2InternalDepth); |
1076 |
eLFO2ControlDepth.set_value(d->LFO2ControlDepth); |
eLFO2ControlDepth.set_value(d->LFO2ControlDepth); |
1119 |
eMSDecode.set_value(d->MSDecode); |
eMSDecode.set_value(d->MSDecode); |
1120 |
eSampleStartOffset.set_value(d->SampleStartOffset); |
eSampleStartOffset.set_value(d->SampleStartOffset); |
1121 |
eUnityNote.set_value(d->UnityNote); |
eUnityNote.set_value(d->UnityNote); |
1122 |
|
// show sample group name |
1123 |
|
{ |
1124 |
|
Glib::ustring s = "---"; |
1125 |
|
if (d->pSample && d->pSample->GetGroup()) |
1126 |
|
s = d->pSample->GetGroup()->Name; |
1127 |
|
eSampleGroup.text.set_text(s); |
1128 |
|
} |
1129 |
|
// assemble sample format info string |
1130 |
|
{ |
1131 |
|
Glib::ustring s; |
1132 |
|
if (d->pSample) { |
1133 |
|
switch (d->pSample->Channels) { |
1134 |
|
case 1: s = _("Mono"); break; |
1135 |
|
case 2: s = _("Stereo"); break; |
1136 |
|
default: |
1137 |
|
s = ToString(d->pSample->Channels) + _(" audio channels"); |
1138 |
|
break; |
1139 |
|
} |
1140 |
|
s += " " + ToString(d->pSample->BitDepth) + " Bits"; |
1141 |
|
s += " " + ToString(d->pSample->SamplesPerSecond/1000) + "." |
1142 |
|
+ ToString((d->pSample->SamplesPerSecond%1000)/100) + " kHz"; |
1143 |
|
} else { |
1144 |
|
s = _("No sample assigned to this dimension region."); |
1145 |
|
} |
1146 |
|
eSampleFormatInfo.text.set_text(s); |
1147 |
|
} |
1148 |
|
// generate sample's memory address pointer string |
1149 |
|
{ |
1150 |
|
Glib::ustring s; |
1151 |
|
if (d->pSample) { |
1152 |
|
char buf[64] = {}; |
1153 |
|
snprintf(buf, sizeof(buf), "%p", d->pSample); |
1154 |
|
s = buf; |
1155 |
|
} else { |
1156 |
|
s = "---"; |
1157 |
|
} |
1158 |
|
eSampleID.text.set_text(s); |
1159 |
|
} |
1160 |
|
// generate raw wave form data CRC-32 checksum string |
1161 |
|
{ |
1162 |
|
Glib::ustring s = "---"; |
1163 |
|
if (d->pSample) { |
1164 |
|
char buf[64] = {}; |
1165 |
|
snprintf(buf, sizeof(buf), "%x", d->pSample->GetWaveDataCRC32Checksum()); |
1166 |
|
s = buf; |
1167 |
|
} |
1168 |
|
eChecksum.text.set_text(s); |
1169 |
|
} |
1170 |
|
buttonSelectSample.set_sensitive(d && d->pSample); |
1171 |
eFineTune.set_value(d->FineTune); |
eFineTune.set_value(d->FineTune); |
1172 |
eGain.set_value(d->Gain); |
eGain.set_value(d->Gain); |
1173 |
eGainPlus6.set_value(d->Gain); |
eGainPlus6.set_value(d->Gain); |
1184 |
d->pSample ? d->pSample->LoopPlayCount : 0); |
d->pSample ? d->pSample->LoopPlayCount : 0); |
1185 |
update_model--; |
update_model--; |
1186 |
|
|
1187 |
wSample->set_text(d->pSample ? d->pSample->pInfo->Name.c_str() : _("NULL")); |
wSample->set_text(d->pSample ? gig_to_utf8(d->pSample->pInfo->Name) : |
1188 |
|
_("NULL")); |
1189 |
|
|
1190 |
update_loop_elements(); |
update_loop_elements(); |
1191 |
VCFEnabled_toggled(); |
VCFEnabled_toggled(); |
1200 |
eVCFVelocityCurve.set_sensitive(sensitive); |
eVCFVelocityCurve.set_sensitive(sensitive); |
1201 |
eVCFVelocityScale.set_sensitive(sensitive); |
eVCFVelocityScale.set_sensitive(sensitive); |
1202 |
eVCFVelocityDynamicRange.set_sensitive(sensitive); |
eVCFVelocityDynamicRange.set_sensitive(sensitive); |
1203 |
|
cutoff_curve.set_sensitive(sensitive); |
1204 |
eVCFResonance.set_sensitive(sensitive); |
eVCFResonance.set_sensitive(sensitive); |
1205 |
eVCFResonanceController.set_sensitive(sensitive); |
eVCFResonanceController.set_sensitive(sensitive); |
1206 |
eVCFKeyboardTracking.set_sensitive(sensitive); |
eVCFKeyboardTracking.set_sensitive(sensitive); |
1216 |
eEG2ControllerAttackInfluence.set_sensitive(sensitive); |
eEG2ControllerAttackInfluence.set_sensitive(sensitive); |
1217 |
eEG2ControllerDecayInfluence.set_sensitive(sensitive); |
eEG2ControllerDecayInfluence.set_sensitive(sensitive); |
1218 |
eEG2ControllerReleaseInfluence.set_sensitive(sensitive); |
eEG2ControllerReleaseInfluence.set_sensitive(sensitive); |
1219 |
|
eEG2StateOptions.set_sensitive(sensitive); |
1220 |
lLFO2->set_sensitive(sensitive); |
lLFO2->set_sensitive(sensitive); |
1221 |
eLFO2Frequency.set_sensitive(sensitive); |
eLFO2Frequency.set_sensitive(sensitive); |
1222 |
eLFO2InternalDepth.set_sensitive(sensitive); |
eLFO2InternalDepth.set_sensitive(sensitive); |
1294 |
eCrossfade_in_end.set_sensitive(hasController); |
eCrossfade_in_end.set_sensitive(hasController); |
1295 |
eCrossfade_out_start.set_sensitive(hasController); |
eCrossfade_out_start.set_sensitive(hasController); |
1296 |
eCrossfade_out_end.set_sensitive(hasController); |
eCrossfade_out_end.set_sensitive(hasController); |
1297 |
|
crossfade_curve.set_sensitive(hasController); |
1298 |
} |
} |
1299 |
|
|
1300 |
void DimRegionEdit::LFO1Controller_changed() |
void DimRegionEdit::LFO1Controller_changed() |
1408 |
update_model--; |
update_model--; |
1409 |
} |
} |
1410 |
|
|
1411 |
bool DimRegionEdit::set_sample(gig::Sample* sample) |
bool DimRegionEdit::set_sample(gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop) |
1412 |
|
{ |
1413 |
|
bool result = false; |
1414 |
|
for (std::set<gig::DimensionRegion*>::iterator itDimReg = dimregs.begin(); |
1415 |
|
itDimReg != dimregs.end(); ++itDimReg) |
1416 |
|
{ |
1417 |
|
result |= set_sample(*itDimReg, sample, copy_sample_unity, copy_sample_tune, copy_sample_loop); |
1418 |
|
} |
1419 |
|
return result; |
1420 |
|
} |
1421 |
|
|
1422 |
|
bool DimRegionEdit::set_sample(gig::DimensionRegion* dimreg, gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop) |
1423 |
{ |
{ |
1424 |
if (dimregion) { |
if (dimreg) { |
1425 |
//TODO: we should better move the code from MainWindow::on_sample_label_drop_drag_data_received() here |
//TODO: we should better move the code from MainWindow::on_sample_label_drop_drag_data_received() here |
1426 |
|
|
1427 |
// currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received() |
// currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received() |
1428 |
//dimreg_to_be_changed_signal.emit(dimregion); |
//DimRegionChangeGuard(this, dimregion); |
1429 |
|
|
1430 |
// make sure stereo samples always are the same in both |
// make sure stereo samples always are the same in both |
1431 |
// dimregs in the samplechannel dimension |
// dimregs in the samplechannel dimension |
1432 |
int nbDimregs = 1; |
int nbDimregs = 1; |
1433 |
gig::DimensionRegion* d[2] = { dimregion, 0 }; |
gig::DimensionRegion* d[2] = { dimreg, 0 }; |
1434 |
if (sample->Channels == 2) { |
if (sample->Channels == 2) { |
1435 |
gig::Region* region = dimregion->GetParent(); |
gig::Region* region = dimreg->GetParent(); |
1436 |
|
|
1437 |
int bitcount = 0; |
int bitcount = 0; |
1438 |
int stereo_bit = 0; |
int stereo_bit = 0; |
1447 |
if (stereo_bit) { |
if (stereo_bit) { |
1448 |
int dimregno; |
int dimregno; |
1449 |
for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) { |
for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) { |
1450 |
if (region->pDimensionRegions[dimregno] == dimregion) { |
if (region->pDimensionRegions[dimregno] == dimreg) { |
1451 |
break; |
break; |
1452 |
} |
} |
1453 |
} |
} |
1457 |
} |
} |
1458 |
} |
} |
1459 |
|
|
1460 |
gig::Sample* oldref = dimregion->pSample; |
gig::Sample* oldref = dimreg->pSample; |
1461 |
|
|
1462 |
for (int i = 0 ; i < nbDimregs ; i++) { |
for (int i = 0 ; i < nbDimregs ; i++) { |
1463 |
d[i]->pSample = sample; |
d[i]->pSample = sample; |
1464 |
|
|
1465 |
// copy sample information from Sample to DimensionRegion |
// copy sample information from Sample to DimensionRegion |
1466 |
|
if (copy_sample_unity) |
1467 |
d[i]->UnityNote = sample->MIDIUnityNote; |
d[i]->UnityNote = sample->MIDIUnityNote; |
1468 |
d[i]->FineTune = sample->FineTune; |
if (copy_sample_tune) |
1469 |
|
d[i]->FineTune = sample->FineTune; |
1470 |
int loops = sample->Loops ? 1 : 0; |
if (copy_sample_loop) { |
1471 |
while (d[i]->SampleLoops > loops) { |
int loops = sample->Loops ? 1 : 0; |
1472 |
d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]); |
while (d[i]->SampleLoops > loops) { |
1473 |
} |
d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]); |
1474 |
while (d[i]->SampleLoops < sample->Loops) { |
} |
1475 |
DLS::sample_loop_t loop; |
while (d[i]->SampleLoops < sample->Loops) { |
1476 |
d[i]->AddSampleLoop(&loop); |
DLS::sample_loop_t loop; |
1477 |
} |
d[i]->AddSampleLoop(&loop); |
1478 |
if (loops) { |
} |
1479 |
d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t); |
if (loops) { |
1480 |
d[i]->pSampleLoops[0].LoopType = sample->LoopType; |
d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t); |
1481 |
d[i]->pSampleLoops[0].LoopStart = sample->LoopStart; |
d[i]->pSampleLoops[0].LoopType = sample->LoopType; |
1482 |
d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1; |
d[i]->pSampleLoops[0].LoopStart = sample->LoopStart; |
1483 |
|
d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1; |
1484 |
|
} |
1485 |
} |
} |
1486 |
} |
} |
1487 |
|
|
1488 |
// update ui |
// update ui |
1489 |
update_model++; |
update_model++; |
1490 |
wSample->set_text(dimregion->pSample->pInfo->Name); |
wSample->set_text(gig_to_utf8(dimreg->pSample->pInfo->Name)); |
1491 |
eUnityNote.set_value(dimregion->UnityNote); |
eUnityNote.set_value(dimreg->UnityNote); |
1492 |
eFineTune.set_value(dimregion->FineTune); |
eFineTune.set_value(dimreg->FineTune); |
1493 |
eSampleLoopEnabled.set_value(dimregion->SampleLoops); |
eSampleLoopEnabled.set_value(dimreg->SampleLoops); |
1494 |
update_loop_elements(); |
update_loop_elements(); |
1495 |
update_model--; |
update_model--; |
1496 |
|
|
1497 |
sample_ref_changed_signal.emit(oldref, sample); |
sample_ref_changed_signal.emit(oldref, sample); |
|
// currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received() |
|
|
//dimreg_changed_signal.emit(dimregion); |
|
1498 |
return true; |
return true; |
1499 |
} |
} |
1500 |
return false; |
return false; |
1563 |
if (value) { |
if (value) { |
1564 |
// create a new sample loop in case there is none yet |
// create a new sample loop in case there is none yet |
1565 |
if (!d->SampleLoops) { |
if (!d->SampleLoops) { |
1566 |
|
DimRegionChangeGuard(this, d); |
1567 |
|
|
1568 |
DLS::sample_loop_t loop; |
DLS::sample_loop_t loop; |
1569 |
loop.LoopType = gig::loop_type_normal; |
loop.LoopType = gig::loop_type_normal; |
1570 |
// loop the whole sample by default |
// loop the whole sample by default |
1571 |
loop.LoopStart = 0; |
loop.LoopStart = 0; |
1572 |
loop.LoopLength = |
loop.LoopLength = |
1573 |
(d->pSample) ? d->pSample->SamplesTotal : 0; |
(d->pSample) ? d->pSample->SamplesTotal : 0; |
|
dimreg_to_be_changed_signal.emit(d); |
|
1574 |
d->AddSampleLoop(&loop); |
d->AddSampleLoop(&loop); |
|
dimreg_changed_signal.emit(d); |
|
1575 |
} |
} |
1576 |
} else { |
} else { |
1577 |
if (d->SampleLoops) { |
if (d->SampleLoops) { |
1578 |
dimreg_to_be_changed_signal.emit(d); |
DimRegionChangeGuard(this, d); |
1579 |
|
|
1580 |
// delete ALL existing sample loops |
// delete ALL existing sample loops |
1581 |
while (d->SampleLoops) { |
while (d->SampleLoops) { |
1582 |
d->DeleteSampleLoop(&d->pSampleLoops[0]); |
d->DeleteSampleLoop(&d->pSampleLoops[0]); |
1583 |
} |
} |
|
dimreg_changed_signal.emit(d); |
|
1584 |
} |
} |
1585 |
} |
} |
1586 |
} |
} |
1624 |
{ |
{ |
1625 |
if (d->pSample) d->pSample->LoopPlayCount = value; |
if (d->pSample) d->pSample->LoopPlayCount = value; |
1626 |
} |
} |
1627 |
|
|
1628 |
|
void DimRegionEdit::nullOutSampleReference() { |
1629 |
|
if (!dimregion) return; |
1630 |
|
gig::Sample* oldref = dimregion->pSample; |
1631 |
|
if (!oldref) return; |
1632 |
|
|
1633 |
|
DimRegionChangeGuard(this, dimregion); |
1634 |
|
|
1635 |
|
// in case currently assigned sample is a stereo one, then remove both |
1636 |
|
// references (expected to be due to a "stereo dimension") |
1637 |
|
gig::DimensionRegion* d[2] = { dimregion, NULL }; |
1638 |
|
if (oldref->Channels == 2) { |
1639 |
|
gig::Region* region = dimregion->GetParent(); |
1640 |
|
{ |
1641 |
|
int stereo_bit = 0; |
1642 |
|
int bitcount = 0; |
1643 |
|
for (int dim = 0 ; dim < region->Dimensions ; dim++) { |
1644 |
|
if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) { |
1645 |
|
stereo_bit = 1 << bitcount; |
1646 |
|
break; |
1647 |
|
} |
1648 |
|
bitcount += region->pDimensionDefinitions[dim].bits; |
1649 |
|
} |
1650 |
|
|
1651 |
|
if (stereo_bit) { |
1652 |
|
int dimregno; |
1653 |
|
for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) { |
1654 |
|
if (region->pDimensionRegions[dimregno] == dimregion) { |
1655 |
|
break; |
1656 |
|
} |
1657 |
|
} |
1658 |
|
d[0] = region->pDimensionRegions[dimregno & ~stereo_bit]; |
1659 |
|
d[1] = region->pDimensionRegions[dimregno | stereo_bit]; |
1660 |
|
} |
1661 |
|
} |
1662 |
|
} |
1663 |
|
|
1664 |
|
if (d[0]) d[0]->pSample = NULL; |
1665 |
|
if (d[1]) d[1]->pSample = NULL; |
1666 |
|
|
1667 |
|
// update UI elements |
1668 |
|
set_dim_region(dimregion); |
1669 |
|
|
1670 |
|
sample_ref_changed_signal.emit(oldref, NULL); |
1671 |
|
} |
1672 |
|
|
1673 |
|
void DimRegionEdit::onButtonSelectSamplePressed() { |
1674 |
|
if (!dimregion) return; |
1675 |
|
if (!dimregion->pSample) return; |
1676 |
|
select_sample_signal.emit(dimregion->pSample); |
1677 |
|
} |
1678 |
|
|
1679 |
|
sigc::signal<void, gig::Sample*>& DimRegionEdit::signal_select_sample() { |
1680 |
|
return select_sample_signal; |
1681 |
|
} |