Skip to content

Commit

Permalink
Improved process for maxOffset in FilePool::setPreloadSize()
Browse files Browse the repository at this point in the history
  • Loading branch information
KKQ-KKQ authored and paulfd committed Mar 20, 2024
1 parent 3205fb4 commit 28e5130
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/sfizz/FilePool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,12 +467,12 @@ void sfz::FilePool::setPreloadSize(uint32_t preloadSize) noexcept
for (auto& preloadedFile : preloadedFiles) {
auto& fileId = preloadedFile.first;
auto& fileData = preloadedFile.second;
const uint32_t maxOffset = fileData.information.maxOffset;
const auto maxOffset = fileData.information.maxOffset;
fs::path file { rootDirectory / fileId.filename() };
AudioReaderPtr reader = createAudioReader(file, fileId.isReverse());
const uint32_t frames = static_cast<uint32_t>(reader->frames());
const uint32_t framesToLoad = min(frames, maxOffset + preloadSize);
fileData.preloadedData = readFromFile(*reader, framesToLoad);
const auto frames = reader->frames();
const auto framesToLoad = min(frames, maxOffset + preloadSize);
fileData.preloadedData = readFromFile(*reader, static_cast<uint32_t>(framesToLoad));
fileData.fullyLoaded = frames == framesToLoad;
}
}
Expand Down

0 comments on commit 28e5130

Please sign in to comment.