# How (not) to leave class-D amplifier's input hanging

I would like to setup an audio solution for Raspberry Pi Zero that consists of a headphone jack and a speaker. The goal is that sounds will be played through an internal speaker, and when a headphone is connected, the speaker shuts off and sound is switched to the headphone instead.

My design consists of two amplifiers.

The first one, a TDA1308 class-AB headphone amplifier, gets raw signal from the Pi via some filters; the output goes to one of those headphone jacks that has "insertion detection contacts".

When nothing is inserted into the jack, the amplified stereo audio signals get combined to a mono signal and is sent to a second, NS4150 class-D amplifier to drive a 4 Ohm, 2W or 8 Ohm, 1W speaker. (the datasheet for NS4150 is in Chinese. I found this English version, but details may differ.)

Here's my schematics draft for my particular project, built up from application circuits suggested by the two datasheets. RAL and RAR are Raw Audio Left and Raw Audio Right, respectively. Here is a link to that schematics draft.

My problem: when a headphone (or anything that can go into that hole, really) is inserted, pin 3 and 4 of the jack disconnects from 2 and 5, respectively, and my speaker amp's input will be hanging. I do not know if it can handle that. My speaker amp does have a Control pin to shut off itself completely, but I am not positive how to utilize it without messing with the rest of the audio signal. I know that amplifiers are sensitive and testing them on breadboards might not be a good idea (everything here is SMD anyways), so I want to see if I can get a word of wisdom from everyone here.

Run resistors from pins 3 and 4 of the headphone jack to ground. You may need to experiment, but you should be OK with 220$$\\Omega\$$ or so. The idea is that when the jack is unplugged, the resistors won't matter (because the class AB amp is used to lower headphone impedances anyway), and when it's it's plugged in the resistors will act to ground the input to the class D amp.