Search code examples
cocoacore-audio

How to know if an audio unit of type AudioFilePlayer is playing (rendering)


I use an AUGraph and it contains some audio units of subtype kAudioUnitSubType_AudioFilePlayer.

I know we can ask if the AUGraph is running thanks to AUGraphIsRunning but I would like to know if an AudioFilePlayer audio unit is currently playing the AudioFileID i.e "produce" sound. I don't see any function like this.

Indeed the graph could "running" but the AudioFilePlayer audio unit could not produce sound (because of: end of audio file, pause, and so on...)


Solution

  • For the ones who are also looking for a solution, the only fix I found is to use a bool variable is_playing. Apparently, An audioFilePlayer doesn't allow to access this kind of property...