1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-15 17:11:20 +01:00

This fixes a couple of issues with AudioUnits and 1 with latency

If latency was introduced by an effect, the input position could
get offset by the amount of latency, such that the same input
would be processed twice for the number of sample of latency.

There was an issue in AUs where a "latency done" flags wasn't
being reset and so the second and subsequent uses of an effect
could not latency correct.

And in research that, I found that you need to set the sample rate
on all 3 scopes (global, input, and output) instead of just the
global scope.
This commit is contained in:
lllucius@gmail.com
2015-01-11 22:52:08 +00:00
parent dbe7e0280c
commit 85f6279d21
3 changed files with 68 additions and 55 deletions

View File

@@ -1003,6 +1003,8 @@ bool Effect::ProcessTrack(int count,
sampleCount outputBufferCnt = 0;
bool cleared = false;
int chans = wxMin(mNumAudioOut, mNumChannels);
WaveTrack *genLeft = NULL;
WaveTrack *genRight = NULL;
sampleCount genLength = 0;
@@ -1134,6 +1136,13 @@ bool Effect::ProcessTrack(int count,
inputBufferCnt -= curBlockSize;
}
// "ls" and "rs" serve as the input sample index for the left and
// right channels when processing the input samples. If we flip
// over to processing delayed samples, they simply become counters
// for the progress display.
inLeftPos += curBlockSize;
inRightPos += curBlockSize;
// Get the current number of delayed samples and accumulate
if (isProcessor)
{
@@ -1154,22 +1163,22 @@ bool Effect::ProcessTrack(int count,
else if (curDelay > 0)
{
curBlockSize -= curDelay;
for (int i = 0; i < wxMin(mNumAudioOut, mNumChannels); i++)
for (int i = 0; i < chans; i++)
{
memmove(mOutBufPos[i], mOutBufPos[i] + curDelay, SAMPLE_SIZE(floatSample) * curBlockSize);
memmove(mOutBufPos[i], mOutBufPos[i] + curDelay, sizeof(float) * curBlockSize);
}
curDelay = 0;
}
}
//
// Adjust the number of samples in the output buffers
outputBufferCnt += curBlockSize;
//
// Still have room in the output buffers
if (outputBufferCnt < mBufferSize)
{
// Bump to next output buffer position
for (int i = 0; i < wxMin(mNumAudioOut, mNumChannels); i++)
for (int i = 0; i < chans; i++)
{
mOutBufPos[i] += curBlockSize;
}
@@ -1196,7 +1205,7 @@ bool Effect::ProcessTrack(int count,
}
// Reset the output buffer positions
for (int i = 0; i < wxMin(mNumAudioOut, mNumChannels); i++)
for (int i = 0; i < chans; i++)
{
mOutBufPos[i] = mOutBuffer[i];
}
@@ -1207,13 +1216,6 @@ bool Effect::ProcessTrack(int count,
outputBufferCnt = 0;
}
// "ls" and "rs" serve as the input sample index for the left and
// right channels when processing the input samples. If we flip
// over to processing delayed samples, they simply become counters
// for the progress display.
inLeftPos += curBlockSize;
inRightPos += curBlockSize;
if (mNumChannels > 1)
{
if (TrackGroupProgress(count, (inLeftPos - leftStart) / (double) len))