Something very weird just happened. I opened up cubase to try that again as I hadn't used it to record audio for a while and it worked fine. I then went back to cakewalk, opened a blank project and tried recording and it worked fine. I opened the project I had been working on and tried recording and it was distorted again. I opened another blank project and tried recording and once again it was distorted.