that's ugly here: passing a reference down over several function calls where it gets changed. I just cleaned this style out of alsa.