This commit is contained in:
zilmar 2018-12-08 20:22:37 +10:30
commit 0e2e8eef10
1 changed files with 11 additions and 21 deletions

View File

@ -85,14 +85,16 @@ EXPORT void CALL AiDacrateChanged(int SystemType)
WriteTrace(TraceAudioInterface, TraceNotice, "Unknown/reserved bits in AI_DACRATE_REG set. 0x%08X", *g_AudioInfo.AI_DACRATE_REG);
}
uint32_t video_clock = 0;
uint32_t video_clock = 0; int32_t BufferSize = 0;
double audio_clock = 0; double framerate = (30 / 1.001);
switch (SystemType)
{
case SYSTEM_NTSC: video_clock = 48681812; break;
case SYSTEM_PAL: video_clock = 49656530; break;
case SYSTEM_PAL: video_clock = 49656530; framerate = 25; break;
case SYSTEM_MPAL: video_clock = 48628316; break;
}
uint32_t Frequency = video_clock / (g_Dacrate + 1);
uint32_t Frequency = (video_clock / (g_Dacrate + 1));
if (Frequency < 4000)
{
@ -101,28 +103,16 @@ EXPORT void CALL AiDacrateChanged(int SystemType)
}
else
{
int32_t BufferSize = 0; double audio_clock = 0; double framerate = 0;
if (g_settings->FPSBuffer() == true)
if (g_settings->FPSBuffer() == false && SystemType != SYSTEM_PAL)
{
framerate = 59.94004;
if (SystemType == SYSTEM_PAL) { framerate = 50; }
framerate = 30.475; // Needed for Body Harvest (U)
}
else
if (g_settings->TinyBuffer() == false)
{
framerate = 64;
if (SystemType == SYSTEM_PAL) { framerate = 53.33333; }
framerate = (framerate / 2);
}
if (g_settings->TinyBuffer() == true)
{
audio_clock = ((video_clock / framerate) * 2);
}
else
{
audio_clock = ((video_clock / framerate) * 4);
}
BufferSize = (int32_t)audio_clock / (g_Dacrate) + 1 & ~0x1;
audio_clock = (video_clock / framerate);
BufferSize = (int32_t)(audio_clock / (g_Dacrate + 1)) + 1 & ~0x1;
g_SoundDriver->AI_SetFrequency(Frequency, BufferSize);
}
}