Posted on the forum, I duplicate here in case. Am I the only one having these really weird bugs?
1)Hi to all!
Working on a music game for iPad, a project in which a low latency is of course crucial. I figured I would try to lower it once the project is close to completion, and everything is hunky dory except for a few strange quirks:
-I used AudioSettings.GetDSPBufferSize(bufferSize,numBuffe rs) to be certain of the default best latency settings. This gave me 1024 and 4.
-I then set it to 512 and 8 (AudioSettings.SetDSPBufferSize(512,8), to test. In the editor, a simple debug confirmed the new buffer's size. Built to iPad, no sound and the debug now giving me 256 and 4. Back to the editor, I delete the SetDSP line, run again : still 512 and 8. Had to reboot Unity to revert back to the default settings. Build again, debug still shows 256 and 4 on the iPad, but this time the audio is working, and latency has improved.
I'm a bit puzzled! I searched all my scripts, there's only one SetDSP call, and it's commented out. And where does the 256 and 4 numbers come from? Never even tried it. Is that the default setting for best latency on iOS devices? Seems like an extremely small buffer to me...
2)Just ran into another quirk, worse than the last alas!
Since the iPad's sample output rate is 24k, I down sampled all my samples (everything was at 44.1), and set the AudioSettings.outputSampleRate to 24000. No matter where I put the instruction, log and my ears show that when running in the editor, the sample rate stays at 44.1. Tried re-importing all assets, nothing. On the iPad, it works fine, no pitch shifted notes, but all offset values in Play(offset) instructions are still calculated as if the sample rate was 44.1k. It swings a lot, but that's not the idea! Something definitely fishy going around there...
asked Apr 15 '12 at 01:14 PM