Rewrote SDL sound synchronization, using a very old patch as a base for some of the changes