Use correct buffer pointer
alsa: fix drain behaviour

This fixes two issues when calling snd_pcm_drain.

1) snd_pcm_drain allows for non-blocking operation, so we need make sure either the pcm handle is in blocking mode or add our own blocking loop.

2) snd_pcm_drain doesn't work with frames, but rather with periods. It can't wait for partial filled periods, so we need to zero fill any unwritten frames in period to avoid any sound distortion (caused by uninitialized buffer data or previously written frames).