How is it possible (either with API or with DirectSound) to measure the volume of the sound going into a microphone at any time?

Thanks in advace for any suggestions.