Laptop closed -> microphone cut off does not need complex logic. It's just simple switch.
Do you have schematics of your laptop?