Fix sound (issues #1, #2, #3, #4)

I combed through the code, compared with the reference implementation, and corrected some small mistakes. I believe sfxrlua now sounds pretty much identical to vanilla sfxr, except for the volume level. You can test this with my other patch to read binary sfxr files.