* Remove dependency on SDL.h where possible
* Use run-time linking where possible
* Support both SDL 1.2 and SDL 2
* Add device enumeration when using SDL 2
The Emscripten build currently uses SDL 1.2 because it avoids the need
for "-s USE_SDL=2" when compiling. This may change later if there's
ever a need or if there's enough demand.
Rationale:
1) It allows the callbacks to be set at initialization time which feels
a bit more intuitive to me.
2) It avoids the need to call mal_device_set_send_callback(), etc.
3) It's a bit more consistent with the onLog callback. Previously,
onLog would be passed to mal_device_init(), whereas onSend, etc were
set with mal_device_set_send_callback(), etc. which feels needlessly
inconsistent.
- Use binary semaphores as the synchronization primitive for the worker thread
- Generalize the worker thread so as to avoid having different worker thread
for each backend.
- Make state changes atomic
General improvements bug fixing:
- Fix an error where the DirectSound backend would immediately send the
application a bunch of invalid audio data.
- Have the ALSA backend request more audio data only immediately before it's
ready to write it to the device.
- General improvements on documentation.
- Update readme.