Audio: Fixed buffer underruns when using 60.0 FPS mode
This commit is contained in:
parent
6ea8d6c815
commit
3e947a8ba0
2 changed files with 15 additions and 3 deletions
|
@ -75,11 +75,22 @@ double SoundResampler::GetTargetRateAdjustment()
|
|||
|
||||
void SoundResampler::UpdateTargetSampleRate(uint32_t sampleRate)
|
||||
{
|
||||
uint32_t spcSampleRate = SoundResampler::SpcSampleRate;
|
||||
if(_console->GetSettings()->GetVideoConfig().IntegerFpsMode) {
|
||||
//Adjust sample rate when running at 60.0 fps instead of 60.1
|
||||
switch(_console->GetRegion()) {
|
||||
default:
|
||||
case ConsoleRegion::Ntsc: spcSampleRate = (uint32_t)(SoundResampler::SpcSampleRate * (60.0 / 60.0988118623484)); break;
|
||||
case ConsoleRegion::Pal: spcSampleRate = (uint32_t)(SoundResampler::SpcSampleRate * (50.0 / 50.00697796826829)); break;
|
||||
}
|
||||
}
|
||||
|
||||
double targetRate = sampleRate * GetTargetRateAdjustment();
|
||||
if(targetRate != _previousTargetRate) {
|
||||
blip_set_rates(_blipBufLeft, SoundResampler::SpcSampleRate, targetRate);
|
||||
blip_set_rates(_blipBufRight, SoundResampler::SpcSampleRate, targetRate);
|
||||
if(targetRate != _previousTargetRate || spcSampleRate != _prevSpcSampleRate) {
|
||||
blip_set_rates(_blipBufLeft, spcSampleRate, targetRate);
|
||||
blip_set_rates(_blipBufRight, spcSampleRate, targetRate);
|
||||
_previousTargetRate = targetRate;
|
||||
_prevSpcSampleRate = spcSampleRate;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ private:
|
|||
|
||||
double _rateAdjustment = 1.0;
|
||||
double _previousTargetRate = 0;
|
||||
uint32_t _prevSpcSampleRate = 0;
|
||||
int32_t _underTarget = 0;
|
||||
|
||||
blip_t *_blipBufLeft = nullptr;
|
||||
|
|
Loading…
Add table
Reference in a new issue