Vout is an analog level, and you're connecting it to a digital logic gate -- seems like you need some sort of
analog to digital converter! A one-bit ADC is also known as... a comparator.
D latch isn't what you want: Q is only updated when CLK is high, and remains in its previous state when CLK is low. But a latch is the right idea. If the input is always pulsing on and off, then you can use a D-f/f where the MCU drives CLK, D is wired to +1, and RST is wired to the comparator. Thus, it turns on (CLKs in a fresh '1') until the comparator says off.
Of course, you need the RST OR'd with /CLK, so it turns off when CLK is low!
This can also be done with a handful of gates, in a feedback configuration. It's sort of like a clocked AND gate.
If you run the amplifier much faster than 30kHz, you can do proper class D PWM, like an audio amp would. Even if you keep it at 30kHz, you can control the pulse width (if the MCU has the right hardware, otherwise you can use an analog IC like a TL494), and use that to control average current.
Since the output is AC, why not consider a current transformer (CT)? More accurate, faster, quieter and cheaper (sometimes) than a Hall effect sensor. This has the advantage that you only need the one sensor for both switch polarities: just connect the CT to a FWB (use 1N4148 or BAV99 or BAT54S or..), to the burden resistor.
Tim