Re: iPhone - RenderCallback not called when phone is locked
Re: iPhone - RenderCallback not called when phone is locked
- Subject: Re: iPhone - RenderCallback not called when phone is locked
- From: Wil Macaulay <email@hidden>
- Date: Wed, 25 Nov 2009 11:36:33 -0500
The PlayAndRecord category does what you want.
wil
On Wed, Nov 25, 2009 at 11:34 AM, John Morris
<email@hidden> wrote:
> Yeah, it is pretty easy to have it pause when the phone is locked. The trick I am trying to accomplish is having the sound continue to play while the iphone is locked. With the MediaPlayback category, you are supposed to be able to continue playing while the device is locked. But for some reason, when the device is locked, the AURenderCallback stops being called. I filed a bug on it (radar #7408577).
>
> John
>
> On Nov 25, 2009, at 2:42 AM, Aran Mulholland wrote:
>
>> hey john,
>>
>> had the same issue as you today so i got out your project and fixed it
>> there. nice to work in a simple test case.
>>
>> how i worked around it was to start the audio with
>> AudioOutputUnitStart(au_output); from the
>>
>> - (void) applicationDidBecomeActive:(UIApplication *)application method
>>
>> and stop it in the with AudioOutputUnitStop(au_output); in the
>>
>> - (void) applicationWillResignActive:(UIApplication *)application
>>
>> this way whenever the app becomes disabled due to lock the audio
>> render stops and when it gets unlocked it begins playing again.
>> In my other project i use AUGraphStop(graph); and AUGraphStart(graph);
>> in a similiar fashion.
>>
>> dont know if this is the official party line, but it works for me
>>
>> Aran
>>
>> On Thu, Nov 19, 2009 at 8:17 AM, John Morris
>> <email@hidden> wrote:
>>> Hmmm....I hacked up my code and inserted it into a new project (the OpenGL ES template). Same behavior. The meat and potatoes are in a file called audio.cpp.
>>>
>>> You can grab the test project here:
>>> <http://evolutioninteractive.com/stuff/audiotest.zip>
>>>
>>> Someone mentioned that they saw similar issues related to doing too much work, so this test just outputs silence (a simple memset() with the kAudioUnitRenderAction_OutputIsSilence hint).
>>>
>>> So, what this app does is just dump a "." out to the console for each call into the RenderCallback. When you start up the app, it will start with the debug output (making big strings of periods). When you hit the lock button, the output will stop. When you unlock it, it will start up again. This is the crux of the problem. When the device locks, the sound keeps playing, but the RenderCallback isn't called to refresh the buffer, so it just keeps playing the same (last filled) buffer over and over. And this is with the category set to MediaPlayback.
>>>
>>>
>>> Thanks,
>>> John Morris
>>> Evolution Interactive
>>>
>>>
>>> On Nov 17, 2009, at 4:21 PM, John Morris wrote:
>>>
>>>> Hmmm....I hacked up my code and inserted it into a new project (the OpenGL ES template). Same behavior. I attached the test project. The meat and potatoes are in a file called audio.cpp.
>>>>
>>>> Someone mentioned that they saw similar issues related to doing too much work, so this sample just outputs silence (a simple memset() with the kAudioUnitRenderAction_OutputIsSilence hint).
>>>>
>>>> So, what this app does is just dump a "." out to the console for call into the RenderCallback. When you start up the app, it will start with the debug output (making big strings of periods). When you hit the lock button, the output will stop. When you unlock it, it will start up again. This is the crux of the problem. When the device locks, the sound keeps playing, but the RenderCallback isn't called to refresh the buffer, so it just keeps playing the same (last filled) buffer over and over. And this is with the category set to MediaPlayback.
>>>>
>>>> Thanks,
>>>> John Morris
>>>> Evolution Interactive
>>>
>>> _______________________________________________
>>> 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