Sorry if this has been asked before. I tried googling but did not find much.
I found AUGraphAddRenderNotify From the documentation
"Adds a callback that the graph will call every time the graph renders. The callback will be called once before the graph’s render operation,
and once after the render operation is complete."
I wrote a little test program setting ScheduledAudioFileRegion.mCompletionProcUserData and using AUGraphAddRenderNotify().They share a boolean. The boolean is set in ScheduledAudioFileRegion.mCompletionProcUserData, and check in the AUGraphAddRenderNotify callback.
AudioFileRegionCompletionProc() {
Done = YES;
}
AUGraphAddRenderNotify() {
If (done) {
AUGraphStop(inUserData->audioGraph);
Update UI
}
}
When I ran my test program, I found AUGraphAddRenderNotify 2 times after done was set to true; Causing stop to be cause twice
AUGraphAddRenderNotify filePlayerFished = 0 AUGraphAddRenderNotifyCount = 1407
Audio Unit File Player callback : filePlayerFished = 1 AUGraphAddRenderNotifyCount = 1408
AUGraphAddRenderNotify filePlayerFished = 1 AUGraphAddRenderNotifyCount = 1409
!!!!!!!!!! AUGraphAddRenderNotify stop !!!!!!!!!!!!
AUGraphAddRenderNotify filePlayerFished = 1 AUGraphAddRenderNotifyCount = 1410
!!!!!!!!!! AUGraphAddRenderNotify stop !!!!!!!!!!!!
Where all the samples rendered? Also AUGraphAddRenderNotify() gets called twice on each render cycle. These seems like a lot of overhead.
Is there a better way to implement this?
Thanks
Andy