Hi, I have a simple AUGraph with a AUFilePlayer and DefaultOutput node. I schedule playback of a short sample from a file. I'd like schedule a brief gap of silence after that, then schedule the sample again. I'm basically making a simple metronome and the length of the gap of silence should be configurable. I'm not sure how to do this. Here is a snippet of how I schedule the original file:
UInt64 nPackets;
UInt32 propsize = sizeof(nPackets);
CheckError(AudioFileGetProperty
(player_->inputFile, kAudioFilePropertyAudioDataPacketCount, &propsize, &nPackets),
"AudioFileGetProperty[kAudioFilePropertyAudioDataPacketCount] failed");
// set the start frame to the new position. position_ is always 0.
player_->startFrame = _audioFileInfo.frames * position_;
ScheduledAudioFileRegion rgn;
memset (&rgn.mTimeStamp, 0, sizeof(rgn.mTimeStamp));
rgn.mTimeStamp.mFlags = kAudioTimeStampSampleTimeValid;
rgn.mTimeStamp.mSampleTime = 0;
rgn.mCompletionProc = NULL;
rgn.mCompletionProcUserData = NULL;
rgn.mAudioFile = player_->inputFile;
rgn.mLoopCount = -1;
rgn.mStartFrame = player_->startFrame;
rgn.mFramesToPlay = _audioFileInfo.frames - player_->startFrame;
NSLog(@" %ld mFramesToPlay | @ rgn.mStartFrame %qd | player_->totalFrames: %llu | player_->startFrame: %f", (long int)rgn.mFramesToPlay, rgn.mStartFrame, _audioFileInfo.frames, player_->startFrame);