Controllable generation of mixed two-photon states