From acaac510770458ecd92664c00c6c47170c2f6c22 Mon Sep 17 00:00:00 2001 From: Rachel Bryk Date: Thu, 24 Jul 2014 08:16:17 -0400 Subject: [PATCH] Remove audio frame limit. It serves no purpose and causes bugs and confusion for users. --- Source/Core/AudioCommon/AudioCommon.cpp | 1 - Source/Core/AudioCommon/Mixer.cpp | 17 +---------------- Source/Core/AudioCommon/Mixer.h | 6 ------ Source/Core/Core/Core.cpp | 2 +- Source/Core/Core/HW/SystemTimers.cpp | 4 ++-- Source/Core/DolphinWX/ConfigMain.cpp | 4 +--- Source/Core/DolphinWX/NetWindow.cpp | 1 - 7 files changed, 5 insertions(+), 30 deletions(-) diff --git a/Source/Core/AudioCommon/AudioCommon.cpp b/Source/Core/AudioCommon/AudioCommon.cpp index 5cc57800b5..3550b3cb16 100644 --- a/Source/Core/AudioCommon/AudioCommon.cpp +++ b/Source/Core/AudioCommon/AudioCommon.cpp @@ -152,7 +152,6 @@ namespace AudioCommon { if (soundStream) { - soundStream->GetMixer()->SetThrottle(SConfig::GetInstance().m_Framelimit == 2); soundStream->SetVolume(SConfig::GetInstance().m_Volume); } } diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp index ce13f50689..bcb64cff64 100644 --- a/Source/Core/AudioCommon/Mixer.cpp +++ b/Source/Core/AudioCommon/Mixer.cpp @@ -46,7 +46,7 @@ unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples, boo u32 framelimit = SConfig::GetInstance().m_Framelimit; float aid_sample_rate = m_input_sample_rate + offset; - if (consider_framelimit && framelimit > 2) + if (consider_framelimit && framelimit > 1) { aid_sample_rate = aid_sample_rate * (framelimit - 1) * 5 / VideoInterface::TargetRefreshRate; } @@ -132,21 +132,6 @@ void CMixer::MixerFifo::PushSamples(const short *samples, unsigned int num_sampl // needs to get updates to not deadlock. u32 indexW = Common::AtomicLoad(m_indexW); - if (m_mixer->m_throttle) - { - // The auto throttle function. This loop will put a ceiling on the CPU MHz. - while (num_samples * 2 + ((indexW - Common::AtomicLoad(m_indexR)) & INDEX_MASK) >= MAX_SAMPLES * 2) - { - if (*PowerPC::GetStatePtr() != PowerPC::CPU_RUNNING || soundStream->IsMuted()) - break; - // Shortcut key for Throttle Skipping - if (Core::GetIsFramelimiterTempDisabled()) - break; - SLEEP(1); - soundStream->Update(); - } - } - // Check if we have enough free space // indexW == m_indexR results in empty buffer, so indexR must always be smaller than indexW if (num_samples * 2 + ((indexW - Common::AtomicLoad(m_indexR)) & INDEX_MASK) >= MAX_SAMPLES * 2) diff --git a/Source/Core/AudioCommon/Mixer.h b/Source/Core/AudioCommon/Mixer.h index 474ec128bb..bbb28cedf5 100644 --- a/Source/Core/AudioCommon/Mixer.h +++ b/Source/Core/AudioCommon/Mixer.h @@ -26,7 +26,6 @@ public: , m_streaming_mixer(this, 48000) , m_sampleRate(BackendSampleRate) , m_logAudio(0) - , m_throttle(false) , m_speed(0) { INFO_LOG(AUDIO_INTERFACE, "Mixer is initialized"); @@ -43,9 +42,6 @@ public: unsigned int GetSampleRate() const { return m_sampleRate; } void SetStreamingVolume(unsigned int lvolume, unsigned int rvolume); - void SetThrottle(bool use) { m_throttle = use;} - - virtual void StartLogAudio(const std::string& filename) { if (! m_logAudio) @@ -118,8 +114,6 @@ protected: bool m_logAudio; - bool m_throttle; - std::mutex m_csMixing; volatile float m_speed; // Current rate of the emulation (1.0 = 100% speed) diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index b7b10350dd..b6518df920 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -631,7 +631,7 @@ void VideoThrottle() bool ShouldSkipFrame(int skipped) { const u32 TargetFPS = (SConfig::GetInstance().m_Framelimit > 1) - ? SConfig::GetInstance().m_Framelimit * 5 + ? (SConfig::GetInstance().m_Framelimit - 1) * 5 : VideoInterface::TargetRefreshRate; const u32 frames = Common::AtomicLoad(DrawnFrame); const bool fps_slow = !(Timer.GetTimeDifference() < (frames + skipped) * 1000 / TargetFPS); diff --git a/Source/Core/Core/HW/SystemTimers.cpp b/Source/Core/Core/HW/SystemTimers.cpp index 9832b92537..552ee0fd20 100644 --- a/Source/Core/Core/HW/SystemTimers.cpp +++ b/Source/Core/Core/HW/SystemTimers.cpp @@ -233,9 +233,9 @@ static void ThrottleCallback(u64 last_time, int cyclesLate) int diff = (u32)last_time - time; const SConfig& config = SConfig::GetInstance(); - bool frame_limiter = config.m_Framelimit && config.m_Framelimit != 2 && !Core::GetIsFramelimiterTempDisabled(); + bool frame_limiter = config.m_Framelimit && !Core::GetIsFramelimiterTempDisabled(); u32 next_event = GetTicksPerSecond()/1000; - if (SConfig::GetInstance().m_Framelimit > 2) + if (SConfig::GetInstance().m_Framelimit > 1) { next_event = next_event * (SConfig::GetInstance().m_Framelimit - 1) * 5 / VideoInterface::TargetRefreshRate; } diff --git a/Source/Core/DolphinWX/ConfigMain.cpp b/Source/Core/DolphinWX/ConfigMain.cpp index 3a061f5e6c..99ac9f6892 100644 --- a/Source/Core/DolphinWX/ConfigMain.cpp +++ b/Source/Core/DolphinWX/ConfigMain.cpp @@ -264,8 +264,7 @@ void CConfigMain::InitializeGUILists() // Framelimit arrayStringFor_Framelimit.Add(_("Off")); arrayStringFor_Framelimit.Add(_("Auto")); - arrayStringFor_Framelimit.Add(_("Audio")); - for (int i = 10; i <= 120; i += 5) // from 10 to 120 + for (int i = 5; i <= 120; i += 5) // from 5 to 120 arrayStringFor_Framelimit.Add(wxString::Format("%i", i)); // Emulator Engine @@ -898,7 +897,6 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event) break; case ID_FRAMELIMIT: SConfig::GetInstance().m_Framelimit = Framelimit->GetSelection(); - AudioCommon::UpdateSoundStream(); break; // Core - Advanced case ID_CPUENGINE: diff --git a/Source/Core/DolphinWX/NetWindow.cpp b/Source/Core/DolphinWX/NetWindow.cpp index a3d685b1f8..932a74ed70 100644 --- a/Source/Core/DolphinWX/NetWindow.cpp +++ b/Source/Core/DolphinWX/NetWindow.cpp @@ -134,7 +134,6 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl* " - Enable Dual Core [OFF]\n" " - DSP Emulator Engine Must be the same on all computers!\n" " - DSP on Dedicated Thread [OFF]\n" - " - Framelimit NOT set to [Audio]\n" " - Manually set the extensions for each wiimote\n" "\n" "All players should use the same Dolphin version and settings.\n"