====
**Bug Fixes and Enhancements**
* Fix a bug calculating the instantaneous synchronisation error. This could occasionally cause Shairport Sync to lose synchronisation and maybe even to mute for a few seconds before regaining it. It was caused by not doing modulo arithmetic properly, and it's been there for a while.
-* Clean up some other uses of modulo arithmetic.
* Clean up and improve the code to synchronise the first frame of audio. This should result in more accurate and reliable initial synchrnoisation, certainly to under a millisecond in normal usage. Sync should improve even when the silent lead-in time is as short as 0.3 seconds or when the `audio_backend_latency_offset_in_seconds` is as much as -1.7 seconds.
* Removed a bug which would affect initial synchronisation if a flush command was received from the player at an inopportune time.
+* Clean up some other uses of modulo arithmetic.
+* Clean up allocation of memory for gathering running statistics -- use the heap instead of the stack.
Version 3.3.7d5
====