make global loop static
add option to limit maximum volume (fixes #25)