Merge pull request #8 from libretro/recompileorg-sound-patch-1

Fixes crackling sound in some games
This commit is contained in:
recompileorg 2018-02-11 22:41:42 -05:00 committed by GitHub
commit fcf5b381fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -257,12 +257,14 @@ void retro_run(void)
for(i=0; i<audioSamples; i++)
{
Audio(PSGBuffer[(int)audioBufferPos], PSGBuffer[(int)audioBufferPos]); // Audio(left, right)
Audio(PSGBuffer[(int)(audioBufferPos)], PSGBuffer[(int)(audioBufferPos)]); // Audio(left, right)
audioBufferPos += audioInc;
audioBufferPos = audioBufferPos * (audioBufferPos<(PSGBufferSize-1));
}
audioBufferPos = 0.0;
PSGFrame();
}
// Swap Left/Right Controller

View File

@ -127,6 +127,11 @@ void PSGInit()
readRegisters();
}
void PSGFrame()
{
PSGBufferPos = 0;
}
void PSGNotify(int adr, int val) // PSG Registers Modified 0x01F0-0x1FD (called from writeMem)
{
readRegisters();

View File

@ -24,6 +24,7 @@ int PSGBufferPos; // points to next location in output buffer
int PSGBufferSize;
void PSGInit();
void PSGFrame(); // Notify New Frame
void PSGTick(int ticks); // ticks PSG some number of cpu cycles
void PSGNotify(int adr, int val); // updates PSG on register change