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
|
@ -42,6 +42,8 @@ using std::atomic_long;
|
|||
|
||||
BOOL rsDone;
|
||||
void *rsstate, *rsold;
|
||||
|
||||
double lastClippedSampleRate;
|
||||
|
||||
void *rsvis;
|
||||
double lastVisRate;
|
||||
|
|
|
@ -85,6 +85,10 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA
|
|||
format.mSampleRate = maxSampleRate;
|
||||
dstRate = maxSampleRate;
|
||||
formatClipped = YES;
|
||||
if(srcRate != lastClippedSampleRate) {
|
||||
lastClippedSampleRate = srcRate;
|
||||
streamFormatStarted = NO;
|
||||
}
|
||||
}
|
||||
if(!streamFormatStarted || config != realStreamChannelConfig || memcmp(&newFormat, &format, sizeof(format)) != 0) {
|
||||
[currentPtsLock lock];
|
||||
|
@ -817,7 +821,7 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
|
|||
rsDone = NO;
|
||||
realStreamFormat = newFormat;
|
||||
realStreamChannelConfig = newChannelConfig;
|
||||
streamFormatChanged = YES;
|
||||
[self updateStreamFormat];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -962,6 +966,8 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
|
|||
rsDone = NO;
|
||||
rsstate = NULL;
|
||||
rsold = NULL;
|
||||
|
||||
lastClippedSampleRate = 0.0;
|
||||
|
||||
rsvis = NULL;
|
||||
lastVisRate = 44100.0;
|
||||
|
|
Loading…
Reference in a new issue