mirror of https://github.com/snes9xgit/snes9x.git
Use 32040hz with more consistency.
This commit is contained in:
parent
6b46ed0d00
commit
cf846e0c56
|
@ -462,7 +462,7 @@ static void UpdatePlaybackRate (void)
|
|||
|
||||
if (Settings.MSU1)
|
||||
{
|
||||
time_ratio = (44100.0 / Settings.SoundPlaybackRate) * (Settings.SoundInputRate / 32040.5);
|
||||
time_ratio = (44100.0 / Settings.SoundPlaybackRate) * (Settings.SoundInputRate / 32040);
|
||||
msu::resampler->time_ratio(time_ratio);
|
||||
}
|
||||
}
|
||||
|
@ -472,8 +472,8 @@ bool8 S9xInitSound (int buffer_ms, int lag_ms)
|
|||
// buffer_ms : buffer size given in millisecond
|
||||
// lag_ms : allowable time-lag given in millisecond
|
||||
|
||||
int sample_count = buffer_ms * 32000 / 1000;
|
||||
int lag_sample_count = lag_ms * 32000 / 1000;
|
||||
int sample_count = buffer_ms * 32040 / 1000;
|
||||
int lag_sample_count = lag_ms * 32040 / 1000;
|
||||
|
||||
spc::lag_master = lag_sample_count;
|
||||
if (Settings.Stereo)
|
||||
|
@ -488,7 +488,7 @@ bool8 S9xInitSound (int buffer_ms, int lag_ms)
|
|||
spc::buffer_size <<= 1;
|
||||
if (Settings.SixteenBitSound)
|
||||
spc::buffer_size <<= 1;
|
||||
msu::buffer_size = ((buffer_ms * 44100 / 1000) * 441000 / 320405) << 2; // Always 16-bit, Stereo
|
||||
msu::buffer_size = ((buffer_ms * 44100 / 1000) * 44100 / 32040) << 2; // Always 16-bit, Stereo
|
||||
|
||||
printf("Sound buffer size: %d (%d samples)\n", spc::buffer_size, sample_count);
|
||||
|
||||
|
|
10
msu1.cpp
10
msu1.cpp
|
@ -197,8 +197,6 @@
|
|||
#include <fstream>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define APU_DEFAULT_INPUT_RATE 32000
|
||||
|
||||
std::ifstream dataFile, audioFile;
|
||||
uint32 audioLoopPos;
|
||||
uint32 partial_samples;
|
||||
|
@ -294,9 +292,9 @@ bool S9xMSU1ROMExists(void)
|
|||
|
||||
void S9xMSU1Generate(int sample_count)
|
||||
{
|
||||
partial_samples += 441000 * sample_count;
|
||||
partial_samples += 44100 * sample_count;
|
||||
|
||||
while (((uintptr_t)bufPos < (uintptr_t)bufEnd) && (MSU1.MSU1_STATUS & AudioPlaying) && partial_samples > 320405)
|
||||
while (((uintptr_t)bufPos < (uintptr_t)bufEnd) && (MSU1.MSU1_STATUS & AudioPlaying) && partial_samples > 32040)
|
||||
{
|
||||
if (audioFile.is_open())
|
||||
{
|
||||
|
@ -307,7 +305,7 @@ void S9xMSU1Generate(int sample_count)
|
|||
|
||||
*(bufPos++) = sample;
|
||||
MSU1.MSU1_AUDIO_POS += 2;
|
||||
partial_samples -= 320405;
|
||||
partial_samples -= 32040;
|
||||
}
|
||||
else
|
||||
if (audioFile.eof())
|
||||
|
@ -316,7 +314,7 @@ void S9xMSU1Generate(int sample_count)
|
|||
|
||||
*(bufPos++) = sample;
|
||||
MSU1.MSU1_AUDIO_POS += 2;
|
||||
partial_samples -= 320405;
|
||||
partial_samples -= 32040;
|
||||
|
||||
if (MSU1.MSU1_STATUS & AudioRepeating)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue