Re: miniSphere 4.8.1
Reply #1871 –
I fixed the SoundStream bug. It turns out I was calculating the buffer size incorrectly for stereo streams and only half-filling the fragment buffers. The calculation was only correct for a single channel, which is why I could play stereo files on a mono stream if I doubled the sample rate - most of the time the two channels are very similar so it's just like you're doubling up on samples.
Some technical details on the bug: Allegro al_create_audio_stream() takes a "number of samples" parameter which specifies the size of the buffer:
if (!(stream->ptr = al_create_audio_stream(8, 1024, frequency, depth_flag, conf)))
goto on_error;
8 is the number of buffers, 1024 is the number of samples you can put into each buffer. I misunderstood 1024 to be the overall number of samples, but it's actually the number of samples per channel. So for mono streams I was fine, but for stereo (or more), the buffer was only getting partially filled and the rest was silence, hence the choppiness and half-speed-ness.
Now if I only I had found the bug before I already released 4.8.1... oh well.