ao/wasapi: improve error messages and add more debug statements

also enforce more consistency in the exit codes and error handling

thanks to Jonathan Yong <10walls@gmail.com>
ao/wasapi: tidy up better on failure

Before, failures, particularly in the thread loop init, could lead to a
bad state for the duration of mpvs execution. Make sure that
everything that was initialized gets properly and safely
uninitialized.
ao/wasapi: fix possible null dereference of pDevice

IMMDeviceEnumerator::GetDefaultAudioEndpoint may set pDevice to null on failure.

http://msdn.microsoft.com/en-us/library/windows/desktop/dd371401%28v=vs.85%29.aspx
ao/wasapi: put loading of default device in it's own function
ao/wasapi: look for "multimedia" default device instead of "console"

console is more for system notifications / voice command, mpv is most certainly multimedia

http://msdn.microsoft.com/en-us/library/windows/desktop/dd370842%28v=vs.85%29.aspx
ao/wasapi: new wasapi device monitoring interface

Implement skeleton IMMNotificationClient to watch for changes in the
sound device.  This will make recovery possible from changes shared
mode sample rate, bit depth, "enhancements"/effects and even graceful
device removal.

http://msdn.microsoft.com/en-us/library/windows/desktop/dd371417%28v=vs.85%29.aspx

Signed-off-by: Kevin Mitchell <kevmitch@gmail.com>
ao/wasapi: add convenience functions for change notifiy
ao/wasapi: request reset on appropriate events

on changes to PKEY_AudioEngine_DeviceFormat, device status, and default device.
call ao_reload directly in the change_notify "methods".

this requires keeping a device enumerator around for the duration of
execution, rather than just for initially querying devices
ao/wasapi: add retry loop on AUDCLNT_E_DEVICE_IN_USE

this works around reinitializing too fast on device property changes
ao/wasapi: request ao reload on thread_feed failures

Even with change notifications, there are still (rare) cases when the
feed thread gets AUDCLIENT_DEVICE_INVALIDATED. So handle failures in
thread_feed by requesting ao_reload.