Refactor audio.c
Fixes leaks in atomic ring buffer

See #54