Ultrafast electric control of cavity mediated single-photon and photon-pair generation with semiconductor quantum dots