Fix clipped sample rate changing between files
When the clipped sample rate changes, the resampler needs to be restarted. This was previously failing because the target sample rate wasn't changing. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
323a554832
commit
3d24168ba7
2 changed files with 9 additions and 1 deletions
|
@ -43,6 +43,8 @@ using std::atomic_long;
|
||||||
BOOL rsDone;
|
BOOL rsDone;
|
||||||
void *rsstate, *rsold;
|
void *rsstate, *rsold;
|
||||||
|
|
||||||
|
double lastClippedSampleRate;
|
||||||
|
|
||||||
void *rsvis;
|
void *rsvis;
|
||||||
double lastVisRate;
|
double lastVisRate;
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,10 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA
|
||||||
format.mSampleRate = maxSampleRate;
|
format.mSampleRate = maxSampleRate;
|
||||||
dstRate = maxSampleRate;
|
dstRate = maxSampleRate;
|
||||||
formatClipped = YES;
|
formatClipped = YES;
|
||||||
|
if(srcRate != lastClippedSampleRate) {
|
||||||
|
lastClippedSampleRate = srcRate;
|
||||||
|
streamFormatStarted = NO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(!streamFormatStarted || config != realStreamChannelConfig || memcmp(&newFormat, &format, sizeof(format)) != 0) {
|
if(!streamFormatStarted || config != realStreamChannelConfig || memcmp(&newFormat, &format, sizeof(format)) != 0) {
|
||||||
[currentPtsLock lock];
|
[currentPtsLock lock];
|
||||||
|
@ -817,7 +821,7 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
|
||||||
rsDone = NO;
|
rsDone = NO;
|
||||||
realStreamFormat = newFormat;
|
realStreamFormat = newFormat;
|
||||||
realStreamChannelConfig = newChannelConfig;
|
realStreamChannelConfig = newChannelConfig;
|
||||||
streamFormatChanged = YES;
|
[self updateStreamFormat];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -963,6 +967,8 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
|
||||||
rsstate = NULL;
|
rsstate = NULL;
|
||||||
rsold = NULL;
|
rsold = NULL;
|
||||||
|
|
||||||
|
lastClippedSampleRate = 0.0;
|
||||||
|
|
||||||
rsvis = NULL;
|
rsvis = NULL;
|
||||||
lastVisRate = 44100.0;
|
lastVisRate = 44100.0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue