An adaptive integration scheme for irregularly oscillatory functions