Mercurial > mplayer.hg
changeset 12908:7b9b4f07d2c4
automatic loading of af_volume, original patch by Dan Christiansen (danchr (at) daimi (dot) au (dot) dk)
author | reimar |
---|---|
date | Wed, 28 Jul 2004 12:17:50 +0000 |
parents | 5c88d4c1d9aa |
children | dc8eba991005 |
files | help/help_mp-en.h libao2/ao_sdl.c mixer.c |
diffstat | 3 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/help/help_mp-en.h Wed Jul 28 08:48:08 2004 +0000 +++ b/help/help_mp-en.h Wed Jul 28 12:17:50 2004 +0000 @@ -368,7 +368,8 @@ // x11_common.c #define MSGTR_EwmhFullscreenStateFailed "\nX11: Couldn't send EWMH fullscreen Event!\n" -#define MSGTR_NeedAfVolume "Mixer: This audio output driver needs \"-af volume\" for changing volume.\n" +#define MSGTR_InsertingAfVolume "[Mixer] No hardware mixing, inserting volume filter.\n" +#define MSGTR_NoVolume "[Mixer] No volume control available.\n" // ====================== GUI messages/buttons ========================
--- a/libao2/ao_sdl.c Wed Jul 28 08:48:08 2004 +0000 +++ b/libao2/ao_sdl.c Wed Jul 28 12:17:50 2004 +0000 @@ -36,7 +36,7 @@ LIBAO_EXTERN(sdl) // turn this on if you want to use the slower SDL_MixAudio -#define USE_SDL_INTERNAL_MIXER 1 +#undef USE_SDL_INTERNAL_MIXER // Samplesize used by the SDLlib AudioSpec struct #ifdef WIN32
--- a/mixer.c Wed Jul 28 08:48:08 2004 +0000 +++ b/mixer.c Wed Jul 28 12:17:50 2004 +0000 @@ -28,7 +28,8 @@ 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 @@ 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; + } + } } } }