port to 64bit. Some gcc 4.4 warning fixes
[picodrive.git] / pico / sound / sound.c
index a7510db..dfa1d65 100644 (file)
@@ -107,14 +107,9 @@ static void dac_recalculate(void)
 \r
 PICO_INTERNAL void PsndReset(void)\r
 {\r
-  void *ym2612_regs;\r
-\r
-  // also clear the internal registers+addr line\r
-  ym2612_regs = YM2612GetRegs();\r
-  memset(ym2612_regs, 0, 0x200+4);\r
-  timers_reset();\r
-\r
+  // PsndRerate calls YM2612Init, which also resets\r
   PsndRerate(0);\r
+  timers_reset();\r
 }\r
 \r
 \r
@@ -252,7 +247,7 @@ PICO_INTERNAL void cdda_start_play(void)
   lba_offset += Pico_mcd->TOC.Tracks[index].Offset;\r
 \r
   // find the actual file for this track\r
-  for (i = index; i >= 0; i--)\r
+  for (i = index; i > 0; i--)\r
     if (Pico_mcd->TOC.Tracks[i].F != NULL) break;\r
 \r
   if (Pico_mcd->TOC.Tracks[i].F == NULL) {\r
@@ -296,7 +291,7 @@ PICO_INTERNAL void PsndClear(void)
     memset32((int *) PsndOut, 0, len); // assume PsndOut to be aligned\r
   else {\r
     short *out = PsndOut;\r
-    if ((int)out & 2) { *out++ = 0; len--; }\r
+    if ((long)out & 2) { *out++ = 0; len--; }\r
     memset32((int *) out, 0, len/2);\r
     if (len & 1) out[len-1] = 0;\r
   }\r
@@ -361,6 +356,9 @@ static int PsndRender(int offset, int length)
       cdda_raw_update(buf32, length);\r
   }\r
 \r
+  if ((PicoAHW & PAHW_32X) && (PicoOpt & POPT_EN_PWM))\r
+    p32x_pwm_update(buf32, length, stereo);\r
+\r
   // convert + limit to normal 16bit output\r
   PsndMix_32_to_16l(PsndOut+offset, buf32, length);\r
 \r
@@ -416,8 +414,8 @@ PICO_INTERNAL void PsndGetSamplesMS(void)
 \r
   // upmix to "stereo" if needed\r
   if (stereo) {\r
-    int i = length, *p = (void *)PsndOut;\r
-    while (i--)\r
+    int i, *p;\r
+    for (i = length, p = (void *)PsndOut; i > 0; i--, p++)\r
       *p |= *p << 16;\r
   }\r
 \r