Jump to content
  • Advertisement
Sign in to follow this  

DirectMusic audiopath volume control

This topic is 4633 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!