1936682863 "sooo" eroor when scheduling with ScheduledAudioFileRegion in the AEAudioUnitFilePlayer

edited September 2013

This is bugging the life out of me.

I'm trying to schedule new files to play at runtime using the AEAudioUnitFilePlayer.

This is the method that set up two regions and plays them at startup(this works great, no errors)!

Code:

  • (OSStatus)setupPlayRegion: (int)index
    {
    OSStatus result = -1;

    ScheduledAudioFileRegion region;
    memset (&region.mTimeStamp, 0, sizeof(region.mTimeStamp));
    region.mTimeStamp.mFlags = kAudioTimeStampSampleTimeValid;
    region.mTimeStamp.mSampleTime = 0;
    region.mCompletionProc = NULL;
    region.mCompletionProcUserData = NULL;
    region.mAudioFile = _audioUnitFile[0];
    region.mLoopCount = 0;
    region.mStartFrame = 0;
    region.mFramesToPlay = _lengthInFrames;

    ScheduledAudioFileRegion regionTwo;
    memset (&regionTwo.mTimeStamp, 0, sizeof(regionTwo.mTimeStamp));
    regionTwo.mTimeStamp.mFlags = kAudioTimeStampSampleTimeValid;
    regionTwo.mTimeStamp.mSampleTime = _lengthInFrames;
    regionTwo.mCompletionProc = NULL;
    regionTwo.mCompletionProcUserData = NULL;
    regionTwo.mAudioFile = _audioUnitFile[1];
    regionTwo.mLoopCount = 0;
    regionTwo.mStartFrame = 0;
    regionTwo.mFramesToPlay = _lengthInFrames ;

    checkResult(result = AudioUnitSetProperty(_audioUnit, kAudioUnitProperty_ScheduledFileRegion, kAudioUnitScope_Global, 0, &region, sizeof(region)),
    "AudioUnitSetProperty(kAudioUnitProperty_ScheduledFileRegion)");

    checkResult(result = AudioUnitSetProperty(_audioUnit, kAudioUnitProperty_ScheduledFileRegion, kAudioUnitScope_Global, 0, &regionTwo, sizeof(regionTwo)),
    "AudioUnitSetProperty(kAudioUnitProperty_ScheduledFileRegion)");

    // Prime the player by reading some frames from disk
    UInt32 defaultNumberOfFrames = 0;
    checkResult(result = AudioUnitSetProperty(_audioUnit, kAudioUnitProperty_ScheduledFilePrime, kAudioUnitScope_Global, 0, &defaultNumberOfFrames, sizeof(defaultNumberOfFrames)),
    "AudioUnitSetProperty(kAudioUnitProperty_ScheduledFilePrime)");

    // Set the start time (now = -1)
    AudioTimeStamp startTime;
    memset (&startTime, 0, sizeof(startTime));
    startTime.mFlags = kAudioTimeStampSampleTimeValid;
    startTime.mSampleTime = -1;
    checkResult(AudioUnitSetProperty(_audioUnit, kAudioUnitProperty_ScheduleStartTimeStamp, kAudioUnitScope_Global, 0, &startTime, sizeof(startTime)),
    "AudioUnitSetProperty(kAudioUnitProperty_ScheduleStartTimeStamp)");

    return result;
    }

Now, after that, the folloing method runs when the user hitss abutton, and it comes up with: "AudioUnitSetProperty(kAudioUnitProperty_ScheduledFileRegion) result 1936682863 736F6F6F sooo"

-(OSStatus)HandleNextLoop{

OSStatus result;


ScheduledAudioFileRegion regionNew;
memset (&regionNew.mTimeStamp, 0, sizeof(regionNew.mTimeStamp));

regionNew.mTimeStamp.mFlags = kAudioTimeStampSampleTimeValid;
regionNew.mCompletionProc = NULL;
regionNew.mCompletionProcUserData = NULL;
regionNew.mAudioFile = _audioUnitFile[1];
regionNew.mLoopCount = 0;
regionNew.mStartFrame = 0;
regionNew.mFramesToPlay = _lengthInFrames;


checkResult(result = AudioUnitSetProperty(_audioUnit, kAudioUnitProperty_ScheduledFileRegion, kAudioUnitScope_Global, 0, &regionNew, sizeof(regionNew)),
            "AudioUnitSetProperty(kAudioUnitProperty_ScheduledFileRegion)");



return result;

}

This is driving me crazy, do you guys know what this "sooo" error is?

Comments

  • Sorry for the messy code above.

    Figured it out. The error "sooo" occurs when the scheduled region is timed to start at an invalid time. So don't schedule it to start when previously scheduled region is still playing.

  • Thanks for sharing, fecko! I'd always wondered the same thing myself

  • Nice one @fecko, cheers - just came across this writing the new AEAudioFilePlayer and couldn't find the error anywhere else =)

  • I just came here to mention this problem can also happen if you send NaNs to your audio.

    In our case, the volume was being set to NaN. Remember to check for NaNs (divisions by 0, square roots of negative numbers, pow functions, logarithm of 0 & negative numbers, Inf - Inf, etc) or just sanitize your data right before it gets passed to TAAE.

Sign In or Register to comment.