Saturday, 30 November 2019

Distinguish between lightning connector and 3.5mm headphone jack on iOS

I am doing some precise measurement of audio signals on iOS using the earphones.

The audio signals vary quite significantly depending on whether the earphones are plugged into the device's 3.5mm headphone-jack or the lightning connector (the lightning includes its own ADC/DAC unit I believe).

I am therefore looking for a way to determine which port the headphones are plugged in to – lightning or headphone-jack.

When inspecting the types of the current route's output port for both connections, they both return AVAudioSessionPortHeadphones, which doesn't quite give me the granularity I need.

for (AVAudioSessionPortDescription *outputPort in [currentRoute outputs])
{
    if ([[outputPort portType] isEqualToString:AVAudioSessionPortHeadphones])
    {
        ...
    }
}

Does anyone know of a way to determine which port the AVAudioSessionPortHeadphones are connected to?

Thanks, Andy.



from Distinguish between lightning connector and 3.5mm headphone jack on iOS

No comments:

Post a Comment