summaryrefslogtreecommitdiffstats
path: root/libao2/ao_dsound.c
diff options
context:
space:
mode:
authorjoey <joey@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-11-11 03:07:01 +0000
committerjoey <joey@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-11-11 03:07:01 +0000
commit35d096244484436649fc973a4698a33badd0c693 (patch)
treef4264aa7f2febcb84cec7c0275911b274f7f17ad /libao2/ao_dsound.c
parent8572f14094cf62da9bb6d89dbcc3a7a23a66c06b (diff)
downloadmpv-35d096244484436649fc973a4698a33badd0c693.tar.bz2
mpv-35d096244484436649fc973a4698a33badd0c693.tar.xz
DirectSound's GetVolume and SetVolume use 100ths of decibels and range from -10,000 to 0.
MPlayer uses a linear intensity value between 0.0 and 100.0. This patch converts the values properly rather than simply linearly mapping the range. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16973 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2/ao_dsound.c')
-rw-r--r--libao2/ao_dsound.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libao2/ao_dsound.c b/libao2/ao_dsound.c
index d8e743e3a1..2e374fb722 100644
--- a/libao2/ao_dsound.c
+++ b/libao2/ao_dsound.c
@@ -27,6 +27,7 @@
#include <windows.h>
#define DIRECTSOUND_VERSION 0x0600
#include <dsound.h>
+#include <math.h>
#include "config.h"
#include "libaf/af_format.h"
@@ -389,13 +390,13 @@ static int control(int cmd, void *arg)
case AOCONTROL_GET_VOLUME: {
ao_control_vol_t* vol = (ao_control_vol_t*)arg;
IDirectSoundBuffer_GetVolume(hdsbuf, &volume);
- vol->left = vol->right = (float)(volume+10000) / 100.0;
+ vol->left = vol->right = pow(10.0, (float)(volume+10000) / 5000.0);
//printf("ao_dsound: volume: %f\n",vol->left);
return CONTROL_OK;
}
case AOCONTROL_SET_VOLUME: {
ao_control_vol_t* vol = (ao_control_vol_t*)arg;
- volume = (vol->right * 100.0)-10000;
+ volume = (DWORD)(log10(vol->right) * 5000.0) - 10000;
IDirectSoundBuffer_SetVolume(hdsbuf, volume);
//printf("ao_dsound: volume: %f\n",vol->left);
return CONTROL_OK;