• 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
AUFilePlayer and multiple files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AUFilePlayer and multiple files


  • Subject: AUFilePlayer and multiple files
  • From: Orestis Markou <email@hidden>
  • Date: Fri, 10 Aug 2012 15:58:29 +0300

Hello,

In the header file of AUFilePlayer on Mac OS X (10.8) there is a suggestion that a single AUFilePlayer instance can be used to playback multiple files, by passing in an array of open AudioFileIDs (instead of a single one).

I've tried as many different things to do this, but all have failed. The culprit is most probably the scheduled regions, as it sporadically gives me a "sooo" error. When it does get set with no error, I get no audio output.

The exact same code path when used with a single file works flawlessly. The files are identical in length (sample-accurate) and format.

I have tried changing the number of channels of the player (doesn't seem to have much effect), changing the number of buses (doesn't work).

Here are the relevant bits of my code:

    scheduledFiles = (AudioFileID*) malloc(sizeof(AudioFileID) * fileCount);
// open the files etc
    CheckError(AudioUnitSetProperty(fileAU,
                                    kAudioUnitProperty_ScheduledFileIDs,
                                    kAudioUnitScope_Global,
                                    0,
                                    scheduledFiles,
                                    (UInt32)(sizeof(AudioFileID) * fileCount)),
               "AudioUnitSetProperty[kAudioUnitProperty_ScheduledFileIDs] failed");

And:

    for (int idx=0;idx<fileCount;idx++) {
        file = fileInfoArray[idx].fileID;
        NSLog(@"setting region %d, fileID %p", idx, file);

        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 = file;
        rgn.mLoopCount = 0;
        rgn.mStartFrame = fileStartFrame;
        rgn.mFramesToPlay = (UInt32) (fileInfoArray[idx].fileTotalFrames - fileStartFrame);

        CheckError(AudioUnitSetProperty(fileAU,
                                        kAudioUnitProperty_ScheduledFileRegion,
                                        kAudioUnitScope_Global,
                                        0,
                                        &rgn,
                                        sizeof(rgn)),
                   "AudioUnitSetProperty[kAudioUnitProperty_ScheduledFileRegion] failed");
   }


Is there anything else that needs to happen to AUFilePlayer in order to playback multiple files at the same time, or should I just create multiple instances behind a mixer? I like the simplicity of having a single audio unit be responsible for all file-based playback.

Thanks,
Orestis



 _______________________________________________
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

  • Prev by Date: metering mixer output on ios
  • Next by Date: Re: metering mixer output on ios
  • Previous by thread: Re: metering mixer output on ios
  • Next by thread: Re: How to handle a packet lost with AudioQueue ?
  • Index(es):
    • Date
    • Thread