• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how to know when AudioGraph as finished? ( I.E. the last sample has been rendered by kAudioUnitSubType_RemoteIO?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to know when AudioGraph as finished? ( I.E. the last sample has been rendered by kAudioUnitSubType_RemoteIO?


  • Subject: Re: how to know when AudioGraph as finished? ( I.E. the last sample has been rendered by kAudioUnitSubType_RemoteIO?
  • From: Andy Davidson <email@hidden>
  • Date: Wed, 20 Jun 2012 07:52:11 -0700
  • Thread-topic: how to know when AudioGraph as finished? ( I.E. the last sample has been rendered by kAudioUnitSubType_RemoteIO?

Hi Bill

From: William Stewart <email@hidden>
Date: Tue, 19 Jun 2012 18:06:52 -0700
To: Andrew Davidson <email@hidden>
Cc: "email@hidden" <email@hidden>
Subject: Re: how to know when AudioGraph as finished? ( I.E. the last sample has been rendered by kAudioUnitSubType_RemoteIO?

The Render Notify is called twice per render cycle - once in "pre" render (before the graph does any rendering) and again in "post" render (after the graph has completely rendered). So, you need to check the render action flags and say do your work in post-render only.

In terms of calculating when you are done. Every audio unit can have both latency and tail. So, you have to add all of these numbers up and add them to the time when you are finished with your file player. Think of a reverb tail - once you have the last sample of your file played through a reverb, it still is going to be present in the reverb for some time after (depends how long the reverb tail is)... or a look-ahead limiter, that buffers a couple of hundred samples before it does any output (latency).

Reverb is a good example. Lets say I use Apple's or some third parties reverb. Given I did not implement it is there a good way other than just testing and trial an error to estimate it this AU's latency or tail? 

I realize knowing when you are "done" is probably only an issue when you use an AU like the file player.

Thanks

Andy



Bill

On Jun 19, 2012, at 4:26 PM, Andy Davidson wrote:

Sorry if this has been asked before. I tried googling but did not find much.

I have a farily simple Audio Graph with a kAudioUnitSubType_AudioFilePlayer upstream and kAudioUnitSubType_RemoteIO down stream. In between their maybe an arbitrary number of Audio Units, and maybe a couple of buffers. How can I know when the last sample as been rendered by kAudioUnitSubType_RemoteIO ? I want to update my UI when this event occurs.

I know ScheduledAudioFileRegion.mCompletionProcUserData can be use to register a call back function to receive callbacks when the file player AU finishes how ever how would I know when all the samples have made their way through the entire graph?

 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
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: how to know when AudioGraph as finished? ( I.E. the last sample has been rendered by kAudioUnitSubType_RemoteIO?
      • From: William Stewart <email@hidden>
References: 
 >Re: how to know when AudioGraph as finished? ( I.E. the last sample has been rendered by kAudioUnitSubType_RemoteIO? (From: William Stewart <email@hidden>)

  • Prev by Date: audiograph timeline
  • Next by Date: Templates for Xcode 4.3
  • Previous by thread: Re: how to know when AudioGraph as finished? ( I.E. the last sample has been rendered by kAudioUnitSubType_RemoteIO?
  • Next by thread: Re: how to know when AudioGraph as finished? ( I.E. the last sample has been rendered by kAudioUnitSubType_RemoteIO?
  • Index(es):
    • Date
    • Thread