Mac Book Retina audio crackles after sleep and fix

Of cause, this sounds more like an apple bug, but here is a workaround

I realized when i awake my new macbook pro from sleep, the first audio app in rare cases (20%) will create audio-crackles...

This can be fixed be simply resetting the audio-device

 

  deviceManager->closeAudioDevice();

  deviceManager->restartLastAudioDevice();

just realized, it doesn't help if you reset it directly after initialisation, it must be triggerd a few seconds later