Amend r8bstate definition with extra safety
Just in case anything using the implementation ever needs to request less sample data than would be returned by the resampler, it should be able to return a remainder and keep extra remaining samples, if any. However, the way Cog currently uses it, it would not be likely to run into this scenario. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
ed0f7d81ab
commit
7c5cec1eb7
1 changed files with 10 additions and 0 deletions
10
Audio/ThirdParty/r8bstate.h
vendored
10
Audio/ThirdParty/r8bstate.h
vendored
|
@ -55,6 +55,11 @@ struct r8bstate {
|
|||
vDSP_vdpsp(&OutBufs[i][0], 1, output + i, channelCount, blockCount);
|
||||
}
|
||||
remainder -= blockCount;
|
||||
if(remainder > 0) {
|
||||
for(i = 0; i < channelCount; ++i) {
|
||||
memmove(&OutBufs[i][0], &OutBufs[i][blockCount], remainder * sizeof(double));
|
||||
}
|
||||
}
|
||||
output += channelCount * blockCount;
|
||||
outProcessed += blockCount;
|
||||
outMax -= blockCount;
|
||||
|
@ -108,6 +113,11 @@ struct r8bstate {
|
|||
vDSP_vdpsp(&OutBufs[i][0], 1, output + i, channelCount, blockCount);
|
||||
}
|
||||
remainder -= blockCount;
|
||||
if(remainder > 0) {
|
||||
for(i = 0; i < channelCount; ++i) {
|
||||
memmove(&OutBufs[i][0], &OutBufs[i][blockCount], remainder * sizeof(double));
|
||||
}
|
||||
}
|
||||
output += channelCount * blockCount;
|
||||
outProcessed += blockCount;
|
||||
outMax -= blockCount;
|
||||
|
|
Loading…
Reference in a new issue