Sign in to follow this  

DirectMusic audiopath volume control

Recommended Posts

Having spent all day attempting to implement a proper (linear) volume control slider in a game I'm working on, and having met with repeated failure, I figured I'd let out a cry for help. :) Problem: Setting the volume level of a DirectMusic (DX 9) audio path object so that it at least semi-accurately corresponds to a linear, percentage based scale (ie. 0% - 100%). Details: There are two methods available to control audio path volume levels. One is to use the SetVolume() command on the audio path object itself and the other is send a volume curve performance message. The SetVolume() function takes a decibel volume argument in the range of -9600 (-96 dB) to 0 (0 dB). The performance message option takes a 7-bit value where 0 corresponds to -96 dB and 127 to 0 dB. Both of these ranges are of course dampening modifiers to master volume level (ie. 0 dB equals "no modification" while -96 dB equals "reduced to a point beyond human hearing"). The problem I've encountered while trying to map a linear volume value to its appropriate logarithmic counterpart is that none of the conversion formulas I've tried sound right throughout the entire scale. For instance, while several formulas resulted in a decent mapping of say 50% volume, they'd break down horribly at other parts of the scale (ie. 75% would be nearly indistinguishable from 100% while 25% would sound more like 5% or vice versa). I'm really hoping that somebody here has a ready made conversion formula that works with either of the DirectMusic volume ranges, or at least works well enough so that the average human ear is sufficiently fooled by it. ^_^

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this