DirectSound: setting the volume to a percentage

916 views Asked by At

The Volume-Property in the SecondaryBuffer class seems to be strange, because a worth around -4000 is 0%, and 0 is 100%, how can I set the Volume to a precise percentage or get the lowest Volume to do it myself?

1

There are 1 answers

0
Scott M. On

assuming your percentage is a double between 0 and 1 and named volumePercentage:

double adjustedVolume = (1d - volumePercentage) * -4000d;