iPhone Headphones insert/extract changes getNextAudioBlock buffer to mono/stereo (back and forth)

Hi there,
Dipping my toes in a small Projucer “Audio Application” on iOS:

  • On juce 5.2.1
  • Enabled microphone input & background audio (on projucer)

Internal getNextAudioBlock buffer starts always as stereo. then when I change the stereo headphones status (insert jack - or extract if phones were attached at startup) I get a new PrepareToPlay and the next buffer comes in at mono
…and it continues like so mono->stereo->mono…as I attach/detach headphones.

  • No samplerate/buffersize change.
  • Working on iPhone SE with deployment target = 11.0
  • Settings changed from projucer only

Anybody Experienced that? Is there something stupid I’m missing? Help :slight_smile:

I haven‘t done any iPhone project so far, but what comes to my mind immediately: Do you insert headphones with a microphone? If so this will be a mono source as a new input device for the phone. Now if there are two microphones into your iPhone SE, this will be a 2-Channel (some kind of stereo) source. So maybe it‘s just the way you should expect things to be?

1 Like

Good idea - but this happens both when inserting plain stereo headphones and when inserting headphones with a mic…

(maybe as the headphones jack slides in the socket the iphone detects a mic for a second and changes the audio channels? )

I would not mind the input to become mono if I was able to force the output to stereo, but since the juce AudioApplication getNextAudioBlock has only one buffer inside AFAIK I’m stuck with a mono output when input is mono.

I experienced the same when I updated JUCE some weeks ago (maybe 5.2.1, but I’m not sure). Beforehand, I always got a stereo buffer in processBlock (), now I get a mono buffer, if no headphone is used. I think this is the correct behaviour, since the iPhone has only one speaker (you may correct me, if this isn’t right). In this case you have the possibility to make your own mono-mix. If headphones are plugged in, the device needs stereo output. It has nothing to do with inputs.