소스 검색

audio, fix sound issues in some intros

kub 3 년 전
부모
커밋
6f7beab435
2개의 변경된 파일7개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 1
      pico/memory.c
  2. 2 2
      pico/sound/sound.c

+ 5 - 1
pico/memory.c

@@ -946,9 +946,9 @@ static int ym2612_write_local(u32 a, u32 d, int is_from_z80)
   {
     int cycles = is_from_z80 ? z80_cyclesDone() : z80_cycles_from_68k();
     //elprintf(EL_STATUS, "%03i dac w %08x z80 %i", cycles, d, is_from_z80);
-    ym2612.dacout = ((int)d - 0x80) << 6;
     if (ym2612.dacen)
       PsndDoDAC(cycles);
+    ym2612.dacout = ((int)d - 0x80) << 6;
     return 0;
   }
 
@@ -1008,6 +1008,9 @@ static int ym2612_write_local(u32 a, u32 d, int is_from_z80)
         case 0x27: { /* mode, timer control */
           int old_mode = ym2612.OPN.ST.mode;
           int cycles = is_from_z80 ? z80_cyclesDone() : z80_cycles_from_68k();
+
+          if (ym2612.OPN.ST.mode != d)
+            PsndDoFM(cycles);
           ym2612.OPN.ST.mode = d;
 
           elprintf(EL_YMTIMER, "st mode %02x", d);
@@ -1066,6 +1069,7 @@ static int ym2612_write_local(u32 a, u32 d, int is_from_z80)
 
 
 #define ym2612_read_local() \
+  PsndDoFM(xcycles>>8); \
   if (xcycles >= Pico.t.timer_a_next_oflow) \
     ym2612.OPN.ST.status |= (ym2612.OPN.ST.mode >> 2) & 1; \
   if (xcycles >= Pico.t.timer_b_next_oflow) \

+ 2 - 2
pico/sound/sound.c

@@ -169,8 +169,8 @@ PICO_INTERNAL void PsndDoFM(int cyc_to)
   // Q16, number of samples since last call
   len = (cyc_to * Pico.snd.clkl_mult) - Pico.snd.fm_pos;
 
-  // don't do this too often (about every 4th scanline)
-  if (len >> 20 <= PicoIn.sndRate >> 12)
+  // don't do this too often (about once every canline)
+  if (len >> 16 <= PicoIn.sndRate >> 10)
     return;
 
   // update position and calculate buffer offset and length