Norway


Hi iOS Programming.

;m trying to figure out if it̵;s possible to play sound on just one of the iPhone ̵;s speakers when the phone is in portrait mode. I would just try this myself except I have an older phone, and the simulator isn̵;t accurate enough to test it. It needs to be a device in order to work.

I have been told that feeding the phone a stereo source with just one channel playing results in the sound coming out of both speakers in portrait mode. The iPhone apparently mixes it and creates a mono channel. For this reason, I suspect that panning left and right will have similar behavior, but it’s worth testing.

There’s one more interesting possibility with kAudioQueueProperty_ChannelAssignments https://developer.apple.com/documentation/audiotoolbox/1618733-anonymous/kaudioqueueproperty_channelassignments which I think actually may work where the other two do not. I have been told that each of the speakers appears as a separate channel when queried with AVAudioSession.sharedInstance.currentRoute.outputs.

This is where I can use your help. I have a very basic to go that just needs to be tested on a real device. Just compile it, run it, and then tell me what happens when you click each of the rows. For the purposes of localizing which speaker the audio comes from, it may help to muffle each one with your finger, just to be sure. I’m mostly curious how the phone works in portrait orientation, but knowing about landscape might be interesting too. Feel free to audit the code if you want, there’s really not much to this.

(Alternately if you just know the answer to this, please tell me. I’ve had a very hard finding credible sources)

Code is here https://github.com/brian-armstrong/speaker-tester



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here