1151 |
update_model--; |
update_model--; |
1152 |
} |
} |
1153 |
|
|
1154 |
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) |
1155 |
{ |
{ |
1156 |
if (dimregion) { |
if (dimregion) { |
1157 |
//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 |
1195 |
d[i]->pSample = sample; |
d[i]->pSample = sample; |
1196 |
|
|
1197 |
// copy sample information from Sample to DimensionRegion |
// copy sample information from Sample to DimensionRegion |
1198 |
|
if (copy_sample_unity) |
1199 |
d[i]->UnityNote = sample->MIDIUnityNote; |
d[i]->UnityNote = sample->MIDIUnityNote; |
1200 |
d[i]->FineTune = sample->FineTune; |
if (copy_sample_tune) |
1201 |
|
d[i]->FineTune = sample->FineTune; |
1202 |
int loops = sample->Loops ? 1 : 0; |
if (copy_sample_loop) { |
1203 |
while (d[i]->SampleLoops > loops) { |
int loops = sample->Loops ? 1 : 0; |
1204 |
d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]); |
while (d[i]->SampleLoops > loops) { |
1205 |
} |
d[i]->DeleteSampleLoop(&d[i]->pSampleLoops[0]); |
1206 |
while (d[i]->SampleLoops < sample->Loops) { |
} |
1207 |
DLS::sample_loop_t loop; |
while (d[i]->SampleLoops < sample->Loops) { |
1208 |
d[i]->AddSampleLoop(&loop); |
DLS::sample_loop_t loop; |
1209 |
} |
d[i]->AddSampleLoop(&loop); |
1210 |
if (loops) { |
} |
1211 |
d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t); |
if (loops) { |
1212 |
d[i]->pSampleLoops[0].LoopType = sample->LoopType; |
d[i]->pSampleLoops[0].Size = sizeof(DLS::sample_loop_t); |
1213 |
d[i]->pSampleLoops[0].LoopStart = sample->LoopStart; |
d[i]->pSampleLoops[0].LoopType = sample->LoopType; |
1214 |
d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1; |
d[i]->pSampleLoops[0].LoopStart = sample->LoopStart; |
1215 |
|
d[i]->pSampleLoops[0].LoopLength = sample->LoopEnd - sample->LoopStart + 1; |
1216 |
|
} |
1217 |
} |
} |
1218 |
} |
} |
1219 |
|
|