diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-07-28 12:17:50 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-07-28 12:17:50 +0000 |
commit | bb98df04568d08d07bde9857c94aa3d5cf726b3a (patch) | |
tree | a03b2a6fbd260d3263b2a20c7aec0ec73c21019f /mixer.c | |
parent | 47a1e4d919c564e74268a999eb34ed4e9d88155c (diff) | |
download | mpv-bb98df04568d08d07bde9857c94aa3d5cf726b3a.tar.bz2 mpv-bb98df04568d08d07bde9857c94aa3d5cf726b3a.tar.xz |
automatic loading of af_volume, original patch by Dan Christiansen (danchr (at) daimi (dot) au (dot) dk)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12909 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mixer.c')
-rw-r--r-- | mixer.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -28,7 +28,8 @@ void mixer_getvolume(mixer_t *mixer, float *l, float *r) float db_vals[AF_NCH]; if (!af_control_any_rev(mixer->afilter, AF_CONTROL_VOLUME_LEVEL | AF_CONTROL_GET, db_vals)) - return; + db_vals[0] = db_vals[1] = 1.0; + else af_from_dB (2, db_vals, db_vals, 20.0, -200.0, 60.0); vol.left = db_vals[0] * 90.0; vol.right = db_vals[1] * 90.0; @@ -61,8 +62,14 @@ void mixer_setvolume(mixer_t *mixer, float l, float r) af_to_dB (AF_NCH, db_vals, db_vals, 20.0); if (!af_control_any_rev(mixer->afilter, AF_CONTROL_VOLUME_LEVEL | AF_CONTROL_SET, db_vals)) { - mp_msg(MSGT_GLOBAL, MSGL_HINT, MSGTR_NeedAfVolume); - return; + mp_msg(MSGT_GLOBAL, MSGL_INFO, MSGTR_InsertingAfVolume); + if (af_add(mixer->afilter, "volume")) { + if (!af_control_any_rev(mixer->afilter, + AF_CONTROL_VOLUME_LEVEL | AF_CONTROL_SET, db_vals)) { + mp_msg(MSGT_GLOBAL, MSGL_ERR, MSGTR_NoVolume); + return; + } + } } } } |