19 |
|
|
20 |
#include "dimregionedit.h" |
#include "dimregionedit.h" |
21 |
|
|
22 |
|
#include <libintl.h> |
23 |
|
#define _(String) gettext(String) |
24 |
|
|
25 |
DimRegionEdit::DimRegionEdit() : |
DimRegionEdit::DimRegionEdit() : |
26 |
eEG1PreAttack("PreAttack", 0, 100, 2), |
eEG1PreAttack("PreAttack", 0, 100, 2), |
27 |
eEG1Attack("Attack", 0, 60, 3), |
eEG1Attack("Attack", 0, 60, 3), |
105 |
eFineTune("FineTune", -49, 50), |
eFineTune("FineTune", -49, 50), |
106 |
eGain("Gain", -96, 0, 2, -655360), |
eGain("Gain", -96, 0, 2, -655360), |
107 |
eGainPlus6("Gain +6dB", eGain, 6 * -655360), |
eGainPlus6("Gain +6dB", eGain, 6 * -655360), |
108 |
eSampleLoops("SampleLoops", 0, 1) |
eSampleLoopEnabled("Enabled"), |
109 |
|
eSampleLoopStart("Loop Start Positon"), |
110 |
|
eSampleLoopLength("Loop Size"), |
111 |
|
eSampleLoopType("Loop Type"), |
112 |
|
eSampleLoopInfinite("Infinite Loop"), |
113 |
|
eSampleLoopPlayCount("Playback Count") |
114 |
{ |
{ |
115 |
for (int i = 0 ; i < 5 ; i++) { |
for (int i = 0 ; i < 7 ; i++) { |
116 |
table[i] = new Gtk::Table(3, 1); |
table[i] = new Gtk::Table(3, 1); |
117 |
table[i]->set_col_spacings(5); |
table[i]->set_col_spacings(7); |
118 |
} |
} |
119 |
|
|
120 |
|
// set tooltips |
121 |
|
eUnityNote.set_tip( |
122 |
|
_("note this sample is associated with (a.k.a. 'root note')") |
123 |
|
); |
124 |
|
eSampleStartOffset.set_tip(_("sample position at which playback should be started")); |
125 |
|
ePan.set_tip(_("stereo balance (left/right)")); |
126 |
|
eChannelOffset.set_tip( |
127 |
|
_("output channel where the audio signal should be routed to (0 - 9)") |
128 |
|
); |
129 |
|
ePitchTrack.set_tip( |
130 |
|
_("if true: sample will be pitched according to the key position " |
131 |
|
"(this would be disabled for drums for example)") |
132 |
|
); |
133 |
|
eSampleLoopEnabled.set_tip(_("if enabled: repeats to playback the sample")); |
134 |
|
eSampleLoopStart.set_tip( |
135 |
|
_("start position within the sample (in sample points) of the area to " |
136 |
|
"be looped") |
137 |
|
); |
138 |
|
eSampleLoopLength.set_tip( |
139 |
|
_("duration (in sample points) of the area to be looped") |
140 |
|
); |
141 |
|
eSampleLoopType.set_tip( |
142 |
|
_("direction in which the loop area in the sample should be played back") |
143 |
|
); |
144 |
|
eSampleLoopInfinite.set_tip( |
145 |
|
_("whether the loop area should be played back forever\n" |
146 |
|
"Caution: this setting is stored on Sample side, thus is shared " |
147 |
|
"among all dimension regions that use this sample!") |
148 |
|
); |
149 |
|
eSampleLoopPlayCount.set_tip( |
150 |
|
_("how many times the loop area should be played back\n" |
151 |
|
"Caution: this setting is stored on Sample side, thus is shared " |
152 |
|
"among all dimension regions that use this sample!") |
153 |
|
); |
154 |
|
|
155 |
pageno = 0; |
pageno = 0; |
156 |
rowno = 0; |
rowno = 0; |
157 |
firstRowInBlock = 0; |
firstRowInBlock = 0; |
158 |
|
|
159 |
addHeader("General (mandatory):"); |
addHeader(_("Mandatory Settings:")); |
160 |
addString("Sample", lSample, wSample); |
addString("Sample", lSample, wSample); |
161 |
//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); |
162 |
tooltips.set_tip(*wSample, "drop a sample here"); |
tooltips.set_tip(*wSample, _("drop a sample here")); |
163 |
addProp(eUnityNote); |
addProp(eUnityNote); |
164 |
addHeader("Optional Settings:"); |
addHeader(_("Optional Settings:")); |
165 |
addProp(eSampleStartOffset); |
addProp(eSampleStartOffset); |
166 |
addProp(ePan); |
addProp(ePan); |
167 |
addProp(eChannelOffset); |
addProp(eChannelOffset); |
168 |
addHeader("Loops:"); |
addHeader("Loops:"); |
169 |
addProp(eSampleLoops); |
addProp(eSampleLoopEnabled); |
170 |
|
addProp(eSampleLoopStart); |
171 |
|
addProp(eSampleLoopLength); |
172 |
|
{ |
173 |
|
char* choices[] = { "normal", "bidirectional", "backward", 0 }; |
174 |
|
static const uint32_t values[] = { |
175 |
|
gig::loop_type_normal, |
176 |
|
gig::loop_type_bidirectional, |
177 |
|
gig::loop_type_backward |
178 |
|
}; |
179 |
|
eSampleLoopType.set_choices(choices, values); |
180 |
|
} |
181 |
|
addProp(eSampleLoopType); |
182 |
|
addProp(eSampleLoopInfinite); |
183 |
|
addProp(eSampleLoopPlayCount); |
184 |
addHeader("Crossfade:"); |
addHeader("Crossfade:"); |
185 |
addProp(eCrossfade_in_start); |
addProp(eCrossfade_in_start); |
186 |
addProp(eCrossfade_in_end); |
addProp(eCrossfade_in_end); |
189 |
|
|
190 |
nextPage(); |
nextPage(); |
191 |
|
|
192 |
addHeader("General Amplitude Settings:"); |
addHeader(_("General Amplitude Settings:")); |
193 |
addProp(eGain); |
addProp(eGain); |
194 |
addProp(eGainPlus6); |
addProp(eGainPlus6); |
195 |
addProp(eAttenuationController); |
addProp(eAttenuationController); |
196 |
addProp(eInvertAttenuationController); |
addProp(eInvertAttenuationController); |
197 |
addProp(eAttenuationControllerThreshold); |
addProp(eAttenuationControllerThreshold); |
198 |
addHeader("EG1 (Amplitude Envelope):"); |
addHeader(_("Amplitude Envelope (EG1):")); |
199 |
addProp(eEG1PreAttack); |
addProp(eEG1PreAttack); |
200 |
addProp(eEG1Attack); |
addProp(eEG1Attack); |
201 |
addProp(eEG1Decay1); |
addProp(eEG1Decay1); |
209 |
addProp(eEG1ControllerAttackInfluence); |
addProp(eEG1ControllerAttackInfluence); |
210 |
addProp(eEG1ControllerDecayInfluence); |
addProp(eEG1ControllerDecayInfluence); |
211 |
addProp(eEG1ControllerReleaseInfluence); |
addProp(eEG1ControllerReleaseInfluence); |
212 |
addHeader("LFO1 (Amplitude Oscillator):"); |
|
213 |
|
nextPage(); |
214 |
|
|
215 |
|
addHeader(_("Amplitude Oscillator (LFO1):")); |
216 |
addProp(eLFO1Frequency); |
addProp(eLFO1Frequency); |
217 |
addProp(eLFO1InternalDepth); |
addProp(eLFO1InternalDepth); |
218 |
addProp(eLFO1ControlDepth); |
addProp(eLFO1ControlDepth); |
234 |
|
|
235 |
nextPage(); |
nextPage(); |
236 |
|
|
237 |
addHeader("General Filter Settings:"); |
addHeader(_("General Filter Settings:")); |
238 |
addProp(eVCFEnabled); |
addProp(eVCFEnabled); |
239 |
{ |
{ |
240 |
char* choices[] = { "lowpass", "lowpassturbo", "bandpass", |
char* choices[] = { "lowpass", "lowpassturbo", "bandpass", |
299 |
addProp(eVCFResonanceController); |
addProp(eVCFResonanceController); |
300 |
addProp(eVCFKeyboardTracking); |
addProp(eVCFKeyboardTracking); |
301 |
addProp(eVCFKeyboardTrackingBreakpoint); |
addProp(eVCFKeyboardTrackingBreakpoint); |
302 |
addHeader("EG2 (Filter Cutoff Envelope):"); |
|
303 |
|
nextPage(); |
304 |
|
|
305 |
|
addHeader(_("Filter Cutoff Envelope (EG2):")); |
306 |
addProp(eEG2PreAttack); |
addProp(eEG2PreAttack); |
307 |
addProp(eEG2Attack); |
addProp(eEG2Attack); |
308 |
addProp(eEG2Decay1); |
addProp(eEG2Decay1); |
315 |
addProp(eEG2ControllerAttackInfluence); |
addProp(eEG2ControllerAttackInfluence); |
316 |
addProp(eEG2ControllerDecayInfluence); |
addProp(eEG2ControllerDecayInfluence); |
317 |
addProp(eEG2ControllerReleaseInfluence); |
addProp(eEG2ControllerReleaseInfluence); |
318 |
addHeader("LFO2 (Filter Cutoff Oscillator):"); |
addHeader(_("Filter Cutoff Oscillator (LFO2):")); |
319 |
addProp(eLFO2Frequency); |
addProp(eLFO2Frequency); |
320 |
addProp(eLFO2InternalDepth); |
addProp(eLFO2InternalDepth); |
321 |
addProp(eLFO2ControlDepth); |
addProp(eLFO2ControlDepth); |
337 |
|
|
338 |
nextPage(); |
nextPage(); |
339 |
|
|
340 |
addHeader("General Pitch Settings:"); |
addHeader(_("General Pitch Settings:")); |
341 |
addProp(eFineTune); |
addProp(eFineTune); |
342 |
addProp(ePitchTrack); |
addProp(ePitchTrack); |
343 |
addHeader("EG3 (Pitch Envelope):"); |
addHeader(_("Pitch Envelope (EG3):")); |
344 |
addProp(eEG3Attack); |
addProp(eEG3Attack); |
345 |
addProp(eEG3Depth); |
addProp(eEG3Depth); |
346 |
addHeader("LFO3 (Pitch Oscillator):"); |
addHeader(_("Pitch Oscillator (LFO3):")); |
347 |
addProp(eLFO3Frequency); |
addProp(eLFO3Frequency); |
348 |
addProp(eLFO3InternalDepth); |
addProp(eLFO3InternalDepth); |
349 |
addProp(eLFO3ControlDepth); |
addProp(eLFO3ControlDepth); |
422 |
eCrossfade_out_end.signal_value_changed().connect( |
eCrossfade_out_end.signal_value_changed().connect( |
423 |
sigc::mem_fun(*this, &DimRegionEdit::crossfade4_changed)); |
sigc::mem_fun(*this, &DimRegionEdit::crossfade4_changed)); |
424 |
|
|
425 |
|
eSampleLoopEnabled.signal_toggled().connect( |
426 |
|
sigc::mem_fun(*this, &DimRegionEdit::loop_enabled_toggled)); |
427 |
|
eSampleLoopStart.signal_value_changed().connect( |
428 |
|
sigc::mem_fun(*this, &DimRegionEdit::updateLoopElements)); |
429 |
|
eSampleLoopLength.signal_value_changed().connect( |
430 |
|
sigc::mem_fun(*this, &DimRegionEdit::updateLoopElements)); |
431 |
|
eSampleLoopInfinite.signal_toggled().connect( |
432 |
|
sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled)); |
433 |
|
|
434 |
append_page(*table[0], "Sample"); |
append_page(*table[0], "Sample"); |
435 |
append_page(*table[1], "Amplitude"); |
append_page(*table[1], "Amplitude (1)"); |
436 |
append_page(*table[2], "Filter"); |
append_page(*table[2], "Amplitude (2)"); |
437 |
append_page(*table[3], "Pitch"); |
append_page(*table[3], "Filter (1)"); |
438 |
append_page(*table[4], "Misc"); |
append_page(*table[4], "Filter (2)"); |
439 |
|
append_page(*table[5], "Pitch"); |
440 |
|
append_page(*table[6], "Misc"); |
441 |
} |
} |
442 |
|
|
443 |
DimRegionEdit::~DimRegionEdit() |
DimRegionEdit::~DimRegionEdit() |
506 |
|
|
507 |
void DimRegionEdit::set_dim_region(gig::DimensionRegion* d) |
void DimRegionEdit::set_dim_region(gig::DimensionRegion* d) |
508 |
{ |
{ |
509 |
|
dimregion = d; |
510 |
|
|
511 |
set_sensitive(d); |
set_sensitive(d); |
512 |
if (!d) return; |
if (!d) return; |
513 |
|
|
595 |
eFineTune.set_ptr(&d->FineTune); |
eFineTune.set_ptr(&d->FineTune); |
596 |
eGain.set_ptr(&d->Gain); |
eGain.set_ptr(&d->Gain); |
597 |
eGainPlus6.set_ptr(&d->Gain); |
eGainPlus6.set_ptr(&d->Gain); |
598 |
eSampleLoops.set_ptr(&d->SampleLoops); |
|
599 |
|
eSampleLoopEnabled.set_active(d->SampleLoops); |
600 |
|
updateLoopElements(); |
601 |
|
|
602 |
VCFEnabled_toggled(); |
VCFEnabled_toggled(); |
603 |
|
|
753 |
|
|
754 |
if (c4 < c3) eCrossfade_out_start.set_value(c4); |
if (c4 < c3) eCrossfade_out_start.set_value(c4); |
755 |
} |
} |
756 |
|
|
757 |
|
void DimRegionEdit::loop_enabled_toggled() |
758 |
|
{ |
759 |
|
const bool active = eSampleLoopEnabled.get_active(); |
760 |
|
if (active) { |
761 |
|
// create a new sample loop in case there is none yet |
762 |
|
if (!dimregion->SampleLoops) { |
763 |
|
DLS::sample_loop_t loop; |
764 |
|
loop.LoopType = gig::loop_type_normal; |
765 |
|
// loop the whole sample by default |
766 |
|
loop.LoopStart = 0; |
767 |
|
loop.LoopLength = |
768 |
|
(dimregion->pSample) ? dimregion->pSample->GetSize() : 0; |
769 |
|
dimregion->AddSampleLoop(&loop); |
770 |
|
} |
771 |
|
} else { |
772 |
|
// delete ALL existing sample loops |
773 |
|
while (dimregion->SampleLoops) |
774 |
|
dimregion->DeleteSampleLoop(&dimregion->pSampleLoops[0]); |
775 |
|
} |
776 |
|
updateLoopElements(); |
777 |
|
} |
778 |
|
|
779 |
|
void DimRegionEdit::updateLoopElements() |
780 |
|
{ |
781 |
|
const bool active = eSampleLoopEnabled.get_active(); |
782 |
|
eSampleLoopStart.set_sensitive(active); |
783 |
|
eSampleLoopLength.set_sensitive(active); |
784 |
|
eSampleLoopType.set_sensitive(active); |
785 |
|
eSampleLoopInfinite.set_sensitive(active); |
786 |
|
if (dimregion && dimregion->SampleLoops) { |
787 |
|
eSampleLoopStart.set_ptr(&dimregion->pSampleLoops[0].LoopStart); |
788 |
|
eSampleLoopLength.set_ptr(&dimregion->pSampleLoops[0].LoopLength); |
789 |
|
eSampleLoopType.set_ptr(&dimregion->pSampleLoops[0].LoopType); |
790 |
|
eSampleLoopPlayCount.set_ptr( |
791 |
|
(dimregion->pSample) ? &dimregion->pSample->LoopPlayCount : NULL |
792 |
|
); |
793 |
|
eSampleLoopInfinite.set_active( |
794 |
|
dimregion->pSample && !dimregion->pSample->LoopPlayCount |
795 |
|
); |
796 |
|
// sample loop shall never be longer than the actual sample size |
797 |
|
eSampleLoopStart.set_upper( |
798 |
|
(dimregion->pSample) |
799 |
|
? dimregion->pSample->GetSize() - |
800 |
|
dimregion->pSampleLoops[0].LoopLength |
801 |
|
: 0 |
802 |
|
); |
803 |
|
eSampleLoopLength.set_upper( |
804 |
|
(dimregion->pSample) |
805 |
|
? dimregion->pSample->GetSize() - |
806 |
|
dimregion->pSampleLoops[0].LoopStart |
807 |
|
: 0 |
808 |
|
); |
809 |
|
} else { // no sample loop(s) |
810 |
|
eSampleLoopStart.set_ptr(NULL); |
811 |
|
eSampleLoopLength.set_ptr(NULL); |
812 |
|
eSampleLoopType.set_ptr(NULL); |
813 |
|
eSampleLoopPlayCount.set_ptr(NULL); |
814 |
|
} |
815 |
|
} |
816 |
|
|
817 |
|
void DimRegionEdit::loop_infinite_toggled() { |
818 |
|
eSampleLoopPlayCount.set_sensitive(!eSampleLoopInfinite.get_active()); |
819 |
|
if (eSampleLoopInfinite.get_active()) eSampleLoopPlayCount.set_value(0); |
820 |
|
} |