Re: [iOS] kAudioUnitSubType_AUiPodTime and background audio
Re: [iOS] kAudioUnitSubType_AUiPodTime and background audio
- Subject: Re: [iOS] kAudioUnitSubType_AUiPodTime and background audio
- From: William Stewart <email@hidden>
- Date: Tue, 12 Oct 2010 18:04:38 -0700
The audio stops because your deafult audio category is "SoloAmbient"
If you want to have audio continue to play when the screen is dark, you can set your category to MediaPlayback (or PlayAndRecord if you need input)
See <AudioToolbox/AudioServices.h> - AudioSessionXXX API
Bill
On Oct 11, 2010, at 8:03 AM, Hank Heijink (Mailinglists) wrote:
> Sorry to reply to my own post: I pasted one method into another to save space, and mistyped: wherever it says 'audioGraph', read 'mGraph'.
>
> Apologies,
> Hank
>
> On Oct 11, 2010, at 10:47 AM, Hank Heijink (Mailinglists) wrote:
>
>> Hi all,
>>
>> I have an application that plays audio through an AUGraph, and I've hit a bump in the road. Here's how the graph is set up:
>>
>> AudioComponentDescription outputDesc = {kAudioUnitType_Output, kAudioUnitSubType_RemoteIO, kAudioUnitManufacturer_Apple, 0, 0};
>> AudioComponentDescription mixerDesc = {kAudioUnitType_Mixer, kAudioUnitSubType_MultiChannelMixer, kAudioUnitManufacturer_Apple, 0, 0};
>> AudioComponentDescription iPodTimeDesc = {kAudioUnitType_FormatConverter, kAudioUnitSubType_AUiPodTime, kAudioUnitManufacturer_Apple, 0, 0};
>>
>> AUGraph mGraph;
>> NewAUGraph(&mGraph);
>>
>> AUNode outputNode;
>> AUNode mixerNode;
>> AUNode iPodTimeNode;
>>
>> AUGraphAddNode(audioGraph, &outputDesc, &outputNode);
>> AUGraphAddNode(audioGraph, &mixerDesc, &mixerNode);
>> AUGraphAddNode(audioGraph, &iPodTimeDesc, &iPodTimeNode);
>>
>> // These two lines are what will be replaced below
>> AUGraphConnectNodeInput(audioGraph, mixerNode, 0, iPodTimeNode, 0);
>> AUGraphConnectNodeInput(audioGraph, iPodTimeNode, 0, outputNode, 0);
>>
>> AUGraphOpen(audioGraph);
>>
>> ...etc...
>>
>> I left out the rest of the stuff, because the problem seems to exhibit itself here - let me know if you think that's relevant...
>>
>> When I play audio through this graph on an iPhone 4 (iOS 4.1), audio plays fine but stops as soon as the screen goes blank or I hit the sleep button on the top of the iPhone. However, if I take out the iPod time unit by replacing the two lines referenced above with this:
>>
>> AUGraphConnectNodeInput(audioGraph, mixerNode, 0, outputNode, 0);
>>
>> audio keeps playing, even after the screen goes blank or if I hit the sleep button. This is the behavior I want. I verified that the audio category is right (kAudioSessionCategory_MediaPlayback), and everything else seems to be just fine: no errors are returned by any of the setup or rendering functions/callbacks. I've looked on the developer forums, the archives, and google in general and I haven't found anything about this.
>>
>> Has anybody else seen this behavior? Any input would be greatly appreciated!
>>
>> Thanks,
>> Hank
>>
>> _______________________________________________
>> 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
>>
>
> _______________________________________________
> 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
_______________________________________________
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