aboutsummaryrefslogtreecommitdiff
path: root/libretro.c
diff options
context:
space:
mode:
authoraliaspider2014-11-03 11:38:35 +0100
committeraliaspider2014-11-03 11:38:35 +0100
commit67e4e10f8b9422b3eceb1d561ca9ff3530f00a9e (patch)
tree357f536bf431a60f2ea4a062fa329e0fd24d7be4 /libretro.c
parent7077e9821593b2c9b78830c4cc5055c6a79cdd69 (diff)
downloadsnes9x2005-67e4e10f8b9422b3eceb1d561ca9ff3530f00a9e.tar.gz
snes9x2005-67e4e10f8b9422b3eceb1d561ca9ff3530f00a9e.tar.bz2
snes9x2005-67e4e10f8b9422b3eceb1d561ca9ff3530f00a9e.zip
blargg's apu implementation can now be used.
Diffstat (limited to 'libretro.c')
-rw-r--r--libretro.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/libretro.c b/libretro.c
index 4302019..081413c 100644
--- a/libretro.c
+++ b/libretro.c
@@ -273,8 +273,11 @@ void init_sfc_setting(void)
Settings.Transparency = TRUE;
Settings.SupportHiRes = TRUE;
Settings.ThreadSound = FALSE;
- Settings.SoundSync = TRUE;
+#ifdef USE_BLARGG_APU
+ Settings.SoundSync = FALSE;
+#else
Settings.ApplyCheats = TRUE;
+#endif
Settings.StretchScreenshots = 1;
Settings.HBlankStart = (256 * Settings.H_Max) / SNES_HCOUNTER_MAX;
@@ -286,6 +289,20 @@ void S9xAutoSaveSRAM()
SaveSRAM(S9xGetFilename("srm"));
}
+#ifdef USE_BLARGG_APU
+static void S9xAudioCallback()
+{
+ size_t avail;
+ /* Just pick a big buffer. We won't use it all. */
+ static int16_t audio_buf[0x10000];
+
+ S9xFinalizeSamples();
+ avail = S9xGetSampleCount();
+ S9xMixSamples(audio_buf, avail);
+ audio_batch_cb(audio_buf, avail >> 1);
+}
+#endif
+
void retro_init(void)
{
struct retro_log_callback log;
@@ -308,6 +325,7 @@ void retro_init(void)
S9xInitGFX();
#ifdef USE_BLARGG_APU
S9xInitSound(16, 0);
+ S9xSetSamplesAvailableCallback(S9xAudioCallback);
#else
S9xInitSound(Settings.SoundPlaybackRate,
TRUE,
@@ -386,6 +404,7 @@ void retro_run(void)
S9xMainLoop();
RETRO_PERFORMANCE_STOP(S9xMainLoop_func);
+#ifndef USE_BLARGG_APU
static int16_t audio_buf[2048];
samples_to_play += samples_per_frame;
@@ -396,6 +415,7 @@ void retro_run(void)
audio_batch_cb(audio_buf, (int)samples_to_play);
samples_to_play -= (int)samples_to_play;
}
+#endif
#ifdef NO_VIDEO_OUTPUT
return;