RE: RE: iPhone limit audio playback to speakers
Chris Perry <[email protected]>
| Newsgroups | gmane.comp.lib.openal |
|---|---|
| Message-ID | <[email protected]> |
Posting this solution for completeness sake.
Interesting enough, it can be done!
Basically you add a property listener to get route change events: AudioSessionAddPropertyListener(kAudioSessionProperty_AudioRouteChange, audioRouteChangeListenerCallback,0);
Then in the callback, determine if its a headphone being plugged-in and override the audio route: UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute, sizeof(audioRouteOverride), &audioRouteOverride);
Too simple...-Chris
> CC: [email protected]; [email protected]
> From: [email protected]
> Subject: Re: [Openal] RE: iPhone limit audio playback to speakers
> Date: Fri, 29 Apr 2011 13:24:30 -0700
> To: [email protected]
>
> Results are in... Apparently this functionality is currently not supported.
> =]
>
> Sent from my iPad
>
> On Apr 29, 2011, at 1:06 AM, Chris Perry <[email protected]> wrote:
>
> > Thanks Eric, I think you are right.
> >
> > The AVAudioPlayer behaves as expected and Apple's implementation of OpenAl correctly responds to other properties of the session, just not the one I'm currently interested in =]
> >
> > I've submitted a tech support item with Apple regarding this issue and will respond here when they get back to me!
> >
> > Thanks,
> > Chris
> >
> > > Date: Thu, 28 Apr 2011 11:06:13 -0700
> > > Subject: Re: [Openal] RE: iPhone limit audio playback to speakers
> > > From: [email protected]
> > > To: [email protected]
> > > CC: [email protected]
> > >
> > > AudioSessions are an iOS specific item and are probably a bit outside
> > > the scope and expertise of this list. However, I'll give it a try.
> > >
> > > I've never tried overriding the output behavior on an iOS device. Does
> > > your technique work if you use, say AVAudioPlayer instead of OpenAL?
> > > If so, I would say you have indeed found a bug with Apple's iOS OpenAL
> > > implementation and you should file a bug with Apple to get this fixed.
> > >
> > > The caveat is that Apple's HI guidelines discourage you from trying to
> > > override the output device. Particularly on iOS, the user is supposed
> > > to be in control of these things and not automatically rerouting to
> > > headphones is a potentially user confusing behavior.
> > >
> > > -Eric
> > > --
> > > Beginning iPhone Games Development
> > > http://playcontrol.net/iphonegamebook/
> > > _______________________________________________
> > > Openal mailing list
> > > [email protected]
> > > http://opensource.creative.com/mailman/listinfo/openal
> > _______________________________________________
> > Openal mailing list
> > [email protected]
> > http://opensource.creative.com/mailman/listinfo/openal
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal