1 |
/* |
/* |
2 |
* Copyright (C) 2006-2014 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)) : |
147 |
} |
} |
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 |
|
|
185 |
DimRegionEdit::DimRegionEdit() : |
DimRegionEdit::DimRegionEdit() : |
186 |
velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation), |
velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation), |
187 |
release_curve(&gig::DimensionRegion::GetVelocityRelease), |
release_curve(&gig::DimensionRegion::GetVelocityRelease), |
265 |
eMSDecode(_("Decode Mid/Side Recordings")), |
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( |
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, _("Drag & drop a sample here")); |
tooltips.set_tip(*wSample, _("Drag & drop a sample here")); |
544 |
wSample->set_tooltip_text(_("Drag & 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); |
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); |
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); |
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); |
1410 |
|
|
1411 |
bool DimRegionEdit::set_sample(gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop) |
bool DimRegionEdit::set_sample(gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop) |
1412 |
{ |
{ |
1413 |
if (dimregion) { |
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 (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; |
1487 |
|
|
1488 |
// update ui |
// update ui |
1489 |
update_model++; |
update_model++; |
1490 |
wSample->set_text(gig_to_utf8(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 |
|
} |