I have this chunk of code in an audio unit which will play a region and
loop it indefinitely:

    ScheduledAudioFileRegion rgn;
memset (&rgn.mTimeStamp, 0, sizeof(rgn.mTimeStamp));
rgn.mTimeStamp.mFlags = kAudioTimeStampSampleTimeValid;
rgn.mTimeStamp.mSampleTime = 0;
* rgn.mCompletionProc = scheduledAudioSliceCompletionProc;*
rgn.mCompletionProcUserData = NULL;
rgn.mAudioFile = player_->inputFile;
* rgn.mLoopCount = -1;*
rgn.mStartFrame = player_->startFrame;
rgn.mFramesToPlay = framesToPlay_;


I set the loop count to -1 to allow it to loop forever. I'm using this in a
metronome. I would like to post a notification on each completion of the
loop so that I can do something in the
UI. scheduledAudioSliceCompletionProc will only get called when the
playback stops for the entire graph, not on each completion of a loop.

Is there a way to find out when a loop finishes, so I can perform some
action?

If I were to upgrade this code to 10.10, and use the new AVFoundations
APIs, would I use
scheduleSegment:startingFrame:frameCount:atTime:initWithSampleTime:completionHandler:
? I've attempted using that scheduling audio for a single second, but it
did not seem to have an effect of playback(Xcode 6.1, Objc, yosemite).

thanks.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to