summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2017-09-08 16:45:34 -0400
committerJMC47 <JMC4789@gmail.com>2017-10-23 13:16:40 -0400
commita8bf9c5cbedc6922d0e621cff458d23dfb38dfeb (patch)
treebf28c3b1bf81dd717f9a05b5dbf77838f3085372 /Source/Core
parent6e9e681438887840d08928296bb08c0d226d1046 (diff)
Fix GameCube Sample Rate
The GameCube's sample rate is slightly different due to a hardware bug. The exact numbers are (54000000 / 1124) for GameCube and (54000000 / 1125) on Wii. I also modified 32KHz mode. This fixes audio desyncs in several GameCube games and severe issues in Sonic Mega Collection.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HW/AudioInterface.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/Core/Core/HW/AudioInterface.cpp b/Source/Core/Core/HW/AudioInterface.cpp
index f2e99eb9b9..898101d095 100644
--- a/Source/Core/Core/HW/AudioInterface.cpp
+++ b/Source/Core/Core/HW/AudioInterface.cpp
@@ -182,7 +182,10 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
// AISFR rates below are intentionally inverted wrt yagcd
DEBUG_LOG(AUDIO_INTERFACE, "Change AISFR to %s", tmpAICtrl.AISFR ? "48khz" : "32khz");
m_Control.AISFR = tmpAICtrl.AISFR;
- g_AISSampleRate = tmpAICtrl.AISFR ? 48000 : 32000;
+ if (SConfig::GetInstance().bWii)
+ g_AISSampleRate = tmpAICtrl.AISFR ? 48000 : 32000;
+ else
+ g_AISSampleRate = tmpAICtrl.AISFR ? 48043 : 32029;
g_sound_stream->GetMixer()->SetStreamInputSampleRate(g_AISSampleRate);
g_CPUCyclesPerSample = SystemTimers::GetTicksPerSecond() / g_AISSampleRate;
}
@@ -191,7 +194,10 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
{
DEBUG_LOG(AUDIO_INTERFACE, "Change AIDFR to %s", tmpAICtrl.AIDFR ? "32khz" : "48khz");
m_Control.AIDFR = tmpAICtrl.AIDFR;
- g_AIDSampleRate = tmpAICtrl.AIDFR ? 32000 : 48000;
+ if (SConfig::GetInstance().bWii)
+ g_AIDSampleRate = tmpAICtrl.AIDFR ? 32000 : 48000;
+ else
+ g_AIDSampleRate = tmpAICtrl.AIDFR ? 32029 : 48043;
g_sound_stream->GetMixer()->SetDMAInputSampleRate(g_AIDSampleRate);
}