1 |
/* |
/* |
2 |
* Copyright (C) 2006-2013 Andreas Persson |
* Copyright (C) 2006-2014 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); |
925 |
d->pSample ? d->pSample->LoopPlayCount : 0); |
d->pSample ? d->pSample->LoopPlayCount : 0); |
926 |
update_model--; |
update_model--; |
927 |
|
|
928 |
wSample->set_text(d->pSample ? d->pSample->pInfo->Name.c_str() : _("NULL")); |
wSample->set_text(d->pSample ? gig_to_utf8(d->pSample->pInfo->Name) : |
929 |
|
_("NULL")); |
930 |
|
|
931 |
update_loop_elements(); |
update_loop_elements(); |
932 |
VCFEnabled_toggled(); |
VCFEnabled_toggled(); |
1148 |
update_model--; |
update_model--; |
1149 |
} |
} |
1150 |
|
|
1151 |
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) |
1152 |
{ |
{ |
1153 |
if (dimregion) { |
if (dimregion) { |
1154 |
//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 |
1192 |
d[i]->pSample = sample; |
d[i]->pSample = sample; |
1193 |
|
|
1194 |
// copy sample information from Sample to DimensionRegion |
// copy sample information from Sample to DimensionRegion |
1195 |
|
if (copy_sample_unity) |
1196 |
d[i]->UnityNote = sample->MIDIUnityNote; |
d[i]->UnityNote = sample->MIDIUnityNote; |
1197 |
d[i]->FineTune = sample->FineTune; |
if (copy_sample_tune) |
1198 |
|
d[i]->FineTune = sample->FineTune; |
1199 |
int loops = sample->Loops ? 1 : 0; |
if (copy_sample_loop) { |
1200 |
while (d[i]->SampleLoops > loops) { |
int loops = sample->Loops ? 1 : 0; |
1201 |
d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]); |
while (d[i]->SampleLoops > loops) { |
1202 |
} |
d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]); |
1203 |
while (d[i]->SampleLoops < sample->Loops) { |
} |
1204 |
DLS::sample_loop_t loop; |
while (d[i]->SampleLoops < sample->Loops) { |
1205 |
d[i]->AddSampleLoop(&loop); |
DLS::sample_loop_t loop; |
1206 |
} |
d[i]->AddSampleLoop(&loop); |
1207 |
if (loops) { |
} |
1208 |
d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t); |
if (loops) { |
1209 |
d[i]->pSampleLoops[0].LoopType = sample->LoopType; |
d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t); |
1210 |
d[i]->pSampleLoops[0].LoopStart = sample->LoopStart; |
d[i]->pSampleLoops[0].LoopType = sample->LoopType; |
1211 |
d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1; |
d[i]->pSampleLoops[0].LoopStart = sample->LoopStart; |
1212 |
|
d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1; |
1213 |
|
} |
1214 |
} |
} |
1215 |
} |
} |
1216 |
|
|
1217 |
// update ui |
// update ui |
1218 |
update_model++; |
update_model++; |
1219 |
wSample->set_text(dimregion->pSample->pInfo->Name); |
wSample->set_text(gig_to_utf8(dimregion->pSample->pInfo->Name)); |
1220 |
eUnityNote.set_value(dimregion->UnityNote); |
eUnityNote.set_value(dimregion->UnityNote); |
1221 |
eFineTune.set_value(dimregion->FineTune); |
eFineTune.set_value(dimregion->FineTune); |
1222 |
eSampleLoopEnabled.set_value(dimregion->SampleLoops); |
eSampleLoopEnabled.set_value(dimregion->SampleLoops); |