1 |
/* |
/* |
2 |
* Copyright (C) 2006-2013 Andreas Persson |
* Copyright (C) 2006-2015 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 |
94 |
} |
} |
95 |
} |
} |
96 |
int bitcount = 0; |
int bitcount = 0; |
|
int layer_bit = 0; |
|
97 |
for (int dim = 0 ; dim < region->Dimensions ; dim++) { |
for (int dim = 0 ; dim < region->Dimensions ; dim++) { |
98 |
if (region->pDimensionDefinitions[dim].dimension == |
if (region->pDimensionDefinitions[dim].dimension == |
99 |
gig::dimension_layer) { |
gig::dimension_layer) { |
|
layer_bit = 1 << bitcount; |
|
|
|
|
100 |
int mask = |
int mask = |
101 |
~(((1 << region->pDimensionDefinitions[dim].bits) - 1) << |
~(((1 << region->pDimensionDefinitions[dim].bits) - 1) << |
102 |
bitcount); |
bitcount); |
151 |
velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation), |
velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation), |
152 |
release_curve(&gig::DimensionRegion::GetVelocityRelease), |
release_curve(&gig::DimensionRegion::GetVelocityRelease), |
153 |
cutoff_curve(&gig::DimensionRegion::GetVelocityCutoff), |
cutoff_curve(&gig::DimensionRegion::GetVelocityCutoff), |
154 |
eEG1PreAttack(_("Pre-attack"), 0, 100, 2), |
eEG1PreAttack(_("Pre-attack Level (%)"), 0, 100, 2), |
155 |
eEG1Attack(_("Attack"), 0, 60, 3), |
eEG1Attack(_("Attack Time (seconds)"), 0, 60, 3), |
156 |
eEG1Decay1(_("Decay 1"), 0.005, 60, 3), |
eEG1Decay1(_("Decay 1 Time (seconds)"), 0.005, 60, 3), |
157 |
eEG1Decay2(_("Decay 2"), 0, 60, 3), |
eEG1Decay2(_("Decay 2 Time (seconds)"), 0, 60, 3), |
158 |
eEG1InfiniteSustain(_("Infinite sustain")), |
eEG1InfiniteSustain(_("Infinite sustain")), |
159 |
eEG1Sustain(_("Sustain"), 0, 100, 2), |
eEG1Sustain(_("Sustain Level (%)"), 0, 100, 2), |
160 |
eEG1Release(_("Release"), 0, 60, 3), |
eEG1Release(_("Release Time (seconds)"), 0, 60, 3), |
161 |
eEG1Hold(_("Hold")), |
eEG1Hold(_("Hold Attack Stage until Loop End")), |
162 |
eEG1Controller(_("Controller")), |
eEG1Controller(_("Controller")), |
163 |
eEG1ControllerInvert(_("Controller invert")), |
eEG1ControllerInvert(_("Controller invert")), |
164 |
eEG1ControllerAttackInfluence(_("Controller attack influence"), 0, 3), |
eEG1ControllerAttackInfluence(_("Controller attack influence"), 0, 3), |
170 |
eLFO1Controller(_("Controller")), |
eLFO1Controller(_("Controller")), |
171 |
eLFO1FlipPhase(_("Flip phase")), |
eLFO1FlipPhase(_("Flip phase")), |
172 |
eLFO1Sync(_("Sync")), |
eLFO1Sync(_("Sync")), |
173 |
eEG2PreAttack(_("Pre-attack"), 0, 100, 2), |
eEG2PreAttack(_("Pre-attack Level (%)"), 0, 100, 2), |
174 |
eEG2Attack(_("Attack"), 0, 60, 3), |
eEG2Attack(_("Attack Time (seconds)"), 0, 60, 3), |
175 |
eEG2Decay1(_("Decay 1"), 0.005, 60, 3), |
eEG2Decay1(_("Decay 1 Time (seconds)"), 0.005, 60, 3), |
176 |
eEG2Decay2(_("Decay 2"), 0, 60, 3), |
eEG2Decay2(_("Decay 2 Time (seconds)"), 0, 60, 3), |
177 |
eEG2InfiniteSustain(_("Infinite sustain")), |
eEG2InfiniteSustain(_("Infinite sustain")), |
178 |
eEG2Sustain(_("Sustain"), 0, 100, 2), |
eEG2Sustain(_("Sustain Level (%)"), 0, 100, 2), |
179 |
eEG2Release(_("Release"), 0, 60, 3), |
eEG2Release(_("Release Time (seconds)"), 0, 60, 3), |
180 |
eEG2Controller(_("Controller")), |
eEG2Controller(_("Controller")), |
181 |
eEG2ControllerInvert(_("Controller invert")), |
eEG2ControllerInvert(_("Controller invert")), |
182 |
eEG2ControllerAttackInfluence(_("Controller attack influence"), 0, 3), |
eEG2ControllerAttackInfluence(_("Controller attack influence"), 0, 3), |
221 |
ePitchTrack(_("Pitch track")), |
ePitchTrack(_("Pitch track")), |
222 |
eDimensionBypass(_("Dimension bypass")), |
eDimensionBypass(_("Dimension bypass")), |
223 |
ePan(_("Pan"), -64, 63), |
ePan(_("Pan"), -64, 63), |
224 |
eSelfMask(_("Self mask")), |
eSelfMask(_("Kill lower velocity voices (a.k.a \"Self mask\")")), |
225 |
eAttenuationController(_("Attenuation controller")), |
eAttenuationController(_("Attenuation controller")), |
226 |
eInvertAttenuationController(_("Invert attenuation controller")), |
eInvertAttenuationController(_("Invert attenuation controller")), |
227 |
eAttenuationControllerThreshold(_("Attenuation controller threshold")), |
eAttenuationControllerThreshold(_("Attenuation controller threshold")), |
228 |
eChannelOffset(_("Channel offset"), 0, 9), |
eChannelOffset(_("Channel offset"), 0, 9), |
229 |
eSustainDefeat(_("Sustain defeat")), |
eSustainDefeat(_("Ignore Hold Pedal (a.k.a. \"Sustain defeat\")")), |
230 |
eMSDecode(_("MS decode")), |
eMSDecode(_("Decode Mid/Side Recordings")), |
231 |
eSampleStartOffset(_("Sample start offset"), 0, 2000), |
eSampleStartOffset(_("Sample start offset"), 0, 2000), |
232 |
eUnityNote(_("Unity note")), |
eUnityNote(_("Unity note")), |
233 |
|
eSampleFormatInfo(_("Sample Format")), |
234 |
|
eSampleID("Sample ID"), |
235 |
eFineTune(_("Fine tune"), -49, 50), |
eFineTune(_("Fine tune"), -49, 50), |
236 |
eGain(_("Gain"), -96, 0, 2, -655360), |
eGain(_("Gain"), -96, 0, 2, -655360), |
237 |
eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360), |
eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360), |
241 |
eSampleLoopType(_("Loop type")), |
eSampleLoopType(_("Loop type")), |
242 |
eSampleLoopInfinite(_("Infinite loop")), |
eSampleLoopInfinite(_("Infinite loop")), |
243 |
eSampleLoopPlayCount(_("Playback count"), 1), |
eSampleLoopPlayCount(_("Playback count"), 1), |
244 |
|
buttonSelectSample(Glib::ustring("<- ") + _("Select Sample")), |
245 |
update_model(0) |
update_model(0) |
246 |
{ |
{ |
247 |
connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack); |
connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack); |
351 |
connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength); |
connect(eSampleLoopLength, &DimRegionEdit::set_LoopLength); |
352 |
connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite); |
connect(eSampleLoopInfinite, &DimRegionEdit::set_LoopInfinite); |
353 |
connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount); |
connect(eSampleLoopPlayCount, &DimRegionEdit::set_LoopPlayCount); |
354 |
|
buttonSelectSample.signal_clicked().connect( |
355 |
|
sigc::mem_fun(*this, &DimRegionEdit::onButtonSelectSamplePressed) |
356 |
|
); |
357 |
|
|
358 |
for (int i = 0 ; i < 7 ; i++) { |
for (int i = 0 ; i < 7 ; i++) { |
359 |
table[i] = new Gtk::Table(3, 1); |
table[i] = new Gtk::Table(3, 1); |
364 |
eUnityNote.set_tip( |
eUnityNote.set_tip( |
365 |
_("Note this sample is associated with (a.k.a. 'root note')") |
_("Note this sample is associated with (a.k.a. 'root note')") |
366 |
); |
); |
367 |
|
buttonSelectSample.set_tooltip_text( |
368 |
|
_("Selects the sample of this dimension region on the left hand side's sample tree view.") |
369 |
|
); |
370 |
eSampleStartOffset.set_tip(_("Sample position at which playback should be started")); |
eSampleStartOffset.set_tip(_("Sample position at which playback should be started")); |
371 |
ePan.set_tip(_("Stereo balance (left/right)")); |
ePan.set_tip(_("Stereo balance (left/right)")); |
372 |
eChannelOffset.set_tip( |
eChannelOffset.set_tip( |
397 |
"Caution: this setting is stored on Sample side, thus is shared " |
"Caution: this setting is stored on Sample side, thus is shared " |
398 |
"among all dimension regions that use this sample!") |
"among all dimension regions that use this sample!") |
399 |
); |
); |
400 |
|
|
401 |
|
eEG1PreAttack.set_tip( |
402 |
|
"Very first level this EG starts with. It rises then in Attack Time " |
403 |
|
"seconds from this initial level to 100%." |
404 |
|
); |
405 |
|
eEG1Attack.set_tip( |
406 |
|
"Duration of the EG's Attack stage, which raises its level from " |
407 |
|
"Pre-Attack Level to 100%." |
408 |
|
); |
409 |
|
eEG1Hold.set_tip( |
410 |
|
"On looped sounds, enabling this will cause the Decay 1 stage not to " |
411 |
|
"enter before the loop has been passed one time." |
412 |
|
); |
413 |
|
eAttenuationController.set_tip(_( |
414 |
|
"If you are not using the 'Layer' dimension, then this controller " |
415 |
|
"simply alters the volume. If you are using the 'Layer' dimension, " |
416 |
|
"then this controller is controlling the crossfade between Layers in " |
417 |
|
"real-time." |
418 |
|
)); |
419 |
|
|
420 |
|
eLFO1Sync.set_tip( |
421 |
|
"If not checked, every voice will use its own LFO instance, which " |
422 |
|
"causes voices triggered at different points in time to have different " |
423 |
|
"LFO levels. By enabling 'Sync' here the voices will instead use and " |
424 |
|
"share one single LFO, causing all voices to have the same LFO level, " |
425 |
|
"no matter when the individual notes have been triggered." |
426 |
|
); |
427 |
|
eLFO2Sync.set_tip( |
428 |
|
"If not checked, every voice will use its own LFO instance, which " |
429 |
|
"causes voices triggered at different points in time to have different " |
430 |
|
"LFO levels. By enabling 'Sync' here the voices will instead use and " |
431 |
|
"share one single LFO, causing all voices to have the same LFO level, " |
432 |
|
"no matter when the individual notes have been triggered." |
433 |
|
); |
434 |
|
eLFO3Sync.set_tip( |
435 |
|
"If not checked, every voice will use its own LFO instance, which " |
436 |
|
"causes voices triggered at different points in time to have different " |
437 |
|
"LFO levels. By enabling 'Sync' here the voices will instead use and " |
438 |
|
"share one single LFO, causing all voices to have the same LFO level, " |
439 |
|
"no matter when the individual notes have been triggered." |
440 |
|
); |
441 |
|
eLFO1FlipPhase.set_tip( |
442 |
|
"Inverts the LFO's generated wave vertically." |
443 |
|
); |
444 |
|
eLFO2FlipPhase.set_tip( |
445 |
|
"Inverts the LFO's generated wave vertically." |
446 |
|
); |
447 |
|
|
448 |
pageno = 0; |
pageno = 0; |
449 |
rowno = 0; |
rowno = 0; |
453 |
addString(_("Sample"), lSample, wSample); |
addString(_("Sample"), lSample, wSample); |
454 |
//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); |
455 |
#ifdef OLD_TOOLTIPS |
#ifdef OLD_TOOLTIPS |
456 |
tooltips.set_tip(*wSample, _("Drop a sample here")); |
tooltips.set_tip(*wSample, _("Drag & drop a sample here")); |
457 |
#else |
#else |
458 |
wSample->set_tooltip_text(_("Drop a sample here")); |
wSample->set_tooltip_text(_("Drag & drop a sample here")); |
459 |
#endif |
#endif |
460 |
addProp(eUnityNote); |
addProp(eUnityNote); |
461 |
|
addProp(eSampleFormatInfo); |
462 |
|
addProp(eSampleID); |
463 |
|
addRightHandSide(buttonSelectSample); |
464 |
addHeader(_("Optional Settings")); |
addHeader(_("Optional Settings")); |
465 |
addProp(eSampleStartOffset); |
addProp(eSampleStartOffset); |
466 |
addProp(eChannelOffset); |
addProp(eChannelOffset); |
490 |
addHeader(_("Amplitude Envelope (EG1)")); |
addHeader(_("Amplitude Envelope (EG1)")); |
491 |
addProp(eEG1PreAttack); |
addProp(eEG1PreAttack); |
492 |
addProp(eEG1Attack); |
addProp(eEG1Attack); |
493 |
|
addProp(eEG1Hold); |
494 |
addProp(eEG1Decay1); |
addProp(eEG1Decay1); |
495 |
addProp(eEG1Decay2); |
addProp(eEG1Decay2); |
496 |
addProp(eEG1InfiniteSustain); |
addProp(eEG1InfiniteSustain); |
497 |
addProp(eEG1Sustain); |
addProp(eEG1Sustain); |
498 |
addProp(eEG1Release); |
addProp(eEG1Release); |
|
addProp(eEG1Hold); |
|
499 |
addProp(eEG1Controller); |
addProp(eEG1Controller); |
500 |
addProp(eEG1ControllerInvert); |
addProp(eEG1ControllerInvert); |
501 |
addProp(eEG1ControllerAttackInfluence); |
addProp(eEG1ControllerAttackInfluence); |
695 |
|
|
696 |
nextPage(); |
nextPage(); |
697 |
|
|
698 |
addHeader(_("Velocity Reponse")); |
addHeader(_("Velocity Response")); |
699 |
eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values); |
eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values); |
700 |
addProp(eVelocityResponseCurve); |
addProp(eVelocityResponseCurve); |
701 |
addProp(eVelocityResponseDepth); |
addProp(eVelocityResponseDepth); |
714 |
Gtk::SHRINK, Gtk::SHRINK); |
Gtk::SHRINK, Gtk::SHRINK); |
715 |
rowno++; |
rowno++; |
716 |
|
|
717 |
addHeader(_("Release Velocity Reponse")); |
addHeader(_("Release Velocity Response")); |
718 |
eReleaseVelocityResponseCurve.set_choices(curve_type_texts, |
eReleaseVelocityResponseCurve.set_choices(curve_type_texts, |
719 |
curve_type_values); |
curve_type_values); |
720 |
addProp(eReleaseVelocityResponseCurve); |
addProp(eReleaseVelocityResponseCurve); |
741 |
eDimensionBypass.set_choices(choices, values); |
eDimensionBypass.set_choices(choices, values); |
742 |
} |
} |
743 |
addProp(eDimensionBypass); |
addProp(eDimensionBypass); |
744 |
|
eSelfMask.widget.set_tooltip_text(_( |
745 |
|
"If enabled: new notes with higher velocity value will stop older " |
746 |
|
"notes with lower velocity values, that way you can save voices that " |
747 |
|
"would barely be audible. This is also useful for certain drum sounds." |
748 |
|
)); |
749 |
addProp(eSelfMask); |
addProp(eSelfMask); |
750 |
|
eSustainDefeat.widget.set_tooltip_text(_( |
751 |
|
"If enabled: sustain pedal will not hold a note. This way you can use " |
752 |
|
"the sustain pedal for other purposes, for example to switch among " |
753 |
|
"dimension regions." |
754 |
|
)); |
755 |
addProp(eSustainDefeat); |
addProp(eSustainDefeat); |
756 |
|
eMSDecode.widget.set_tooltip_text(_( |
757 |
|
"Defines if Mid/Side Recordings should be decoded. Mid/Side Recordings " |
758 |
|
"are an alternative way to record sounds in stereo. The sampler needs " |
759 |
|
"to decode such samples to actually make use of them. Note: this " |
760 |
|
"feature is currently not supported by LinuxSampler." |
761 |
|
)); |
762 |
addProp(eMSDecode); |
addProp(eMSDecode); |
763 |
|
|
764 |
nextPage(); |
nextPage(); |
892 |
rowno++; |
rowno++; |
893 |
} |
} |
894 |
|
|
895 |
|
void DimRegionEdit::addRightHandSide(Gtk::Widget& widget) |
896 |
|
{ |
897 |
|
table[pageno]->attach(widget, 2, 3, rowno, rowno + 1, |
898 |
|
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
899 |
|
rowno++; |
900 |
|
} |
901 |
|
|
902 |
void DimRegionEdit::set_dim_region(gig::DimensionRegion* d) |
void DimRegionEdit::set_dim_region(gig::DimensionRegion* d) |
903 |
{ |
{ |
990 |
eMSDecode.set_value(d->MSDecode); |
eMSDecode.set_value(d->MSDecode); |
991 |
eSampleStartOffset.set_value(d->SampleStartOffset); |
eSampleStartOffset.set_value(d->SampleStartOffset); |
992 |
eUnityNote.set_value(d->UnityNote); |
eUnityNote.set_value(d->UnityNote); |
993 |
|
// assemble sample format info string |
994 |
|
{ |
995 |
|
Glib::ustring s; |
996 |
|
if (d->pSample) { |
997 |
|
switch (d->pSample->Channels) { |
998 |
|
case 1: s = _("Mono"); break; |
999 |
|
case 2: s = _("Stereo"); break; |
1000 |
|
default: |
1001 |
|
s = ToString(d->pSample->Channels) + _(" audio channels"); |
1002 |
|
break; |
1003 |
|
} |
1004 |
|
s += " " + ToString(d->pSample->BitDepth) + " Bits"; |
1005 |
|
s += " " + ToString(d->pSample->SamplesPerSecond/1000) + "." |
1006 |
|
+ ToString((d->pSample->SamplesPerSecond%1000)/100) + " kHz"; |
1007 |
|
} else { |
1008 |
|
s = _("No sample assigned to this dimension region."); |
1009 |
|
} |
1010 |
|
eSampleFormatInfo.text.set_text(s); |
1011 |
|
} |
1012 |
|
// generate sample's memory address pointer string |
1013 |
|
{ |
1014 |
|
Glib::ustring s; |
1015 |
|
if (d->pSample) { |
1016 |
|
char buf[64] = {}; |
1017 |
|
snprintf(buf, sizeof(buf), "%p", d->pSample); |
1018 |
|
s = buf; |
1019 |
|
} else { |
1020 |
|
s = "---"; |
1021 |
|
} |
1022 |
|
eSampleID.text.set_text(s); |
1023 |
|
} |
1024 |
|
buttonSelectSample.set_sensitive(d && d->pSample); |
1025 |
eFineTune.set_value(d->FineTune); |
eFineTune.set_value(d->FineTune); |
1026 |
eGain.set_value(d->Gain); |
eGain.set_value(d->Gain); |
1027 |
eGainPlus6.set_value(d->Gain); |
eGainPlus6.set_value(d->Gain); |
1261 |
update_model--; |
update_model--; |
1262 |
} |
} |
1263 |
|
|
1264 |
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) |
1265 |
{ |
{ |
1266 |
if (dimregion) { |
if (dimregion) { |
1267 |
//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 |
1305 |
d[i]->pSample = sample; |
d[i]->pSample = sample; |
1306 |
|
|
1307 |
// copy sample information from Sample to DimensionRegion |
// copy sample information from Sample to DimensionRegion |
1308 |
|
if (copy_sample_unity) |
1309 |
d[i]->UnityNote = sample->MIDIUnityNote; |
d[i]->UnityNote = sample->MIDIUnityNote; |
1310 |
d[i]->FineTune = sample->FineTune; |
if (copy_sample_tune) |
1311 |
|
d[i]->FineTune = sample->FineTune; |
1312 |
int loops = sample->Loops ? 1 : 0; |
if (copy_sample_loop) { |
1313 |
while (d[i]->SampleLoops > loops) { |
int loops = sample->Loops ? 1 : 0; |
1314 |
d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]); |
while (d[i]->SampleLoops > loops) { |
1315 |
} |
d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]); |
1316 |
while (d[i]->SampleLoops < sample->Loops) { |
} |
1317 |
DLS::sample_loop_t loop; |
while (d[i]->SampleLoops < sample->Loops) { |
1318 |
d[i]->AddSampleLoop(&loop); |
DLS::sample_loop_t loop; |
1319 |
} |
d[i]->AddSampleLoop(&loop); |
1320 |
if (loops) { |
} |
1321 |
d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t); |
if (loops) { |
1322 |
d[i]->pSampleLoops[0].LoopType = sample->LoopType; |
d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t); |
1323 |
d[i]->pSampleLoops[0].LoopStart = sample->LoopStart; |
d[i]->pSampleLoops[0].LoopType = sample->LoopType; |
1324 |
d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1; |
d[i]->pSampleLoops[0].LoopStart = sample->LoopStart; |
1325 |
|
d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1; |
1326 |
|
} |
1327 |
} |
} |
1328 |
} |
} |
1329 |
|
|
1468 |
{ |
{ |
1469 |
if (d->pSample) d->pSample->LoopPlayCount = value; |
if (d->pSample) d->pSample->LoopPlayCount = value; |
1470 |
} |
} |
1471 |
|
|
1472 |
|
void DimRegionEdit::onButtonSelectSamplePressed() { |
1473 |
|
if (!dimregion) return; |
1474 |
|
if (!dimregion->pSample) return; |
1475 |
|
select_sample_signal.emit(dimregion->pSample); |
1476 |
|
} |
1477 |
|
|
1478 |
|
sigc::signal<void, gig::Sample*>& DimRegionEdit::signal_select_sample() { |
1479 |
|
return select_sample_signal; |
1480 |
|
} |