From: kub Date: Fri, 22 Oct 2021 23:09:04 +0000 (+0200) Subject: sound, remove hysteresis (lessens distortion, increases frequency limit) X-Git-Tag: v2.00~453 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=027940e108276282f0f32f66c6477f6e43536a43;p=picodrive.git sound, remove hysteresis (lessens distortion, increases frequency limit) --- diff --git a/pico/sms.c b/pico/sms.c index 2aa8838c..4e20a9b7 100644 --- a/pico/sms.c +++ b/pico/sms.c @@ -225,7 +225,7 @@ static void z80_sms_out(unsigned short a, unsigned char d) case 0x40: case 0x41: - PsndDoPSG(z80_cyclesDone()); + PsndDoPSG(Pico.m.scanline*228 + 228-z80_cyclesLeft); SN76496Write(d); break; diff --git a/pico/sound/sound.c b/pico/sound/sound.c index 602f2907..56bbadc9 100644 --- a/pico/sound/sound.c +++ b/pico/sound/sound.c @@ -130,10 +130,6 @@ PICO_INTERNAL void PsndDoDAC(int cyc_to) // number of samples to fill in buffer (Q20) len = (cyc_to * Pico.snd.clkl_mult) - Pico.snd.dac_pos; - // don't do this too often (about once every 2 scanlines) - if (len <= PicoIn.sndRate << 3) // Q16, (PicoIn.sndRate << 16) >> 13 - return; - // update position and calculate buffer offset and length pos = (Pico.snd.dac_pos+0x80000) >> 20; Pico.snd.dac_pos += len; @@ -173,10 +169,6 @@ PICO_INTERNAL void PsndDoPSG(int cyc_to) // number of samples to fill in buffer (Q20) len = (cyc_to * Pico.snd.clkl_mult) - Pico.snd.psg_pos; - // don't do this too often (about once every 2 scanlines) - if (len <= PicoIn.sndRate << 3) // Q16, (PicoIn.sndRate << 16) >> 13 - return; - // update position and calculate buffer offset and length pos = (Pico.snd.psg_pos+0x80000) >> 20; Pico.snd.psg_pos += len; @@ -204,10 +196,6 @@ PICO_INTERNAL void PsndDoYM2413(int cyc_to) // number of samples to fill in buffer (Q20) len = (cyc_to * Pico.snd.clkl_mult) - Pico.snd.ym2413_pos; - // don't do this too often (about once every 2 scanlines) - if (len <= PicoIn.sndRate << 3) // Q16, (PicoIn.sndRate << 16) >> 13 - return; - // update position and calculate buffer offset and length pos = (Pico.snd.ym2413_pos+0x80000) >> 20; Pico.snd.ym2413_pos += len; @@ -245,13 +233,9 @@ PICO_INTERNAL void PsndDoFM(int cyc_to) int pos, len; int stereo = 0; - // Q16, number of samples since last call + // Q20, number of samples since last call len = (cyc_to * Pico.snd.clkl_mult) - Pico.snd.fm_pos; - // don't do this too often (about once every 2 scanlines) - if (len <= PicoIn.sndRate << 3) // Q16, (PicoIn.sndRate << 16) >> 13 - return; - // update position and calculate buffer offset and length pos = (Pico.snd.fm_pos+0x80000) >> 20; Pico.snd.fm_pos += len; @@ -351,7 +335,7 @@ static int PsndRender(int offset, int length) return length; } - // Fill up DAC output in case of missing samples (Q16 rounding errors) + // Fill up DAC output in case of missing samples (Q rounding errors) if (length-daclen > 0) { short *dacbuf = PicoIn.sndOut + (daclen << stereo); Pico.snd.dac_pos += (length-daclen) << 20;