Fix device entry number: should be 1-based instead of 0

According to MultiAudio specs audio device entries should be 1-based but
0-based.
Some cleaanup and refactoring. No functional changes.