Trying to thread

Hey so remember this thing you wrote? Well I tried to thread it but only with minimal success. 
Basically I added in pausing, and it works *sometimes*, but the sound gets distorted after you pause and resume. 

I feel like there's still a race condition somewhere? Or maybe it has to do with the fact that I'm polling (i.e. while looping) in both the pauser thread and the ncurses player thread, which I feel like isn't too good for performace, but I wouldn't know how else to poll for user input and poll for pausing. 

Anyway take a look if you have time. I've never done any sort of programming with mutexes or pthreads so sorry 'bout the messiness if there is any.