changeset 776:bb7b3ded919a

Indeed, libsidplay-fp's audio renderer expects buffer of 16-bit shorts and number of samples as input, AND returns number of samples. Thus, we need to divide and multiply the values accordingly. However, it also seems that some internal buffers in resid-fp are hardcoded to certain size, and using too big audio buffers cause overflows .. trying to compensate for that by limiting the amount of audio rendered. Unfortunately there are still memory corruptions.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 06 Nov 2012 11:59:24 +0200
parents 0e9f2894b0a9
children 15f0c8e11338
files src/xs_sidplay2.cc
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/xs_sidplay2.cc	Tue Nov 06 11:56:55 2012 +0200
+++ b/src/xs_sidplay2.cc	Tue Nov 06 11:59:24 2012 +0200
@@ -480,7 +480,9 @@
     if (!engine)
         return 0;
 
-    return engine->emu.play((short *) audioBuffer, (audioBufSize / sizeof(short)));
+    int len = audioBufSize / sizeof(short);
+    if (len > 512) len = 512;
+    return engine->emu.play((short *) audioBuffer, len) * sizeof(short);
 }