From 8a41736496d4109b2c832ac8b176c5e1ebe9c457 Mon Sep 17 00:00:00 2001 From: Toad King Date: Thu, 14 Jun 2012 23:28:56 -0400 Subject: use the slower, more accurate SPC700 modes hack around sounds being higher pitched than they should be --- libretro/libretro.cpp | 14 +++++++------- src/soundux.cpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index 42601fa..4af81a1 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -167,8 +167,8 @@ void retro_get_system_info(struct retro_system_info *info) } static int16 audio_buf[0x10000]; -static int avail; -static int samplerate = 32000; +static unsigned avail; +static float samplerate = 32040.5f; void S9xGenerateSound() { @@ -368,8 +368,8 @@ void retro_run (void) { IPPU.RenderThisFrame = TRUE; S9xMainLoop(); - S9xMixSamples(audio_buf, avail * 2); - audio_batch_cb((int16_t *) audio_buf, avail); + S9xMixSamples(audio_buf, avail); + audio_batch_cb((int16_t *) audio_buf, avail >> 1); poll_cb(); @@ -427,15 +427,15 @@ bool retro_load_game(const struct retro_game_info *game) //S9xGraphicsInit(); S9xReset(); - Settings.asmspc700 = true; - CPU.APU_APUExecuting = Settings.APUEnabled = 3; + Settings.asmspc700 = false; + CPU.APU_APUExecuting = Settings.APUEnabled = 1; Settings.SixteenBitSound = true; so.stereo = Settings.Stereo; so.playback_rate = Settings.SoundPlaybackRate; S9xSetPlaybackRate(so.playback_rate); S9xSetSoundMute(FALSE); - avail = samplerate / (Settings.PAL ? 50 : 60); + avail = (samplerate / (Settings.PAL ? 50 : 60)) << 1; ZeroMemory(audio_buf, sizeof(audio_buf)); diff --git a/src/soundux.cpp b/src/soundux.cpp index 5b46f07..3af6be4 100644 --- a/src/soundux.cpp +++ b/src/soundux.cpp @@ -1145,7 +1145,7 @@ void S9xSetPlaybackRate (uint32 playback_rate) if(playback_rate) { // notaz: calclulate a value (let's call it freqbase) to simplify channel freq calculations later. - so.freqbase = (FIXED_POINT<<11) / playback_rate; + so.freqbase = (FIXED_POINT<<11) / (playback_rate * 33 / 32); // now precalculate env rates for S9xSetEnvRate static int steps [] = { -- cgit v1.2.3