Analog signal detection
What you are looking for is often called a "ducker" in DJ applications or a "VOX" (voice) switch in 2-way radio applications.

Since your B signal is fed onto the same line you can't tell by monitoring the mixed line alone. You might get it to work by monitoring the difference between the B input and the mixed line and switching if they differ (due to A turning on).

The right way to do it is to buffer signal A and monitor the A signal before the buffer and feed this into the ducker circuit.

Links:


Lower sound from 1st input when second input has sound.










simulate this circuit &ndash; Schematic created using CircuitLab

Figure 1. One channel of a channel A priority circuit.

This isn't a full design but may prompt you to figure out a solution.

How it works:


OA1 is a differential amplifier. If R1 = R2 and R3 = R4 then


$$ V_{OUT} = \frac {-R_3}{R_1} (V_B - V_A) $$


You would need to get the gains matched (and R5 is a liability in managing this) so a pot may be required somewhere.
If \$ V_A = V_B \$ then A is silent and only B is active. \$ V_{OUT} = 0 \$ or close to it.
If \$ V_A \neq V_B \$ then there must be signal on A. \$ V_{OUT} \neq 0 \$ and the difference signal can be used to trigger CMP1. Its output will switch. This can be used to disconnect SW1. (Circuit left to OP.)
R7 is included as a reminder to check the comparitor data sheet. Some have open-collector outputs and require a pull-up.