• 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
AURemoteIO::Initialize failed: -12985 on iOS 5
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AURemoteIO::Initialize failed: -12985 on iOS 5


  • Subject: AURemoteIO::Initialize failed: -12985 on iOS 5
  • From: Paul Scott <email@hidden>
  • Date: Sun, 08 Jan 2012 11:48:36 -0800

I'm using a Remote I/O unit with a render callback, that is working perfectly in all circumstances except one, which I'll describe shortly.

I've implemented an interruption listener as follows:

    switch ( inInterruptionState ) {
        case kAudioSessionBeginInterruption:
            AudioOutputUnitStop( aUnit );
            break;
        case kAudioSessionEndInterruption:
            rampUpVolume = 0.0;
            AudioOutputUnitStart( aUnit );  //  <--- FAILS ONLY IN BACKGROUND
            break;
    }

Now on iOS 5, in all cases of interruption except one, the audio stops playing in case kAudioSessionBeginInterruption and begins playing again in case kAudioSessionEndInterruption. However,  when the app is playing in background, it does not begin playing again for case kAudioSessionEndInterruption because the AudioOutputUnitStart( aUnit ) fails with the following error reported on gdb console:

2012-01-08 11:27:36.267 MyBackGApp[7942:707] 11:27:36.265 <0x3ef07ce8> AUIOClient_StartIO failed (-12985)

If instead, I teardown and startup of the audio unit with code that distills down to this:

    switch ( inInterruptionState ) {
        case kAudioSessionBeginInterruption:
            AudioOutputUnitStop( aUnit );
            AudioUnitUninitialize( aUnit );
            AudioComponentInstanceDispose( aUnit );
            AudioSessionSetActive( false );
            aUnit = nil;
            break;
        case kAudioSessionEndInterruption:
            AudioSessionSetActive( true );
            AudioComponentDescription defaultOutputDescription;
            defaultOutputDescription.componentType = kAudioUnitType_Output;
            defaultOutputDescription.componentSubType = kAudioUnitSubType_RemoteIO;
            defaultOutputDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
            defaultOutputDescription.componentFlags = 0;
            defaultOutputDescription.componentFlagsMask = 0;
            AudioComponent defaultOutput = AudioComponentFindNext( NULL, &defaultOutputDescription );
            AudioComponentInstanceNew( defaultOutput, &aUnit );
            AURenderCallbackStruct input;
            input.inputProc = RenderAudio;
            input.inputProcRefCon = self;
            AudioUnitSetProperty( aUnit, kAudioUnitProperty_SetRenderCallback, 
                kAudioUnitScope_Input, 0, &input, sizeof(input) );
            int bytes_per_float = sizeof (Float32);
            int bits_per_byte = 8;
            AudioStreamBasicDescription streamFormat;
            streamFormat.mSampleRate = 8000;
            streamFormat.mFormatID = kAudioFormatLinearPCM;
            streamFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked | kAudioFormatFlagIsNonInterleaved;
            streamFormat.mFramesPerPacket = 1;
            streamFormat.mChannelsPerFrame = 1;
            streamFormat.mBytesPerFrame = streamFormat.mChannelsPerFrame * bytes_per_float;
            streamFormat.mBytesPerPacket = streamFormat.mBytesPerFrame;
            streamFormat.mBitsPerChannel = bytes_per_float * bits_per_byte;
            streamFormat.mReserved = 0;
            AudioUnitSetProperty ( aUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input,
                0, &streamFormat, sizeof(AudioStreamBasicDescription) );
            rampUpVolume = 0.0;
            rampUpVolumeRate = 2.0 / streamFormat.mSampleRate;
            AudioUnitInitialize( aUnit );  //  <--- FAILS ONLY IN BACKGROUND
            AudioOutputUnitStart( aUnit );
            break;
    }

Then the AudioUnitInitialize( aUnit ) fails, but again only when in background, with the following error reported on gdb console:

2012-01-08 10:16:25.095 MyBackGApp[7838:707] 10:16:25.096 <0x3ef07ce8> AURemoteIO::Initialize failed: -12985 (enable 2, outf< 1 ch,   8000 Hz, Float32> inf< 2 ch,      0 Hz, Float32, non-inter>)

I can find no documentation at all for -- and no header file containing -- the error -12985.

What is the reason for this error? How can I avoid it so that my app begins playing again in background, after the interruption?

Thanks!
Paul

--
Paul Scott
email@hidden

 _______________________________________________
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: AURemoteIO::Initialize failed: -12985 on iOS 5
      • From: email@hidden
  • Prev by Date: Is kAudioHardwarePropertySleepingIsAllowed broken on Lion?
  • Next by Date: RE: AURemoteIO::Initialize failed: -12985 on iOS 5
  • Previous by thread: Is kAudioHardwarePropertySleepingIsAllowed broken on Lion?
  • Next by thread: RE: AURemoteIO::Initialize failed: -12985 on iOS 5
  • Index(es):
    • Date
    • Thread