Clean up whitespace
Switch to clang
Add check for playback state buffer type and use SO_REUSEADDR