aboutsummaryrefslogtreecommitdiff
path: root/libretro.c
diff options
context:
space:
mode:
authorTwinaphex2017-01-25 00:22:07 +0100
committerGitHub2017-01-25 00:22:07 +0100
commit69f17114a277884d1b76f3be458f882b67e39265 (patch)
tree9ba12ae3cd84b35972e5eceedbd1aeba68d42354 /libretro.c
parent2747667a75d0512aaedfb166b7b92e9f99e14965 (diff)
parentd8b66ac6d0524b3538ad595825651b28329f9033 (diff)
downloadsnes9x2005-69f17114a277884d1b76f3be458f882b67e39265.tar.gz
snes9x2005-69f17114a277884d1b76f3be458f882b67e39265.tar.bz2
snes9x2005-69f17114a277884d1b76f3be458f882b67e39265.zip
Merge pull request #27 from jamsilva/master
Improved sound
Diffstat (limited to 'libretro.c')
-rw-r--r--libretro.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/libretro.c b/libretro.c
index e7b2e7a..3ccd6b8 100644
--- a/libretro.c
+++ b/libretro.c
@@ -44,6 +44,7 @@ char slash = '/';
#endif
static float samples_per_frame = 0.0;
+static float samplerate = (((SNES_CLOCK_SPEED * 6) / (32 * ONE_APU_CYCLE)));
#ifdef PERF_TEST
#define RETRO_PERFORMANCE_INIT(name) \
@@ -264,13 +265,12 @@ void init_sfc_setting(void)
{
memset(&Settings, 0, sizeof(Settings));
Settings.JoystickEnabled = false;
- Settings.SoundPlaybackRate = 32000; // -> ds2sound.h for defs
- Settings.SoundBufferSize = 512;
+ Settings.SoundPlaybackRate = samplerate;
Settings.CyclesPercentage = 100;
Settings.DisableSoundEcho = false;
Settings.InterpolatedSound = true;
- Settings.APUEnabled = Settings.NextAPUEnabled = true;
+ Settings.APUEnabled = true;
Settings.H_Max = SNES_CYCLES_PER_SCANLINE;
Settings.SkipFrames = AUTO_FRAMERATE;
@@ -285,7 +285,6 @@ void init_sfc_setting(void)
Settings.Transparency = true;
Settings.SupportHiRes = true;
- Settings.ThreadSound = false;
#ifdef USE_BLARGG_APU
Settings.SoundSync = false;
#endif
@@ -597,13 +596,7 @@ void retro_get_system_av_info(struct retro_system_av_info* info)
info->timing.fps = (SNES_CLOCK_SPEED * 6.0 / (SNES_CYCLES_PER_SCANLINE *
SNES_MAX_PAL_VCOUNTER));
- info->timing.sample_rate = (((SNES_CLOCK_SPEED * 6) / (32 * ONE_APU_CYCLE)));
-
- // small hack to improve av sync
- // since S9xSetPlaybackRate only accepts integral numbers.
-
- info->timing.fps = info->timing.fps * 32000 / info->timing.sample_rate;
- info->timing.sample_rate = 32000;
+ info->timing.sample_rate = samplerate;
}
void retro_reset(void)
@@ -897,7 +890,7 @@ bool retro_load_game(const struct retro_game_info* game)
Settings.SoundPlaybackRate = av_info.timing.sample_rate;
#else
samples_per_frame = av_info.timing.sample_rate / av_info.timing.fps;
- S9xSetPlaybackRate(32*1024);
+ S9xSetPlaybackRate(Settings.SoundPlaybackRate);
#endif
return true;
}