Re: Audiograph fileRegion.mCompletionProc
Re: Audiograph fileRegion.mCompletionProc
- Subject: Re: Audiograph fileRegion.mCompletionProc
- From: Aran Mulholland <email@hidden>
- Date: Tue, 24 Jul 2012 10:20:21 +1000
The completion proc is called after the region is queued successfully.
To find out when the region is finished you have to get a bit hacky.
You can set a timer, or add a render completed callback that will be
fired every time the audio unit renders so you can check the current
time stamp and compare it to the end time you have.
I have even set up a midi sequence to do this. I added a user event to
the sequence at the region finish time and added a callback that would
fire on midi events. Don't really think this is the 'right' way to do
things but it worked.
On Tue, Jul 24, 2012 at 12:46 AM, Daniel Tapie <email@hidden> wrote:
> Hi Robert,
>
> Not sure this is the best thing to do, but what we actually do is start a
> timer when the completion proc is called, so that it starts checking for the
> actual playback position and when it reaches the end, we know the playout is
> over.
>
> One more thing: apparentl the AU file player component does not work in an
> Sandboxed environment. We filed a bug report on this, but I thought you'd
> like to know.
>
> Hope this helps,
>
>
> Daniel Tapie
> Softon Media Services
>
> On 23 Jul 2012, at 16:38, Robert Carroll <email@hidden> wrote:
>
> Hi,
>
> With an audiograph fileplayer, when does the audiofileregion.mCompletionProc
> fire? Is this documented anywhere?
>
> I assumed this meant once the fileregion has been played, but it seems to
> occur when it is read into memory.
>
> memset (&fileRegion.mTimeStamp, 0, sizeof(fileRegion.mTimeStamp));
> fileRegion.mTimeStamp.mFlags = kAudioTimeStampSampleTimeValid;
> fileRegion.mTimeStamp.mSampleTime = 0;
> fileRegion.mCompletionProc = completionListenerProc;
>
> fileRegion.mCompletionProcUserData = NULL;
>
> fileRegion.mAudioFile = inputFile;
>
> fileRegion.mLoopCount = 0; //do not loop
> fileRegion.mStartFrame = 0;
> fileRegion.mFramesToPlay = (UInt32)44100;
>
> void completionListenerProc(
> //OSStatus completionListenerProc(
> void * inRefCon,
> AudioUnit ci,
> AudioUnitPropertyID inID,
> AudioUnitScope inScope,
> AudioUnitElement inElement)
> {
>
> NSLog(@"completionListenerProc: fileplayer complete!");
>
> //return noErr;
> }
>
>
>
> _______________________________________________
> 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
>
_______________________________________________
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