int PicoRegionOverride = 0; // override the region detection 0: Auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe\r
int PicoAutoRgnOrder = 0;\r
int emustatus = 0;\r
-void (*PicoWriteSound)(void) = 0; // called once per frame at the best time to send sound buffer (PsndOut) to hardware\r
+void (*PicoWriteSound)(int len) = 0; // called once per frame at the best time to send sound buffer (PsndOut) to hardware\r
\r
struct PicoSRAM SRam;\r
int z80startCycle = 0, z80stopCycle = 0; // in 68k cycles\r
// to be called on 224 or line_sample scanlines only\r
static __inline void getSamples(int y)\r
{\r
+ static int curr_pos = 0;\r
+\r
if(y == 224) {\r
//dprintf("sta%i: %i [%i]", (emustatus & 2), emustatus, y);\r
if(emustatus & 2)\r
- sound_render(PsndLen/2, PsndLen-PsndLen/2);\r
- else sound_render(0, PsndLen);\r
+ curr_pos += sound_render(curr_pos, PsndLen-PsndLen/2);\r
+ else curr_pos = sound_render(0, PsndLen);\r
if (emustatus&1) emustatus|=2; else emustatus&=~2;\r
- if (PicoWriteSound) PicoWriteSound();\r
+ if (PicoWriteSound) PicoWriteSound(curr_pos);\r
// clear sound buffer\r
sound_clear();\r
- //memset(PsndOut, 0, (PicoOpt & 8) ? (PsndLen<<2) : (PsndLen<<1));\r
}\r
else if(emustatus & 3) {\r
emustatus|= 2;\r
emustatus&=~1;\r
- sound_render(0, PsndLen/2);\r
+ curr_pos = sound_render(0, PsndLen/2);\r
}\r
}\r
\r
\r
// here we render sound if ym2612 is disabled\r
if(!(PicoOpt&1) && PsndOut) {\r
- sound_render(0, PsndLen);\r
- if(PicoWriteSound) PicoWriteSound();\r
+ int len = sound_render(0, PsndLen);\r
+ if(PicoWriteSound) PicoWriteSound(len);\r
// clear sound buffer\r
- memset(PsndOut, 0, (PicoOpt & 8) ? (PsndLen<<2) : (PsndLen<<1));\r
+ sound_clear();\r
}\r
\r
// render screen\r