summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--help/help_mp-en.h3
-rw-r--r--libao2/ao_sdl.c2
-rw-r--r--mixer.c13
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
diff --git a/mixer.c b/mixer.c
index e489b5a83e..388aadb2b3 100644
--- a/mixer.c
+++ b/mixer.c
@@ -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;
+ }
+ }
}
}
}