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 | |
parent | 47a1e4d919c564e74268a999eb34ed4e9d88155c (diff) |
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
-rw-r--r-- | help/help_mp-en.h | 3 | ||||
-rw-r--r-- | libao2/ao_sdl.c | 2 | ||||
-rw-r--r-- | mixer.c | 13 |
3 files changed, 13 insertions, 5 deletions
diff --git a/help/help_mp-en.h b/help/help_mp-en.h index 3b4c235155..d35ce46416 100644 --- a/help/help_mp-en.h +++ b/help/help_mp-en.h @@ -368,7 +368,8 @@ static char help_text[]= // 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 ======================== diff --git a/libao2/ao_sdl.c b/libao2/ao_sdl.c index 1f66c7944a..27393b4dd7 100644 --- a/libao2/ao_sdl.c +++ b/libao2/ao_sdl.c @@ -36,7 +36,7 @@ static ao_info_t info = 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 @@ -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; + } + } } } } |