audio, fix sound issues in some intros

This commit is contained in:
kub 2020-07-16 19:05:46 +02:00
parent 713e3a1c5b
commit 6f7beab435
2 changed files with 7 additions and 3 deletions

View file

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

View file

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