1 |
/* |
/* |
2 |
* Copyright (C) 2006-2014 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 |
230 |
eMSDecode(_("Decode Mid/Side Recordings")), |
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( |
458 |
wSample->set_tooltip_text(_("Drag & 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); |
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); |
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 |
|
} |