• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: AUFilePlayer kAudioUnitProperty_ScheduledFileIDs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AUFilePlayer kAudioUnitProperty_ScheduledFileIDs


  • Subject: Re: AUFilePlayer kAudioUnitProperty_ScheduledFileIDs
  • From: Jack Nutting <email@hidden>
  • Date: Thu, 07 Jun 2012 11:25:07 +0200

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
 _______________________________________________
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

  • Follow-Ups:
    • Re: AUFilePlayer kAudioUnitProperty_ScheduledFileIDs
      • From: Ash Gibson <email@hidden>
References: 
 >AUFilePlayer kAudioUnitProperty_ScheduledFileIDs (From: Ash Gibson <email@hidden>)

  • Prev by Date: remoteIO playback setup
  • Next by Date: Re: AUFilePlayer kAudioUnitProperty_ScheduledFileIDs
  • Previous by thread: AUFilePlayer kAudioUnitProperty_ScheduledFileIDs
  • Next by thread: Re: AUFilePlayer kAudioUnitProperty_ScheduledFileIDs
  • Index(es):
    • Date
    • Thread