Audio Speed Hack (fill pcm buffer)

Dead or alive will be better to using this hack, but some other games will be too fast.
So, it's optional.
This commit is contained in:
kaienfr 2014-04-12 17:16:31 +02:00
parent 976c9bbfdc
commit d5c1d58506
3 changed files with 13 additions and 1 deletions

View File

@ -148,6 +148,9 @@ public:
int iSFXVolume;
int iBGMVolume;
// Audio Hack
bool bSoundSpeedHack;
// UI
bool bShowDebuggerOnLoad;
int iShowFPSCounter;

View File

@ -15,6 +15,7 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "Core/Config.h"
#include "Core/HLE/FunctionWrappers.h"
#include "Core/HW/SimpleAudioDec.h"
#include "Core/HW/MediaEngine.h"
@ -309,7 +310,7 @@ u32 AuCtx::AuDecode(u32 pcmAddr)
inbuff += writePos;
// decode frames in AuBuf and output into PCMBuf if it is not exceed
if (AuBufAvailable > 0 && outpcmbufsize < PCMBufSize){
while (AuBufAvailable > 0 && outpcmbufsize < PCMBufSize){
int pcmframesize;
// decode
decoder->Decode(inbuff, AuBufAvailable, outbuf, &pcmframesize);
@ -320,6 +321,7 @@ u32 AuCtx::AuDecode(u32 pcmAddr)
readPos -= AuBufAvailable;
}
AuBufAvailable = 0;
break;
}
// count total output pcm size
outpcmbufsize += pcmframesize;
@ -334,6 +336,10 @@ u32 AuCtx::AuDecode(u32 pcmAddr)
writePos += srcPos;
// move outbuff position to the current end of output
outbuf += pcmframesize;
// audio hack, default we will not do while and break here
if (!g_Config.bSoundSpeedHack){
break;
}
}
Memory::Write_U32(PCMBuf, pcmAddr);

View File

@ -248,6 +248,9 @@ void GameSettingsScreen::CreateViews() {
CheckBox *lowAudio = audioSettings->Add(new CheckBox(&g_Config.bLowLatencyAudio, a->T("Low latency audio")));
lowAudio->SetEnabledPtr(&g_Config.bEnableSound);
audioSettings->Add(new ItemHeader(ms->T("Audio hacks")));
audioSettings->Add(new CheckBox(&g_Config.bSoundSpeedHack, a->T("Sound speed hack (fill pcm buffer)")));
// Control
ViewGroup *controlsSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
LinearLayout *controlsSettings = new LinearLayout(ORIENT_VERTICAL);