added master volume to dsp and fixed some potential threading bugs