Backport frequency changes (#820)

Adjust default input rate, too.
Use nominal frequency ratio for APU.
This commit is contained in:
bladeoner 2019-02-24 02:51:28 +01:00 committed by dborth
parent d85c32f263
commit dc9149939e
5 changed files with 11 additions and 11 deletions

View File

@ -498,7 +498,7 @@ DefaultSettings ()
Settings.Stereo = true;
Settings.ReverseStereo = true;
Settings.SoundPlaybackRate = 48000;
Settings.SoundInputRate = 31950;
Settings.SoundInputRate = 31920;
Settings.DynamicRateControl = true;
// Interpolation Method

View File

@ -15,10 +15,10 @@
#define APU_DEFAULT_INPUT_RATE 32040
#define APU_MINIMUM_SAMPLE_COUNT 512
#define APU_MINIMUM_SAMPLE_BLOCK 128
#define APU_NUMERATOR_NTSC 15664
#define APU_DENOMINATOR_NTSC 328125
#define APU_NUMERATOR_PAL 34176
#define APU_DENOMINATOR_PAL 709379
#define APU_NUMERATOR_NTSC 5632
#define APU_DENOMINATOR_NTSC 118125
#define APU_NUMERATOR_PAL 35527
#define APU_DENOMINATOR_PAL 738343
SNES_SPC *spc_core = NULL;
@ -314,7 +314,7 @@ void UpdatePlaybackRate (void)
if (Settings.MSU1)
{
time_ratio = (44100.0 / Settings.SoundPlaybackRate) * (Settings.SoundInputRate / 32040.0);
time_ratio = (44100.0 / Settings.SoundPlaybackRate) * (Settings.SoundInputRate / 32000.0);
msu::resampler->time_ratio(time_ratio);
}
}

View File

@ -237,7 +237,7 @@ void S9xMSU1Generate(size_t sample_count)
{
partial_frames += 4410 * (sample_count / 2);
while ((bufPos < (bufEnd - 2)) && partial_frames >= 3204)
while ((bufPos < (bufEnd - 2)) && partial_frames >= 3200)
{
if (MSU1.MSU1_STATUS & AudioPlaying && audioStream)
{
@ -255,7 +255,7 @@ void S9xMSU1Generate(size_t sample_count)
*(bufPos++) = *left;
*(bufPos++) = *right;
MSU1.MSU1_AUDIO_POS += 4;
partial_frames -= 3204;
partial_frames -= 3200;
}
else
if (bytes_read >= 0)
@ -279,7 +279,7 @@ void S9xMSU1Generate(size_t sample_count)
else
{
MSU1.MSU1_STATUS &= ~(AudioPlaying | AudioRepeating);
partial_frames -= 3204;
partial_frames -= 3200;
*(bufPos++) = 0;
*(bufPos++) = 0;
}

View File

@ -62,7 +62,7 @@
#define IMAGE_WIDTH (Settings.SupportHiRes ? MAX_SNES_WIDTH : SNES_WIDTH)
#define IMAGE_HEIGHT (Settings.SupportHiRes ? MAX_SNES_HEIGHT : SNES_HEIGHT_EXTENDED)
#define NTSC_MASTER_CLOCK 21477272.0
#define NTSC_MASTER_CLOCK 21477272.727272 // 21477272 + 8/11 exact
#define PAL_MASTER_CLOCK 21281370.0
#define SNES_MAX_NTSC_VCOUNTER 262

View File

@ -638,7 +638,7 @@ ResetVideo_Emu ()
else
ResetFbWidth(512, rmode);
Settings.SoundInputRate = 31950;
Settings.SoundInputRate = 31920;
UpdatePlaybackRate();
}