summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan <etircopyhdot@gmail.com>2021-11-20 01:17:01 +0200
committersfan5 <sfan5@live.de>2021-11-29 11:27:39 +0100
commit87ce3b31a92a9bd0b4c4406113586696dc573f2a (patch)
treee500368cafef1c2b69a5ca182e0d932271413300
parentac39af461d5b7763f7285c28a998c1c3e3ec9f73 (diff)
downloadmpv-87ce3b31a92a9bd0b4c4406113586696dc573f2a.tar.bz2
mpv-87ce3b31a92a9bd0b4c4406113586696dc573f2a.tar.xz
ao_openal: enable AL_SOFT_direct_channels_remix extension by default
Prevent audio distortions caused by OpenAL's 3D effects.
-rw-r--r--DOCS/man/ao.rst4
-rw-r--r--audio/out/ao_openal.c12
2 files changed, 10 insertions, 6 deletions
diff --git a/DOCS/man/ao.rst b/DOCS/man/ao.rst
index e5cc9f963d..cc4cea0036 100644
--- a/DOCS/man/ao.rst
+++ b/DOCS/man/ao.rst
@@ -112,9 +112,7 @@ Available audio output drivers are:
``--openal-direct-channels=<yes|no>``
Enable OpenAL Soft's direct channel extension when available to avoid
- tinting the sound with ambisonics or HRTF.
- Channels are dropped when when they are not available as downmixing
- will be disabled. Default: no.
+ tinting the sound with ambisonics or HRTF. Default: yes.
``pulse``
PulseAudio audio output driver
diff --git a/audio/out/ao_openal.c b/audio/out/ao_openal.c
index ca36230ea2..6b2e3bc176 100644
--- a/audio/out/ao_openal.c
+++ b/audio/out/ao_openal.c
@@ -199,8 +199,14 @@ static int init(struct ao *ao)
alListenerfv(AL_ORIENTATION, direction);
alGenSources(1, &source);
- if (p->direct_channels && alGetEnumValue((ALchar*)"AL_DIRECT_CHANNELS_SOFT")) {
- alSourcei(source, alGetEnumValue((ALchar*)"AL_DIRECT_CHANNELS_SOFT"), AL_TRUE);
+ if (p->direct_channels) {
+ if (alIsExtensionPresent("AL_SOFT_direct_channels_remix")) {
+ alSourcei(source,
+ alGetEnumValue((ALchar*)"AL_DIRECT_CHANNELS_SOFT"),
+ alcGetEnumValue(dev, "AL_REMIX_UNMATCHED_SOFT"));
+ } else {
+ MP_WARN(ao, "Direct channels aren't supported by this version of OpenAL\n");
+ }
}
cur_buf = 0;
@@ -385,7 +391,7 @@ const struct ao_driver audio_out_openal = {
.priv_defaults = &(const struct priv) {
.num_buffers = 4,
.num_samples = 8192,
- .direct_channels = 0,
+ .direct_channels = 1,
},
.options = (const struct m_option[]) {
{"num-buffers", OPT_INT(num_buffers), M_RANGE(2, MAX_BUF)},