//LPDIRECTSOUNDBUFFER如何设置声音大小?》
//取值范围是0 ~ -10000, 0最大,-10000最小,单位是分贝
//0-100音量转换成分贝
double decibels;
DWORD dsVol;
if (lVolume <= 0) {
dsVol = DSBVOLUME_MIN;
} else if (lVolume >= 100) {
dsVol = DSBVOLUME_MAX;
} else {
decibels = 20.0 * log10((double)lVolume / 100.0);
dsVol = (DWORD)(decibels * 100.0);
}
//dsVol是以db为单位的-10000 - 0 的值,可传递给DSound设置音量。