Re: Coreaudio-api Digest, Vol 11, Issue 143
Re: Coreaudio-api Digest, Vol 11, Issue 143
- Subject: Re: Coreaudio-api Digest, Vol 11, Issue 143
- From: Robert Carroll <email@hidden>
- Date: Fri, 29 Aug 2014 18:53:49 -0400
If you want sample accurate timing, I think you will have to get inside the callback and track the sample time.
Once you have that, its relatively straight forward to trigger the first part of a sampled sound, or a synthesized sound. The audioGraph sample code (extended from MixerHost) on GitHub would be a good place to start.
rob
Robert Carroll RSM Records Toronto
Message: 3 Date: Wed, 27 Aug 2014 17:21:00 -0400 From: "Mazzaroth M." <email@hidden> To: coreaudio-api <email@hidden> Subject: schedule silence of n length Message-ID: <CALYQoYBiYXqNmyQ0D4LsgY11pD55Au+Z=email@hidden> Content-Type: text/plain; charset="utf-8"
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);
regards, Michael |
_______________________________________________
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