• 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: Callback when AUFilePlayer is finished?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Callback when AUFilePlayer is finished?


  • Subject: Re: Callback when AUFilePlayer is finished?
  • From: "M. Uli Kusterer" <email@hidden>
  • Date: Wed, 18 Oct 2006 12:26:50 +0200

On 17.10.2006, at 21:53, Kariem Morsy wrote:

or simply regstier a completion callback when scheduling the audio file region before playback:
rgn.mCompletionProc= myCallbackFunction;
rgn.mCompletionProcUserData= someUserData; // optional
where myCallbackFunction is defined as follows:
void myCallBackFunction(void *userData, ScheduledAudioFileRegion *fileRegion, OSStatus result){
// do something
}


Note, however, that this function is not only called when rgn.mFramesToPlay frames were played,
which in your case is probably the whole file, but also everytime you reset the file player, for
example when you want to change the playback position. so in that case make sure to check the
data that's passed to the callback to find that out.



Karim,

I tried this, but it seems that this is called when CoreAudio is finished *scheduling* the audio, not when it is finished actually *playing* it. So as a rule it seems I get called shortly after having started playing a region, while the sound has only just started playing. I.e. here's a console log:

current playtime: -1.000000
Hearing anything?
Finished playing (status = 0)
current playtime: 38456.000000
current playtime: 40312.000000
current playtime: 42356.000000
Okay, that's it.

 Is there a trick to this that I'm not aware of?


as for the metering, adding a mixer unit should not require a lot of work.
just connect a stereo or matrix mixer in between the fileplayer and the output unit, and query the
mixer unit for its averagePower parameter.



The sound data I get may be any sound data (I don't have any control over whether it's stereo, mono, 5.1 or whatever), so I can't just use a stereo mixer, but yeah, the mixer *does* sound manageable in theory. It's just that there's almost no documentation and sample code that takes shortcuts that reduce me to Sound Manager feature set again. But that's not your fault.


Thanks for all the suggestions. I guess I'll spend some more time stabbing in the dark and hope my code doesn't break with the next system version...

Cheers,
-- M. Uli Kusterer



_______________________________________________
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: Callback when AUFilePlayer is finished?
      • From: David Duncan <email@hidden>
References: 
 >Re: Callback when AUFilePlayer is finished? (From: Kariem Morsy <email@hidden>)

  • Prev by Date: SoundFont from major developer fails to load in DLSMusicDevice
  • Next by Date: Re: AUFilePlayer volume levels?
  • Previous by thread: Re: Callback when AUFilePlayer is finished?
  • Next by thread: Re: Callback when AUFilePlayer is finished?
  • Index(es):
    • Date
    • Thread