Well, dammit. Worst case on good-spec PC, not cool. If anyone going to try my demo, can you please tell, if it is any different for you?
The second issue are the clicks you can hear when changing gain or panning on certain sounds. I assume, it’s a same problem, but even worse.
I tried smoothing the changes out. But first, to smooth out 10 fps problem you have to change parameters very slowly, so much it makes 3d panning useless. Second, on very low volumes changes have to be even slower. First few steps from 0 to something is always very distinct. Third, it does not fix the clicking.
I will be thankful for any advice. Is there any way to fix or work around this problems? Is there a way to force SDL chunk size? Or maybe change parameters gradually inside the chunk? What is your experience with audio system in Urho and what do you think of it?
Well, until you are just playing sound without any processing, I believe it’s OK. You’ll have problems if you’ll do some on-the-fly complex processing like FFT or convolution because 20 samples cannot contain enough information about whole signal.
UPD: it’s not 20 samples but 20 ms, which means it’s 882 samples, that’s for sure enough for effects of any kind.
That’s absolutely right, and you can’t fix these clicks by just changing buffer size. I don’t know the right way to fix it, but you need to make amplitude and panning change not immediately but smoothly. Maybe you’ll need to rewrite SoundSource3D, I’m not sure.
Tried to go below 20ms. 9ms is the minimum before sound breaks. At lower values it is actually much better. Clicks turns into quiet crackle, but it is still petty clearly a bad thing. I was afraid, that buffer size have to be greater than or equal to frametime, but it appears, that it is not the case. Why Audio.cpp has hard coded minimum value of 20ms then? Is it illegal to go below 20? what could happen?
Yeah, for each sample inside the chunk. I wonder, how much more CPU it will require?