Adapt preload size
This commit is contained in:
parent
64a591fb7a
commit
02ad421fa3
1 changed files with 10 additions and 1 deletions
|
|
@ -374,7 +374,16 @@ bool sfz::Synth::loadSfzFile(const fs::path& file)
|
|||
region->hasStereoSample = true;
|
||||
|
||||
// TODO: adjust with LFO targets
|
||||
const auto maxOffset = region->offset + region->offsetRandom;
|
||||
const auto maxOffset = [region]() {
|
||||
uint64_t sumOffsetCC = region->offset + region->offsetRandom;
|
||||
for (const auto& offsets: region->offsetCC)
|
||||
sumOffsetCC += offsets.value;
|
||||
if (static_cast<uint64_t>(Default::offsetCCRange.getEnd()) < sumOffsetCC)
|
||||
return Default::offsetCCRange.getEnd();
|
||||
|
||||
return static_cast<uint32_t>(sumOffsetCC);
|
||||
}();
|
||||
|
||||
if (!resources.filePool.preloadFile(region->sample, maxOffset))
|
||||
removeCurrentRegion();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue