How does one get the clock time or sample accurate time on the running AVAudioEngine?
From the docs:
The
AVAudioEngine
class defines a group of connectedAVAudioNode
objects, known as audio nodes. You use audio nodes to generate audio signals, process them, and perform audio input and output.
For clock and/or sample time, you need to call lastRenderTime
on a valid AVAudioNode
instance.
The lastRenderTime
method returns an AVAudioTime
object. With the AVAudioTime
, you can retrieve time:
sampleTime
will return the sample time is sampleTimeValid
returns YES
.hostTime
will return host time if hostTimeValid
returns `YES.