Rework log system

Replaces all Console.WriteLine entries with a better event-based logging system.
Fix shutdown exception

Fix null reference exception when shutting down the audio plugin before playback started.