It would work well just to use the inverse value of the out fading value:
auto gain = smoother.getNextValue();
sample = gain * endingSound;
sample += (1.0 - gain) * startingSound;
just one of many solutions… another would be to have a SmoothedValue for each, in case it is not always the same length for fading out and fading in.