Fixes a deadlock which leads to loss of audio.
Applies formatting.
Avoids automatic boxing and unboxing in the handling of audio levels.