Re: AUFilePlayer kAudioUnitProperty_ScheduledFileIDs
Re: AUFilePlayer kAudioUnitProperty_ScheduledFileIDs
- Subject: Re: AUFilePlayer kAudioUnitProperty_ScheduledFileIDs
- From: Ash Gibson <email@hidden>
- Date: Thu, 07 Jun 2012 20:28:28 +1000
Thanks for the reply Jack.
So what happens if you were to pass in 2 files and then submit a
schedule for each file to start at the same time?
On 7 June 2012 19:25, Jack Nutting <email@hidden> wrote:
> On Thu, Jun 7, 2012 at 9:20 AM, Ash Gibson <email@hidden> wrote:
>> I've been mucking around with the AUFilePlayer component on iOS and can see
>> that the kAudioUnitProperty_ScheduledFileIDs property can be an array of
>> files. How do these files get played? One after the other or somehow meshed
>> together?
>
> As far as I can tell (I still consider myself fairly inexpert in Core
> Audio despite having dabbled for a few months), the order of playing
> files, or segments of them, is determined by creating one or more
> ScheduledAudioFileRegions and submitting them to to the fileplayer
> unit for scheduled playback. Setting up the scheduledFileIDs is just a
> precursor to making that work. Each ScheduledAudioFileRegion contains
> a file ID, and that must be one of the files that you previously
> passed it. Here's a bit of my code, separated from any semblance of
> context:
>
> CheckError(AudioUnitSetProperty(fileUnit,
> kAudioUnitProperty_ScheduledFileIDs,
> kAudioUnitScope_Global, 0,
> &fileID, sizeof(fileID)),
>
> "AudioUnitSetProperty[kAudioUnitProperty_ScheduledFileIDs] failed");
>
> [...]
>
> 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 = fileID;
> rgn.mLoopCount = INT_MAX;
> rgn.mStartFrame = 0;
> rgn.mFramesToPlay = nPackets * fileAudioFormat.mFramesPerPacket;
>
> CheckError(AudioUnitSetProperty(fileUnit,
> kAudioUnitProperty_ScheduledFileRegion,
> kAudioUnitScope_Global,
> 0,&rgn, sizeof(rgn)),
>
> "AudioUnitSetProperty[kAudioUnitProperty_ScheduledFileRegion] for one
> of the loops");
>
> Note that, as I uncovered a couple of weeks ago, the latter use of
> AudioUnitSetProperty isn't really "setting a property", at least not
> in the sense that I consider a "property". You can call this several
> times in sequence with different regions, and the first value doesn't
> get replaced by the later. Rather than thinking of it as a property,
> think of it as passing a command to the file player, telling to add
> the scheduled region you're passing in to its own internal list of
> scheduled regions that need to be played.
>
> --
> // Jack Nutting
> // email@hidden
> // http://nuthole.com
> // http://learncocoa.org
--
Ash Gibson
0410 329 355
www.smartface.com.au
_______________________________________________
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