mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-05 06:09:47 +02:00
More uses of limitSampleBufferSize
This commit is contained in:
commit
b53e9ff418
@ -502,11 +502,10 @@ bool EffectChangeSpeed::ProcessOne(WaveTrack * track,
|
||||
auto samplePos = start;
|
||||
while (samplePos < end) {
|
||||
//Get a blockSize of samples (smaller than the size of the buffer)
|
||||
auto blockSize = track->GetBestBlockSize(samplePos);
|
||||
|
||||
//Adjust the block size if it is the final block in the track
|
||||
if (samplePos + blockSize > end)
|
||||
blockSize = end - samplePos;
|
||||
auto blockSize = limitSampleBufferSize(
|
||||
track->GetBestBlockSize(samplePos),
|
||||
end - samplePos
|
||||
);
|
||||
|
||||
//Get the samples from the track and put them in the buffer
|
||||
track->Get((samplePtr) inBuffer, floatSample, samplePos, blockSize);
|
||||
|
@ -217,9 +217,7 @@ bool EffectClickRemoval::ProcessOne(int count, WaveTrack * track, sampleCount st
|
||||
float *datawindow = new float[windowSize];
|
||||
while ((s < len) && ((len - s) > windowSize/2))
|
||||
{
|
||||
auto block = idealBlockLen;
|
||||
if (s + block > len)
|
||||
block = len - s;
|
||||
auto block = limitSampleBufferSize( idealBlockLen, len - s );
|
||||
|
||||
track->Get((samplePtr) buffer, floatSample, start + s, block);
|
||||
|
||||
|
@ -1627,10 +1627,7 @@ bool Effect::ProcessTrack(int count,
|
||||
if (delayRemaining != 0)
|
||||
{
|
||||
// Don't use more than needed
|
||||
if (delayRemaining < cnt)
|
||||
{
|
||||
cnt = delayRemaining;
|
||||
}
|
||||
cnt = limitSampleBufferSize(cnt, delayRemaining);
|
||||
delayRemaining -= cnt;
|
||||
curBlockSize += cnt;
|
||||
}
|
||||
@ -1640,11 +1637,7 @@ bool Effect::ProcessTrack(int count,
|
||||
else if (delayRemaining != 0)
|
||||
{
|
||||
// Calculate the number of samples to process
|
||||
curBlockSize = mBlockSize;
|
||||
if (curBlockSize > delayRemaining)
|
||||
{
|
||||
curBlockSize = delayRemaining;
|
||||
}
|
||||
curBlockSize = limitSampleBufferSize( mBlockSize, delayRemaining );
|
||||
delayRemaining -= curBlockSize;
|
||||
|
||||
// From this point on, we only want to feed zeros to the plugin
|
||||
|
@ -1086,9 +1086,7 @@ bool EffectEqualization::ProcessOne(int count, WaveTrack * t,
|
||||
|
||||
while (len != 0)
|
||||
{
|
||||
auto block = idealBlockLen;
|
||||
if (block > len)
|
||||
block = len;
|
||||
auto block = limitSampleBufferSize( idealBlockLen, len );
|
||||
|
||||
t->Get((samplePtr)buffer, floatSample, s, block);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user