Handle the stricter iterators of msvc
This commit is contained in:
parent
2c754baf4e
commit
60a08863c6
2 changed files with 17 additions and 17 deletions
|
|
@ -289,17 +289,17 @@ void sfz::FilePool::cleanupPromises() noexcept
|
||||||
// The garbage collection cleared the data from these so we can move them
|
// The garbage collection cleared the data from these so we can move them
|
||||||
// back to the empty queue
|
// back to the empty queue
|
||||||
auto clearedIterator = promisesToClear.begin();
|
auto clearedIterator = promisesToClear.begin();
|
||||||
auto clearedSentinel = promisesToClear.end() - 1;
|
auto clearedSentinel = promisesToClear.rbegin();
|
||||||
while (clearedIterator != promisesToClear.end()) {
|
while (clearedIterator < clearedSentinel.base()) {
|
||||||
if (clearedIterator->get()->dataReady == false) {
|
if (clearedIterator->get()->dataReady == false) {
|
||||||
emptyPromises.push_back(*clearedIterator);
|
emptyPromises.push_back(*clearedIterator);
|
||||||
std::iter_swap(clearedIterator, clearedSentinel);
|
std::iter_swap(clearedIterator, clearedSentinel);
|
||||||
clearedSentinel--;
|
++clearedSentinel;
|
||||||
promisesToClear.pop_back();
|
|
||||||
} else {
|
} else {
|
||||||
clearedIterator++;
|
++clearedIterator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
promisesToClear.resize(std::distance(promisesToClear.begin(), clearedSentinel.base()));
|
||||||
|
|
||||||
FilePromisePtr promise;
|
FilePromisePtr promise;
|
||||||
// Remove the promises from the filled queue and put them in a linear
|
// Remove the promises from the filled queue and put them in a linear
|
||||||
|
|
@ -308,17 +308,17 @@ void sfz::FilePool::cleanupPromises() noexcept
|
||||||
temporaryFilePromises.push_back(promise);
|
temporaryFilePromises.push_back(promise);
|
||||||
|
|
||||||
auto filledIterator = temporaryFilePromises.begin();
|
auto filledIterator = temporaryFilePromises.begin();
|
||||||
auto filledSentinel = temporaryFilePromises.end() - 1;
|
auto filledSentinel = temporaryFilePromises.rbegin();
|
||||||
while (filledIterator != temporaryFilePromises.end()) {
|
while (filledIterator < filledSentinel.base()) {
|
||||||
if (filledIterator->use_count() == 1) {
|
if (filledIterator->use_count() == 1) {
|
||||||
promisesToClear.push_back(*filledIterator);
|
promisesToClear.push_back(*filledIterator);
|
||||||
std::iter_swap(filledIterator, filledSentinel);
|
std::iter_swap(filledIterator, filledSentinel);
|
||||||
filledSentinel--;
|
++filledSentinel;
|
||||||
temporaryFilePromises.pop_back();
|
|
||||||
} else {
|
} else {
|
||||||
filledIterator++;
|
++filledIterator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
temporaryFilePromises.resize(std::distance(temporaryFilePromises.begin(), filledSentinel.base()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void sfz::FilePool::setOversamplingFactor(sfz::Oversampling factor) noexcept
|
void sfz::FilePool::setOversamplingFactor(sfz::Oversampling factor) noexcept
|
||||||
|
|
|
||||||
|
|
@ -237,9 +237,9 @@ bool sfz::Synth::loadSfzFile(const fs::path& filename)
|
||||||
|
|
||||||
resources.filePool.setRootDirectory(this->originalDirectory);
|
resources.filePool.setRootDirectory(this->originalDirectory);
|
||||||
|
|
||||||
auto lastRegion = regions.end() - 1;
|
|
||||||
auto currentRegion = regions.begin();
|
auto currentRegion = regions.begin();
|
||||||
while (currentRegion <= lastRegion) {
|
auto lastRegion = regions.rbegin();
|
||||||
|
while (currentRegion < lastRegion.base()) {
|
||||||
auto region = currentRegion->get();
|
auto region = currentRegion->get();
|
||||||
|
|
||||||
if (!region->isGenerator()) {
|
if (!region->isGenerator()) {
|
||||||
|
|
@ -247,7 +247,7 @@ bool sfz::Synth::loadSfzFile(const fs::path& filename)
|
||||||
if (!fileInformation) {
|
if (!fileInformation) {
|
||||||
DBG("Removing the region with sample " << region->sample);
|
DBG("Removing the region with sample " << region->sample);
|
||||||
std::iter_swap(currentRegion, lastRegion);
|
std::iter_swap(currentRegion, lastRegion);
|
||||||
lastRegion--;
|
++lastRegion;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
region->sampleEnd = std::min(region->sampleEnd, fileInformation->end);
|
region->sampleEnd = std::min(region->sampleEnd, fileInformation->end);
|
||||||
|
|
@ -298,11 +298,11 @@ bool sfz::Synth::loadSfzFile(const fs::path& filename)
|
||||||
region->registerAftertouch(0);
|
region->registerAftertouch(0);
|
||||||
region->registerTempo(2.0f);
|
region->registerTempo(2.0f);
|
||||||
|
|
||||||
currentRegion++;
|
++currentRegion;
|
||||||
}
|
}
|
||||||
|
const auto remainingRegions = std::distance(regions.begin(), lastRegion.base());
|
||||||
DBG("Removed " << regions.size() - std::distance(regions.begin(), lastRegion) - 1 << " out of " << regions.size() << " regions.");
|
DBG("Removing " << (regions.size() - remainingRegions) << " out of " << regions.size() << " regions");
|
||||||
regions.resize(std::distance(regions.begin(), lastRegion) + 1);
|
regions.resize(remainingRegions);
|
||||||
modificationTime = checkModificationTime();
|
modificationTime = checkModificationTime();
|
||||||
|
|
||||||
return parserReturned;
|
return parserReturned;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue