Changed loops to size_t
This commit is contained in:
parent
2c2c31f542
commit
0e76a67368
2 changed files with 5 additions and 5 deletions
|
|
@ -170,7 +170,7 @@ std::unique_ptr<sfz::AudioBuffer<T>> upsample2x(const sfz::AudioBuffer<T>& buffe
|
||||||
{
|
{
|
||||||
// auto tempBuffer = std::make_unique<sfz::Buffer<T>>(buffer.getNumFrames() * 2);
|
// auto tempBuffer = std::make_unique<sfz::Buffer<T>>(buffer.getNumFrames() * 2);
|
||||||
auto outputBuffer = std::make_unique<sfz::AudioBuffer<T>>(buffer.getNumChannels(), buffer.getNumFrames() * 2);
|
auto outputBuffer = std::make_unique<sfz::AudioBuffer<T>>(buffer.getNumChannels(), buffer.getNumFrames() * 2);
|
||||||
for (int channelIdx = 0; channelIdx < buffer.getNumChannels(); channelIdx++) {
|
for (size_t channelIdx = 0; channelIdx < buffer.getNumChannels(); channelIdx++) {
|
||||||
upsample2xStage<SIMD>(buffer.getConstSpan(channelIdx), outputBuffer->getSpan(channelIdx));
|
upsample2xStage<SIMD>(buffer.getConstSpan(channelIdx), outputBuffer->getSpan(channelIdx));
|
||||||
}
|
}
|
||||||
return outputBuffer;
|
return outputBuffer;
|
||||||
|
|
@ -181,7 +181,7 @@ std::unique_ptr<sfz::AudioBuffer<T>> upsample4x(const sfz::AudioBuffer<T>& buffe
|
||||||
{
|
{
|
||||||
auto tempBuffer = std::make_unique<sfz::Buffer<T>>(buffer.getNumFrames() * 2);
|
auto tempBuffer = std::make_unique<sfz::Buffer<T>>(buffer.getNumFrames() * 2);
|
||||||
auto outputBuffer = std::make_unique<sfz::AudioBuffer<T>>(buffer.getNumChannels(), buffer.getNumFrames() * 4);
|
auto outputBuffer = std::make_unique<sfz::AudioBuffer<T>>(buffer.getNumChannels(), buffer.getNumFrames() * 4);
|
||||||
for (int channelIdx = 0; channelIdx < buffer.getNumChannels(); channelIdx++) {
|
for (size_t channelIdx = 0; channelIdx < buffer.getNumChannels(); channelIdx++) {
|
||||||
upsample2xStage<SIMD>(buffer.getConstSpan(channelIdx), absl::MakeSpan(*tempBuffer));
|
upsample2xStage<SIMD>(buffer.getConstSpan(channelIdx), absl::MakeSpan(*tempBuffer));
|
||||||
upsample4xStage<SIMD>(absl::MakeConstSpan(*tempBuffer), outputBuffer->getSpan(channelIdx));
|
upsample4xStage<SIMD>(absl::MakeConstSpan(*tempBuffer), outputBuffer->getSpan(channelIdx));
|
||||||
}
|
}
|
||||||
|
|
@ -194,7 +194,7 @@ std::unique_ptr<sfz::AudioBuffer<T>> upsample8x(const sfz::AudioBuffer<T>& buffe
|
||||||
auto tempBuffer2x = std::make_unique<sfz::Buffer<T>>(buffer.getNumFrames() * 2);
|
auto tempBuffer2x = std::make_unique<sfz::Buffer<T>>(buffer.getNumFrames() * 2);
|
||||||
auto tempBuffer4x = std::make_unique<sfz::Buffer<T>>(buffer.getNumFrames() * 4);
|
auto tempBuffer4x = std::make_unique<sfz::Buffer<T>>(buffer.getNumFrames() * 4);
|
||||||
auto outputBuffer = std::make_unique<sfz::AudioBuffer<T>>(buffer.getNumChannels(), buffer.getNumFrames() * 8);
|
auto outputBuffer = std::make_unique<sfz::AudioBuffer<T>>(buffer.getNumChannels(), buffer.getNumFrames() * 8);
|
||||||
for (int channelIdx = 0; channelIdx < buffer.getNumChannels(); channelIdx++) {
|
for (size_t channelIdx = 0; channelIdx < buffer.getNumChannels(); channelIdx++) {
|
||||||
upsample2xStage<SIMD>(buffer.getConstSpan(channelIdx), absl::MakeSpan(*tempBuffer2x));
|
upsample2xStage<SIMD>(buffer.getConstSpan(channelIdx), absl::MakeSpan(*tempBuffer2x));
|
||||||
upsample4xStage<SIMD>(absl::MakeConstSpan(*tempBuffer2x), absl::MakeSpan(*tempBuffer4x));
|
upsample4xStage<SIMD>(absl::MakeConstSpan(*tempBuffer2x), absl::MakeSpan(*tempBuffer4x));
|
||||||
upsample8xStage<SIMD>(absl::MakeConstSpan(*tempBuffer4x), outputBuffer->getSpan(channelIdx));
|
upsample8xStage<SIMD>(absl::MakeConstSpan(*tempBuffer4x), outputBuffer->getSpan(channelIdx));
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ void sfz::Oversampler::stream(const sfz::AudioBuffer<float>& input, sfz::AudioBu
|
||||||
upsampler.set_coefs(coeffsStage2x.data());
|
upsampler.set_coefs(coeffsStage2x.data());
|
||||||
break;
|
break;
|
||||||
case Oversampling::x1:
|
case Oversampling::x1:
|
||||||
for (int i = 0; i < numChannels; ++i)
|
for (size_t i = 0; i < numChannels; ++i)
|
||||||
copy<float>(input.getConstSpan(i), output.getSpan(i));
|
copy<float>(input.getConstSpan(i), output.getSpan(i));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -122,7 +122,7 @@ void sfz::Oversampler::stream(const sfz::AudioBuffer<float>& input, sfz::AudioBu
|
||||||
// std::cout << "Input frames: " << inputFrameCounter << "/" << numFrames << '\n';
|
// std::cout << "Input frames: " << inputFrameCounter << "/" << numFrames << '\n';
|
||||||
const auto thisChunkSize = std::min(chunkSize, numFrames - inputFrameCounter);
|
const auto thisChunkSize = std::min(chunkSize, numFrames - inputFrameCounter);
|
||||||
const auto outputChunkSize { thisChunkSize * static_cast<int>(factor) };
|
const auto outputChunkSize { thisChunkSize * static_cast<int>(factor) };
|
||||||
for (int chanIdx = 0; chanIdx < numChannels; chanIdx++) {
|
for (size_t chanIdx = 0; chanIdx < numChannels; chanIdx++) {
|
||||||
const auto inputChunk = input.getSpan(chanIdx).subspan(inputFrameCounter, thisChunkSize);
|
const auto inputChunk = input.getSpan(chanIdx).subspan(inputFrameCounter, thisChunkSize);
|
||||||
const auto outputChunk = output.getSpan(chanIdx).subspan(outputFrameCounter, outputChunkSize);
|
const auto outputChunk = output.getSpan(chanIdx).subspan(outputFrameCounter, outputChunkSize);
|
||||||
if (factor == Oversampling::x2) {
|
if (factor == Oversampling::x2) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue