Corrected a bug where the Voice would try to read beyond the preloaded data when the background loading thread fails to run in time. This whole logic could probably use an overhaul.
This commit is contained in:
parent
d6d7eb73df
commit
27efcd029d
1 changed files with 2 additions and 2 deletions
|
|
@ -365,8 +365,8 @@ void sfz::Voice::fillWithData(AudioSpan<float> buffer) noexcept
|
|||
::add<int>(sourcePosition, indices);
|
||||
|
||||
//FIXME : all this casting is driving me crazy
|
||||
const auto sampleEnd = static_cast<int>(region->trueSampleEnd()) - 1;
|
||||
if (region->shouldLoop() && static_cast<size_t>(sampleEnd) <= source.getNumFrames()) {
|
||||
const auto sampleEnd = min(static_cast<int>(region->trueSampleEnd()), static_cast<int>(source.getNumFrames())) - 1;
|
||||
if (region->shouldLoop() && region->loopRange.getEnd() <= source.getNumFrames()) {
|
||||
const auto offset = sampleEnd - static_cast<int>(region->loopRange.getStart());
|
||||
for (auto* index = indices.begin(); index < indices.end(); ++index) {
|
||||
if (*index > sampleEnd) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue