# HG changeset patch # User Matti Hamalainen # Date 1352195964 -7200 # Node ID bb7b3ded919a182ad14a2aa60fece7f44901b604 # Parent 0e9f2894b0a96154c6b3cfb3cedd23643ebf923d 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. diff -r 0e9f2894b0a9 -r bb7b3ded919a src/xs_sidplay2.cc --- 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); }