That's useful information. I did notice the fluctuating sample counts.raidho36 wrote:OpenAL internally updates at under 50 frames per second. The amount of samples updated per frame is usually at cyclically repeating irregular intervals, e.g. 342 on odd frames and 558 on even frames.
Ah, I see. OK, I just tried simplifying it to:raidho36 wrote:Also you're reading the data out wrong. You're waiting on entire buffer to fill up before reading. What you should do is immediately read as soon as there is any input in the buffer. That should produce SoundData at the same rate as AL's internal update rate.
Code: Select all
if data:getSampleCount ( ) > 0 then
data = inputs[1]:getData()
end
As for my chosen sample rate of 11025 ... what will OpenAL do when I request a rate that isn't supported by a particular piece of hardware? In Windows, it seems to give me any arbitrary rate I ask for. But on the original iPhone, for example, the sample rate is limited to 8000 (on the built-in mic at least). Would my program generate an error in that case?