开发者

DirectSound: setting the volume to a percentage

开发者 https://www.devze.com 2023-02-12 19:09 出处:网络
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 lo

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?


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

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号