I’m using the DSP clock to time pretty much everything in my application. It’s the best way to synchronize visuals and sounds as well as stitching my sounds together.
However, the clock often gives me a hi and lo of zero (0), despite being in a new frame update. I’m calling system::update() every frame.
Can you explain to me what may trigger this behaviour? Or maybe the inner workings of the clock on iPhone?
- fredsifu asked 9 years ago
Having a delta of 0 is expected. The DSP clock is updated in chunks (the chunks we submit to the sound hardware), each chunk is a certain number of samples which can be found from System::getDSPBufferSize(). On the iPhone the value will probably default to 1156 samples and at the default sample rate (24KHz) this is around 48ms. So the DSP clock will only update that often.
If you poll the value of the clock more frequently than this you will get a 0 delta.
If you are using setDelay, you need not worry about the DSP block size with regards to latency. That method is sample accurate, i.e. you can have things start and stop on any sample, not just intervals of the block size. It is just the updating of the values returned from the DSP clock which are in blocks.
Also as a side note, you cannot change the DSP block size on the iPhone we mix on-demand for the hardware to achieve low latency.
I don’t see how the DSP clock would give you zero’s unless something like memory was being overwritten. Would it be possible for you to send a test app that exhibits this problem to firstname.lastname@example.org? I have done some testing here with DSP clock in the example apps and it’s always steadily increasing, never 0, 0.
I’m very sorry, I made a mistake in my initial post. The problem I’m getting is actually that the hi and lo DELTA is 0 from one frame to another, meaning the hi and lo are the same in two calls to getDSPClock. My apologies.
In this light, do you see what the issue could be?
Please login first to submit.