There's a bit more refinement needed than that as, to avoid waveform distortion due to runt pulses, you need to switch the mux at the carrier zero crossings. If the phase shift due to the low pass filter is carefully controlled, you can make it work if you control the mux from within an ISR off the PWM timebase, so its locked to the carrier phase, but if you use an external carrier, or your filter's phase shift cant be tuned to get an interrupt coincident with the zero crossing, you'll need to add a comparator to square up the carrier to feed to an external interrupt pin, so you can get an interrupt when youi need it.