mirror of
https://github.com/mpv-player/mpv
synced 2025-01-21 23:23:19 +00:00
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
This commit is contained in:
parent
47a1e4d919
commit
bb98df0456
@ -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 ========================
|
||||
|
||||
|
@ -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
|
||||
|
13
mixer.c
13
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user