Class D amplifier with DSP