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