dingux-sdl: Provide better synchronisation with audio.

* Pause for a bit if there is too much audio in the dingux-sdl internal ring buffer. This keeps the audio lag in check (up to 3 frame times: 50 ms in NTSC, or 60 ms in PAL).
* Prevent underruns by requiring one SDL buffer's worth of audio to be in the internal ring buffer (at least 1 frame: 16 ms in NTSC, 20 ms in PAL).
* Synchronise on the audio instead of the clock. With the PAL option correctly set, this allows PAL games to run at 50 FPS as expected, and avoids odd time warps when returning from the menu or when NTP is synchronising the time.
dingux-sdl: Use a smaller internal ring buffer for audio.

In addition to tying up less RAM, this makes more of the audio buffer coexist in the data cache with other things.
dingux-sdl: Support triple-buffering with SDL_TRIPLEBUF.

Caveats:
* The video mode must only be set once.
* SDL_FreeSurface must not be used against the SDL_Surface gotten from SDL_SetVideoMode.
* dingoo_clear_video is augmented to clear the image three times if needed.
Fix null pointer dereferences caused by continuing to emulate a game that has been freed when exiting the emulator.