1 |
/* |
/* |
2 |
* Copyright (C) 2006-2015 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 |
|
#if USE_GTKMM_GRID |
26 |
|
# include <gtkmm/grid.h> |
27 |
|
#else |
28 |
|
# include <gtkmm/table.h> |
29 |
|
#endif |
30 |
|
|
31 |
VelocityCurve::VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t)) : |
VelocityCurve::VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t)) : |
32 |
getter(getter), dimreg(0) { |
getter(getter), dimreg(0) { |
33 |
set_size_request(80, 80); |
set_size_request(80, 80); |
153 |
} |
} |
154 |
|
|
155 |
|
|
156 |
|
EGStateOptions::EGStateOptions() : HBox(), |
157 |
|
label(_("May be cancelled: ")), |
158 |
|
checkBoxAttack(_("Attack")), |
159 |
|
checkBoxAttackHold(_("Attack Hold")), |
160 |
|
checkBoxDecay1(_("Decay 1")), |
161 |
|
checkBoxDecay2(_("Decay 2")), |
162 |
|
checkBoxRelease(_("Release")) |
163 |
|
{ |
164 |
|
set_spacing(6); |
165 |
|
|
166 |
|
pack_start(label); |
167 |
|
pack_start(checkBoxAttack, Gtk::PACK_SHRINK); |
168 |
|
pack_start(checkBoxAttackHold, Gtk::PACK_SHRINK); |
169 |
|
pack_start(checkBoxDecay1, Gtk::PACK_SHRINK); |
170 |
|
pack_start(checkBoxDecay2, Gtk::PACK_SHRINK); |
171 |
|
pack_start(checkBoxRelease, Gtk::PACK_SHRINK); |
172 |
|
|
173 |
|
checkBoxAttack.set_tooltip_text(_( |
174 |
|
"If checked: a note-off aborts the 'attack' stage." |
175 |
|
)); |
176 |
|
checkBoxAttackHold.set_tooltip_text(_( |
177 |
|
"If checked: a note-off aborts the 'attack hold' stage." |
178 |
|
)); |
179 |
|
checkBoxDecay1.set_tooltip_text(_( |
180 |
|
"If checked: a note-off aborts the 'decay 1' stage." |
181 |
|
)); |
182 |
|
checkBoxDecay2.set_tooltip_text(_( |
183 |
|
"If checked: a note-off aborts the 'decay 2' stage." |
184 |
|
)); |
185 |
|
checkBoxRelease.set_tooltip_text(_( |
186 |
|
"If checked: a note-on reverts back from the 'release' stage." |
187 |
|
)); |
188 |
|
} |
189 |
|
|
190 |
|
|
191 |
DimRegionEdit::DimRegionEdit() : |
DimRegionEdit::DimRegionEdit() : |
192 |
velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation), |
velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation), |
193 |
release_curve(&gig::DimensionRegion::GetVelocityRelease), |
release_curve(&gig::DimensionRegion::GetVelocityRelease), |
271 |
eMSDecode(_("Decode Mid/Side Recordings")), |
eMSDecode(_("Decode Mid/Side Recordings")), |
272 |
eSampleStartOffset(_("Sample start offset"), 0, 2000), |
eSampleStartOffset(_("Sample start offset"), 0, 2000), |
273 |
eUnityNote(_("Unity note")), |
eUnityNote(_("Unity note")), |
274 |
|
eSampleGroup(_("Sample Group")), |
275 |
eSampleFormatInfo(_("Sample Format")), |
eSampleFormatInfo(_("Sample Format")), |
276 |
eSampleID("Sample ID"), |
eSampleID("Sample ID"), |
277 |
|
eChecksum("Wave Data CRC-32"), |
278 |
eFineTune(_("Fine tune"), -49, 50), |
eFineTune(_("Fine tune"), -49, 50), |
279 |
eGain(_("Gain"), -96, 0, 2, -655360), |
eGain(_("Gain"), -96, 0, 2, -655360), |
280 |
eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360), |
eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360), |
284 |
eSampleLoopType(_("Loop type")), |
eSampleLoopType(_("Loop type")), |
285 |
eSampleLoopInfinite(_("Infinite loop")), |
eSampleLoopInfinite(_("Infinite loop")), |
286 |
eSampleLoopPlayCount(_("Playback count"), 1), |
eSampleLoopPlayCount(_("Playback count"), 1), |
287 |
buttonSelectSample(Glib::ustring("<- ") + _("Select Sample")), |
buttonSelectSample(UNICODE_LEFT_ARROW + " " + _("Select Sample")), |
288 |
update_model(0) |
update_model(0) |
289 |
{ |
{ |
290 |
|
// make synthesis parameter page tabs scrollable |
291 |
|
// (workaround for GTK3: default theme uses huge tabs which breaks layout) |
292 |
|
set_scrollable(); |
293 |
|
|
294 |
connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack); |
connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack); |
295 |
connect(eEG1Attack, &gig::DimensionRegion::EG1Attack); |
connect(eEG1Attack, &gig::DimensionRegion::EG1Attack); |
296 |
connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1); |
connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1); |
307 |
&gig::DimensionRegion::EG1ControllerDecayInfluence); |
&gig::DimensionRegion::EG1ControllerDecayInfluence); |
308 |
connect(eEG1ControllerReleaseInfluence, |
connect(eEG1ControllerReleaseInfluence, |
309 |
&gig::DimensionRegion::EG1ControllerReleaseInfluence); |
&gig::DimensionRegion::EG1ControllerReleaseInfluence); |
310 |
|
{ |
311 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.AttackCancel)); |
312 |
|
connect(eEG1StateOptions.checkBoxAttack, mp.pmember); |
313 |
|
} |
314 |
|
{ |
315 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.AttackHoldCancel)); |
316 |
|
connect(eEG1StateOptions.checkBoxAttackHold, mp.pmember); |
317 |
|
} |
318 |
|
{ |
319 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.Decay1Cancel)); |
320 |
|
connect(eEG1StateOptions.checkBoxDecay1, mp.pmember); |
321 |
|
} |
322 |
|
{ |
323 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.Decay2Cancel)); |
324 |
|
connect(eEG1StateOptions.checkBoxDecay2, mp.pmember); |
325 |
|
} |
326 |
|
{ |
327 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.ReleaseCancel)); |
328 |
|
connect(eEG1StateOptions.checkBoxRelease, mp.pmember); |
329 |
|
} |
330 |
connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency); |
connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency); |
331 |
connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth); |
connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth); |
332 |
connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth); |
connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth); |
348 |
&gig::DimensionRegion::EG2ControllerDecayInfluence); |
&gig::DimensionRegion::EG2ControllerDecayInfluence); |
349 |
connect(eEG2ControllerReleaseInfluence, |
connect(eEG2ControllerReleaseInfluence, |
350 |
&gig::DimensionRegion::EG2ControllerReleaseInfluence); |
&gig::DimensionRegion::EG2ControllerReleaseInfluence); |
351 |
|
{ |
352 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.AttackCancel)); |
353 |
|
connect(eEG2StateOptions.checkBoxAttack, mp.pmember); |
354 |
|
} |
355 |
|
{ |
356 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.AttackHoldCancel)); |
357 |
|
connect(eEG2StateOptions.checkBoxAttackHold, mp.pmember); |
358 |
|
} |
359 |
|
{ |
360 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.Decay1Cancel)); |
361 |
|
connect(eEG2StateOptions.checkBoxDecay1, mp.pmember); |
362 |
|
} |
363 |
|
{ |
364 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.Decay2Cancel)); |
365 |
|
connect(eEG2StateOptions.checkBoxDecay2, mp.pmember); |
366 |
|
} |
367 |
|
{ |
368 |
|
ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.ReleaseCancel)); |
369 |
|
connect(eEG2StateOptions.checkBoxRelease, mp.pmember); |
370 |
|
} |
371 |
connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency); |
connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency); |
372 |
connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth); |
connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth); |
373 |
connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth); |
connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth); |
443 |
); |
); |
444 |
|
|
445 |
for (int i = 0 ; i < 7 ; i++) { |
for (int i = 0 ; i < 7 ; i++) { |
446 |
|
#if USE_GTKMM_GRID |
447 |
|
table[i] = new Gtk::Grid; |
448 |
|
table[i]->set_column_spacing(7); |
449 |
|
#else |
450 |
table[i] = new Gtk::Table(3, 1); |
table[i] = new Gtk::Table(3, 1); |
451 |
table[i]->set_col_spacings(7); |
table[i]->set_col_spacings(7); |
452 |
|
#endif |
453 |
|
|
454 |
} |
} |
455 |
|
|
456 |
// set tooltips |
// set tooltips |
543 |
firstRowInBlock = 0; |
firstRowInBlock = 0; |
544 |
|
|
545 |
addHeader(_("Mandatory Settings")); |
addHeader(_("Mandatory Settings")); |
546 |
addString(_("Sample"), lSample, wSample); |
addString(_("Sample"), lSample, wSample, buttonNullSampleReference); |
547 |
|
buttonNullSampleReference->set_label("X"); |
548 |
|
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.")); |
549 |
|
buttonNullSampleReference->signal_clicked().connect( |
550 |
|
sigc::mem_fun(*this, &DimRegionEdit::nullOutSampleReference) |
551 |
|
); |
552 |
//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); |
553 |
#ifdef OLD_TOOLTIPS |
#ifdef OLD_TOOLTIPS |
554 |
tooltips.set_tip(*wSample, _("Drag & drop a sample here")); |
tooltips.set_tip(*wSample, _("Drag & drop a sample here")); |
556 |
wSample->set_tooltip_text(_("Drag & drop a sample here")); |
wSample->set_tooltip_text(_("Drag & drop a sample here")); |
557 |
#endif |
#endif |
558 |
addProp(eUnityNote); |
addProp(eUnityNote); |
559 |
|
addProp(eSampleGroup); |
560 |
addProp(eSampleFormatInfo); |
addProp(eSampleFormatInfo); |
561 |
addProp(eSampleID); |
addProp(eSampleID); |
562 |
|
addProp(eChecksum); |
563 |
addRightHandSide(buttonSelectSample); |
addRightHandSide(buttonSelectSample); |
564 |
addHeader(_("Optional Settings")); |
addHeader(_("Optional Settings")); |
565 |
addProp(eSampleStartOffset); |
addProp(eSampleStartOffset); |
601 |
addProp(eEG1ControllerAttackInfluence); |
addProp(eEG1ControllerAttackInfluence); |
602 |
addProp(eEG1ControllerDecayInfluence); |
addProp(eEG1ControllerDecayInfluence); |
603 |
addProp(eEG1ControllerReleaseInfluence); |
addProp(eEG1ControllerReleaseInfluence); |
604 |
|
addLine(eEG1StateOptions); |
605 |
|
|
606 |
nextPage(); |
nextPage(); |
607 |
|
|
635 |
|
|
636 |
Gtk::Frame* frame = new Gtk::Frame; |
Gtk::Frame* frame = new Gtk::Frame; |
637 |
frame->add(crossfade_curve); |
frame->add(crossfade_curve); |
638 |
|
#if USE_GTKMM_GRID |
639 |
|
table[pageno]->attach(*frame, 1, rowno, 2); |
640 |
|
#else |
641 |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
642 |
Gtk::SHRINK, Gtk::SHRINK); |
Gtk::SHRINK, Gtk::SHRINK); |
643 |
|
#endif |
644 |
rowno++; |
rowno++; |
645 |
|
|
646 |
eCrossfade_in_start.signal_value_changed().connect( |
eCrossfade_in_start.signal_value_changed().connect( |
714 |
|
|
715 |
frame = new Gtk::Frame; |
frame = new Gtk::Frame; |
716 |
frame->add(cutoff_curve); |
frame->add(cutoff_curve); |
717 |
|
#if USE_GTKMM_GRID |
718 |
|
table[pageno]->attach(*frame, 1, rowno, 2); |
719 |
|
#else |
720 |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
721 |
Gtk::SHRINK, Gtk::SHRINK); |
Gtk::SHRINK, Gtk::SHRINK); |
722 |
|
#endif |
723 |
rowno++; |
rowno++; |
724 |
|
|
725 |
addProp(eVCFResonance); |
addProp(eVCFResonance); |
755 |
addProp(eEG2ControllerAttackInfluence); |
addProp(eEG2ControllerAttackInfluence); |
756 |
addProp(eEG2ControllerDecayInfluence); |
addProp(eEG2ControllerDecayInfluence); |
757 |
addProp(eEG2ControllerReleaseInfluence); |
addProp(eEG2ControllerReleaseInfluence); |
758 |
|
addLine(eEG2StateOptions); |
759 |
lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)")); |
lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)")); |
760 |
addProp(eLFO2Frequency); |
addProp(eLFO2Frequency); |
761 |
addProp(eLFO2InternalDepth); |
addProp(eLFO2InternalDepth); |
820 |
|
|
821 |
frame = new Gtk::Frame; |
frame = new Gtk::Frame; |
822 |
frame->add(velocity_curve); |
frame->add(velocity_curve); |
823 |
|
#if USE_GTKMM_GRID |
824 |
|
table[pageno]->attach(*frame, 1, rowno, 2); |
825 |
|
#else |
826 |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
827 |
Gtk::SHRINK, Gtk::SHRINK); |
Gtk::SHRINK, Gtk::SHRINK); |
828 |
|
#endif |
829 |
rowno++; |
rowno++; |
830 |
|
|
831 |
addHeader(_("Release Velocity Response")); |
addHeader(_("Release Velocity Response")); |
840 |
sigc::mem_fun(release_curve, &VelocityCurve::queue_draw)); |
sigc::mem_fun(release_curve, &VelocityCurve::queue_draw)); |
841 |
frame = new Gtk::Frame; |
frame = new Gtk::Frame; |
842 |
frame->add(release_curve); |
frame->add(release_curve); |
843 |
|
#if USE_GTKMM_GRID |
844 |
|
table[pageno]->attach(*frame, 1, rowno, 2); |
845 |
|
#else |
846 |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
847 |
Gtk::SHRINK, Gtk::SHRINK); |
Gtk::SHRINK, Gtk::SHRINK); |
848 |
|
#endif |
849 |
rowno++; |
rowno++; |
850 |
|
|
851 |
addProp(eReleaseTriggerDecay); |
addProp(eReleaseTriggerDecay); |
940 |
Gtk::Entry*& widget) |
Gtk::Entry*& widget) |
941 |
{ |
{ |
942 |
label = new Gtk::Label(Glib::ustring(labelText) + ":"); |
label = new Gtk::Label(Glib::ustring(labelText) + ":"); |
943 |
|
#if HAS_GTKMM_ALIGNMENT |
944 |
label->set_alignment(Gtk::ALIGN_START); |
label->set_alignment(Gtk::ALIGN_START); |
945 |
|
#else |
946 |
|
label->set_halign(Gtk::Align::START); |
947 |
|
#endif |
948 |
|
|
949 |
|
#if USE_GTKMM_GRID |
950 |
|
table[pageno]->attach(*label, 1, rowno); |
951 |
|
#else |
952 |
table[pageno]->attach(*label, 1, 2, rowno, rowno + 1, |
table[pageno]->attach(*label, 1, 2, rowno, rowno + 1, |
953 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
954 |
|
#endif |
955 |
|
|
956 |
widget = new Gtk::Entry(); |
widget = new Gtk::Entry(); |
957 |
|
|
958 |
|
#if USE_GTKMM_GRID |
959 |
|
table[pageno]->attach(*widget, 2, rowno); |
960 |
|
#else |
961 |
table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1, |
table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1, |
962 |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
963 |
|
#endif |
964 |
|
|
965 |
|
rowno++; |
966 |
|
} |
967 |
|
|
968 |
|
void DimRegionEdit::addString(const char* labelText, Gtk::Label*& label, |
969 |
|
Gtk::Entry*& widget, Gtk::Button*& button) |
970 |
|
{ |
971 |
|
label = new Gtk::Label(Glib::ustring(labelText) + ":"); |
972 |
|
#if HAS_GTKMM_ALIGNMENT |
973 |
|
label->set_alignment(Gtk::ALIGN_START); |
974 |
|
#else |
975 |
|
label->set_halign(Gtk::Align::START); |
976 |
|
#endif |
977 |
|
|
978 |
|
#if USE_GTKMM_GRID |
979 |
|
table[pageno]->attach(*label, 1, rowno); |
980 |
|
#else |
981 |
|
table[pageno]->attach(*label, 1, 2, rowno, rowno + 1, |
982 |
|
Gtk::FILL, Gtk::SHRINK); |
983 |
|
#endif |
984 |
|
|
985 |
|
widget = new Gtk::Entry(); |
986 |
|
button = new Gtk::Button(); |
987 |
|
|
988 |
|
HBox* hbox = new HBox; |
989 |
|
hbox->pack_start(*widget); |
990 |
|
hbox->pack_start(*button, Gtk::PACK_SHRINK); |
991 |
|
|
992 |
|
#if USE_GTKMM_GRID |
993 |
|
table[pageno]->attach(*hbox, 2, rowno); |
994 |
|
#else |
995 |
|
table[pageno]->attach(*hbox, 2, 3, rowno, rowno + 1, |
996 |
|
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
997 |
|
#endif |
998 |
|
|
999 |
rowno++; |
rowno++; |
1000 |
} |
} |
1004 |
if (firstRowInBlock < rowno - 1) |
if (firstRowInBlock < rowno - 1) |
1005 |
{ |
{ |
1006 |
Gtk::Label* filler = new Gtk::Label(" "); |
Gtk::Label* filler = new Gtk::Label(" "); |
1007 |
|
#if USE_GTKMM_GRID |
1008 |
|
table[pageno]->attach(*filler, 0, firstRowInBlock); |
1009 |
|
#else |
1010 |
table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno, |
table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno, |
1011 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
1012 |
|
#endif |
1013 |
} |
} |
1014 |
Glib::ustring str = "<b>"; |
Glib::ustring str = "<b>"; |
1015 |
str += text; |
str += text; |
1016 |
str += "</b>"; |
str += "</b>"; |
1017 |
Gtk::Label* label = new Gtk::Label(str); |
Gtk::Label* label = new Gtk::Label(str); |
1018 |
label->set_use_markup(); |
label->set_use_markup(); |
1019 |
|
#if HAS_GTKMM_ALIGNMENT |
1020 |
label->set_alignment(Gtk::ALIGN_START); |
label->set_alignment(Gtk::ALIGN_START); |
1021 |
|
#else |
1022 |
|
label->set_halign(Gtk::Align::START); |
1023 |
|
#endif |
1024 |
|
#if USE_GTKMM_GRID |
1025 |
|
table[pageno]->attach(*label, 0, rowno, 3); |
1026 |
|
#else |
1027 |
table[pageno]->attach(*label, 0, 3, rowno, rowno + 1, |
table[pageno]->attach(*label, 0, 3, rowno, rowno + 1, |
1028 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
1029 |
|
#endif |
1030 |
rowno++; |
rowno++; |
1031 |
firstRowInBlock = rowno; |
firstRowInBlock = rowno; |
1032 |
return label; |
return label; |
1037 |
if (firstRowInBlock < rowno - 1) |
if (firstRowInBlock < rowno - 1) |
1038 |
{ |
{ |
1039 |
Gtk::Label* filler = new Gtk::Label(" "); |
Gtk::Label* filler = new Gtk::Label(" "); |
1040 |
|
#if USE_GTKMM_GRID |
1041 |
|
table[pageno]->attach(*filler, 0, firstRowInBlock); |
1042 |
|
#else |
1043 |
table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno, |
table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno, |
1044 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
1045 |
|
#endif |
1046 |
} |
} |
1047 |
pageno++; |
pageno++; |
1048 |
rowno = 0; |
rowno = 0; |
1051 |
|
|
1052 |
void DimRegionEdit::addProp(BoolEntry& boolentry) |
void DimRegionEdit::addProp(BoolEntry& boolentry) |
1053 |
{ |
{ |
1054 |
|
#if USE_GTKMM_GRID |
1055 |
|
table[pageno]->attach(boolentry.widget, 1, rowno, 2); |
1056 |
|
#else |
1057 |
table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1, |
table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1, |
1058 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
1059 |
|
#endif |
1060 |
rowno++; |
rowno++; |
1061 |
} |
} |
1062 |
|
|
1063 |
void DimRegionEdit::addProp(BoolEntryPlus6& boolentry) |
void DimRegionEdit::addProp(BoolEntryPlus6& boolentry) |
1064 |
{ |
{ |
1065 |
|
#if USE_GTKMM_GRID |
1066 |
|
table[pageno]->attach(boolentry.widget, 1, rowno, 2); |
1067 |
|
#else |
1068 |
table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1, |
table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1, |
1069 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
1070 |
|
#endif |
1071 |
rowno++; |
rowno++; |
1072 |
} |
} |
1073 |
|
|
1074 |
void DimRegionEdit::addProp(LabelWidget& prop) |
void DimRegionEdit::addProp(LabelWidget& prop) |
1075 |
{ |
{ |
1076 |
|
#if USE_GTKMM_GRID |
1077 |
|
table[pageno]->attach(prop.label, 1, rowno); |
1078 |
|
table[pageno]->attach(prop.widget, 2, rowno); |
1079 |
|
#else |
1080 |
table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1, |
table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1, |
1081 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
1082 |
table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1, |
table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1, |
1083 |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
1084 |
|
#endif |
1085 |
|
rowno++; |
1086 |
|
} |
1087 |
|
|
1088 |
|
void DimRegionEdit::addLine(HBox& line) |
1089 |
|
{ |
1090 |
|
#if USE_GTKMM_GRID |
1091 |
|
table[pageno]->attach(line, 1, rowno, 2); |
1092 |
|
#else |
1093 |
|
table[pageno]->attach(line, 1, 3, rowno, rowno + 1, |
1094 |
|
Gtk::FILL, Gtk::SHRINK); |
1095 |
|
#endif |
1096 |
rowno++; |
rowno++; |
1097 |
} |
} |
1098 |
|
|
1099 |
void DimRegionEdit::addRightHandSide(Gtk::Widget& widget) |
void DimRegionEdit::addRightHandSide(Gtk::Widget& widget) |
1100 |
{ |
{ |
1101 |
|
#if USE_GTKMM_GRID |
1102 |
|
table[pageno]->attach(widget, 2, rowno); |
1103 |
|
#else |
1104 |
table[pageno]->attach(widget, 2, 3, rowno, rowno + 1, |
table[pageno]->attach(widget, 2, 3, rowno, rowno + 1, |
1105 |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
1106 |
|
#endif |
1107 |
rowno++; |
rowno++; |
1108 |
} |
} |
1109 |
|
|
1132 |
eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence); |
eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence); |
1133 |
eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence); |
eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence); |
1134 |
eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence); |
eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence); |
1135 |
|
eEG1StateOptions.checkBoxAttack.set_value(d->EG1Options.AttackCancel); |
1136 |
|
eEG1StateOptions.checkBoxAttackHold.set_value(d->EG1Options.AttackHoldCancel); |
1137 |
|
eEG1StateOptions.checkBoxDecay1.set_value(d->EG1Options.Decay1Cancel); |
1138 |
|
eEG1StateOptions.checkBoxDecay2.set_value(d->EG1Options.Decay2Cancel); |
1139 |
|
eEG1StateOptions.checkBoxRelease.set_value(d->EG1Options.ReleaseCancel); |
1140 |
eLFO1Frequency.set_value(d->LFO1Frequency); |
eLFO1Frequency.set_value(d->LFO1Frequency); |
1141 |
eLFO1InternalDepth.set_value(d->LFO1InternalDepth); |
eLFO1InternalDepth.set_value(d->LFO1InternalDepth); |
1142 |
eLFO1ControlDepth.set_value(d->LFO1ControlDepth); |
eLFO1ControlDepth.set_value(d->LFO1ControlDepth); |
1155 |
eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence); |
eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence); |
1156 |
eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence); |
eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence); |
1157 |
eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence); |
eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence); |
1158 |
|
eEG2StateOptions.checkBoxAttack.set_value(d->EG2Options.AttackCancel); |
1159 |
|
eEG2StateOptions.checkBoxAttackHold.set_value(d->EG2Options.AttackHoldCancel); |
1160 |
|
eEG2StateOptions.checkBoxDecay1.set_value(d->EG2Options.Decay1Cancel); |
1161 |
|
eEG2StateOptions.checkBoxDecay2.set_value(d->EG2Options.Decay2Cancel); |
1162 |
|
eEG2StateOptions.checkBoxRelease.set_value(d->EG2Options.ReleaseCancel); |
1163 |
eLFO2Frequency.set_value(d->LFO2Frequency); |
eLFO2Frequency.set_value(d->LFO2Frequency); |
1164 |
eLFO2InternalDepth.set_value(d->LFO2InternalDepth); |
eLFO2InternalDepth.set_value(d->LFO2InternalDepth); |
1165 |
eLFO2ControlDepth.set_value(d->LFO2ControlDepth); |
eLFO2ControlDepth.set_value(d->LFO2ControlDepth); |
1208 |
eMSDecode.set_value(d->MSDecode); |
eMSDecode.set_value(d->MSDecode); |
1209 |
eSampleStartOffset.set_value(d->SampleStartOffset); |
eSampleStartOffset.set_value(d->SampleStartOffset); |
1210 |
eUnityNote.set_value(d->UnityNote); |
eUnityNote.set_value(d->UnityNote); |
1211 |
|
// show sample group name |
1212 |
|
{ |
1213 |
|
Glib::ustring s = "---"; |
1214 |
|
if (d->pSample && d->pSample->GetGroup()) |
1215 |
|
s = d->pSample->GetGroup()->Name; |
1216 |
|
eSampleGroup.text.set_text(s); |
1217 |
|
} |
1218 |
// assemble sample format info string |
// assemble sample format info string |
1219 |
{ |
{ |
1220 |
Glib::ustring s; |
Glib::ustring s; |
1246 |
} |
} |
1247 |
eSampleID.text.set_text(s); |
eSampleID.text.set_text(s); |
1248 |
} |
} |
1249 |
|
// generate raw wave form data CRC-32 checksum string |
1250 |
|
{ |
1251 |
|
Glib::ustring s = "---"; |
1252 |
|
if (d->pSample) { |
1253 |
|
char buf[64] = {}; |
1254 |
|
snprintf(buf, sizeof(buf), "%x", d->pSample->GetWaveDataCRC32Checksum()); |
1255 |
|
s = buf; |
1256 |
|
} |
1257 |
|
eChecksum.text.set_text(s); |
1258 |
|
} |
1259 |
buttonSelectSample.set_sensitive(d && d->pSample); |
buttonSelectSample.set_sensitive(d && d->pSample); |
1260 |
eFineTune.set_value(d->FineTune); |
eFineTune.set_value(d->FineTune); |
1261 |
eGain.set_value(d->Gain); |
eGain.set_value(d->Gain); |
1305 |
eEG2ControllerAttackInfluence.set_sensitive(sensitive); |
eEG2ControllerAttackInfluence.set_sensitive(sensitive); |
1306 |
eEG2ControllerDecayInfluence.set_sensitive(sensitive); |
eEG2ControllerDecayInfluence.set_sensitive(sensitive); |
1307 |
eEG2ControllerReleaseInfluence.set_sensitive(sensitive); |
eEG2ControllerReleaseInfluence.set_sensitive(sensitive); |
1308 |
|
eEG2StateOptions.set_sensitive(sensitive); |
1309 |
lLFO2->set_sensitive(sensitive); |
lLFO2->set_sensitive(sensitive); |
1310 |
eLFO2Frequency.set_sensitive(sensitive); |
eLFO2Frequency.set_sensitive(sensitive); |
1311 |
eLFO2InternalDepth.set_sensitive(sensitive); |
eLFO2InternalDepth.set_sensitive(sensitive); |
1499 |
|
|
1500 |
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) |
1501 |
{ |
{ |
1502 |
if (dimregion) { |
bool result = false; |
1503 |
|
for (std::set<gig::DimensionRegion*>::iterator itDimReg = dimregs.begin(); |
1504 |
|
itDimReg != dimregs.end(); ++itDimReg) |
1505 |
|
{ |
1506 |
|
result |= set_sample(*itDimReg, sample, copy_sample_unity, copy_sample_tune, copy_sample_loop); |
1507 |
|
} |
1508 |
|
return result; |
1509 |
|
} |
1510 |
|
|
1511 |
|
bool DimRegionEdit::set_sample(gig::DimensionRegion* dimreg, gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop) |
1512 |
|
{ |
1513 |
|
if (dimreg) { |
1514 |
//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 |
1515 |
|
|
1516 |
// 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() |
1517 |
//dimreg_to_be_changed_signal.emit(dimregion); |
//DimRegionChangeGuard(this, dimregion); |
1518 |
|
|
1519 |
// make sure stereo samples always are the same in both |
// make sure stereo samples always are the same in both |
1520 |
// dimregs in the samplechannel dimension |
// dimregs in the samplechannel dimension |
1521 |
int nbDimregs = 1; |
int nbDimregs = 1; |
1522 |
gig::DimensionRegion* d[2] = { dimregion, 0 }; |
gig::DimensionRegion* d[2] = { dimreg, 0 }; |
1523 |
if (sample->Channels == 2) { |
if (sample->Channels == 2) { |
1524 |
gig::Region* region = dimregion->GetParent(); |
gig::Region* region = dimreg->GetParent(); |
1525 |
|
|
1526 |
int bitcount = 0; |
int bitcount = 0; |
1527 |
int stereo_bit = 0; |
int stereo_bit = 0; |
1536 |
if (stereo_bit) { |
if (stereo_bit) { |
1537 |
int dimregno; |
int dimregno; |
1538 |
for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) { |
for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) { |
1539 |
if (region->pDimensionRegions[dimregno] == dimregion) { |
if (region->pDimensionRegions[dimregno] == dimreg) { |
1540 |
break; |
break; |
1541 |
} |
} |
1542 |
} |
} |
1546 |
} |
} |
1547 |
} |
} |
1548 |
|
|
1549 |
gig::Sample* oldref = dimregion->pSample; |
gig::Sample* oldref = dimreg->pSample; |
1550 |
|
|
1551 |
for (int i = 0 ; i < nbDimregs ; i++) { |
for (int i = 0 ; i < nbDimregs ; i++) { |
1552 |
d[i]->pSample = sample; |
d[i]->pSample = sample; |
1576 |
|
|
1577 |
// update ui |
// update ui |
1578 |
update_model++; |
update_model++; |
1579 |
wSample->set_text(gig_to_utf8(dimregion->pSample->pInfo->Name)); |
wSample->set_text(gig_to_utf8(dimreg->pSample->pInfo->Name)); |
1580 |
eUnityNote.set_value(dimregion->UnityNote); |
eUnityNote.set_value(dimreg->UnityNote); |
1581 |
eFineTune.set_value(dimregion->FineTune); |
eFineTune.set_value(dimreg->FineTune); |
1582 |
eSampleLoopEnabled.set_value(dimregion->SampleLoops); |
eSampleLoopEnabled.set_value(dimreg->SampleLoops); |
1583 |
update_loop_elements(); |
update_loop_elements(); |
1584 |
update_model--; |
update_model--; |
1585 |
|
|
1586 |
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); |
|
1587 |
return true; |
return true; |
1588 |
} |
} |
1589 |
return false; |
return false; |
1652 |
if (value) { |
if (value) { |
1653 |
// create a new sample loop in case there is none yet |
// create a new sample loop in case there is none yet |
1654 |
if (!d->SampleLoops) { |
if (!d->SampleLoops) { |
1655 |
|
DimRegionChangeGuard(this, d); |
1656 |
|
|
1657 |
DLS::sample_loop_t loop; |
DLS::sample_loop_t loop; |
1658 |
loop.LoopType = gig::loop_type_normal; |
loop.LoopType = gig::loop_type_normal; |
1659 |
// loop the whole sample by default |
// loop the whole sample by default |
1660 |
loop.LoopStart = 0; |
loop.LoopStart = 0; |
1661 |
loop.LoopLength = |
loop.LoopLength = |
1662 |
(d->pSample) ? d->pSample->SamplesTotal : 0; |
(d->pSample) ? d->pSample->SamplesTotal : 0; |
|
dimreg_to_be_changed_signal.emit(d); |
|
1663 |
d->AddSampleLoop(&loop); |
d->AddSampleLoop(&loop); |
|
dimreg_changed_signal.emit(d); |
|
1664 |
} |
} |
1665 |
} else { |
} else { |
1666 |
if (d->SampleLoops) { |
if (d->SampleLoops) { |
1667 |
dimreg_to_be_changed_signal.emit(d); |
DimRegionChangeGuard(this, d); |
1668 |
|
|
1669 |
// delete ALL existing sample loops |
// delete ALL existing sample loops |
1670 |
while (d->SampleLoops) { |
while (d->SampleLoops) { |
1671 |
d->DeleteSampleLoop(&d->pSampleLoops[0]); |
d->DeleteSampleLoop(&d->pSampleLoops[0]); |
1672 |
} |
} |
|
dimreg_changed_signal.emit(d); |
|
1673 |
} |
} |
1674 |
} |
} |
1675 |
} |
} |
1714 |
if (d->pSample) d->pSample->LoopPlayCount = value; |
if (d->pSample) d->pSample->LoopPlayCount = value; |
1715 |
} |
} |
1716 |
|
|
1717 |
|
void DimRegionEdit::nullOutSampleReference() { |
1718 |
|
if (!dimregion) return; |
1719 |
|
gig::Sample* oldref = dimregion->pSample; |
1720 |
|
if (!oldref) return; |
1721 |
|
|
1722 |
|
DimRegionChangeGuard(this, dimregion); |
1723 |
|
|
1724 |
|
// in case currently assigned sample is a stereo one, then remove both |
1725 |
|
// references (expected to be due to a "stereo dimension") |
1726 |
|
gig::DimensionRegion* d[2] = { dimregion, NULL }; |
1727 |
|
if (oldref->Channels == 2) { |
1728 |
|
gig::Region* region = dimregion->GetParent(); |
1729 |
|
{ |
1730 |
|
int stereo_bit = 0; |
1731 |
|
int bitcount = 0; |
1732 |
|
for (int dim = 0 ; dim < region->Dimensions ; dim++) { |
1733 |
|
if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) { |
1734 |
|
stereo_bit = 1 << bitcount; |
1735 |
|
break; |
1736 |
|
} |
1737 |
|
bitcount += region->pDimensionDefinitions[dim].bits; |
1738 |
|
} |
1739 |
|
|
1740 |
|
if (stereo_bit) { |
1741 |
|
int dimregno; |
1742 |
|
for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) { |
1743 |
|
if (region->pDimensionRegions[dimregno] == dimregion) { |
1744 |
|
break; |
1745 |
|
} |
1746 |
|
} |
1747 |
|
d[0] = region->pDimensionRegions[dimregno & ~stereo_bit]; |
1748 |
|
d[1] = region->pDimensionRegions[dimregno | stereo_bit]; |
1749 |
|
} |
1750 |
|
} |
1751 |
|
} |
1752 |
|
|
1753 |
|
if (d[0]) d[0]->pSample = NULL; |
1754 |
|
if (d[1]) d[1]->pSample = NULL; |
1755 |
|
|
1756 |
|
// update UI elements |
1757 |
|
set_dim_region(dimregion); |
1758 |
|
|
1759 |
|
sample_ref_changed_signal.emit(oldref, NULL); |
1760 |
|
} |
1761 |
|
|
1762 |
void DimRegionEdit::onButtonSelectSamplePressed() { |
void DimRegionEdit::onButtonSelectSamplePressed() { |
1763 |
if (!dimregion) return; |
if (!dimregion) return; |
1764 |
if (!dimregion->pSample) return; |
if (!dimregion->pSample) return; |