Open irixxxx opened 8 months ago
nice, I also noticed something similar, do you know the solution?
If I had one I would've made a PR ;-)
Most of it should be easy to fix, but it potentially breaks stuff relying on those bugs. I guess it's up to the maintainer (if there is one at all).
As for the bugs:
The upsamplers used to upsample to 48 KHz are also flawed:
That upsampling stuff really bothers me. I don't think using lookup tables is a good solution to handle this.
I had a similar problem with resampling the 44.1 KHz CD audio tracks to the target sample rate. I'd suggest whoever is going to address this might want to look up my solution in the function mix_16h_to_32_resample_stereo in pico/sound/mix.c. It's also relatively independent of the source and target sample rates, so the restriction to certain rates might potentially also be lifted.
While working on PicoDrive I found the audsrv implementation a bit lacking:
If the audsrv backend on IOP runs low on samples it will replay the buffer over and over, right down to telling you about the buffer being miraculously filled again. New samples then don't have space in it, and the reverberating audio you get remembers me of old GSM mobiles in bad reception conditions. It simply can't discern "ringbuffer full" from "ringbuffer empty"... so it wraps around and around.
it sets the ringbuffer to half full on set_format without clearing it. Hence, there's always some old audio from the buffer played out first.
stopping will keep all unplayed samples and there is no way to clear the audio ringbuffer.