diff options
author | LAGonauta <lagonauta@gmail.com> | 2018-03-28 10:33:38 -0300 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2018-04-15 00:57:01 +0300 |
commit | dd357a7d53aba4a8146fb466251aed162f68785a (patch) | |
tree | 49f00012b87d333058fc2517be5c7950c422fee3 /audio/out/ao_openal.c | |
parent | abaab930f005d84196dc33ec14dbd128a9f6ba5c (diff) | |
download | mpv-dd357a7d53aba4a8146fb466251aed162f68785a.tar.bz2 mpv-dd357a7d53aba4a8146fb466251aed162f68785a.tar.xz |
ao/openal: Add support for direct channels output
Uses OpenAL Soft's AL_DIRECT_CHANNELS_SOFT extension and can be controlled through
a new CLI option, --openal-direct-channels.
This allows one to send the audio data direrctly to the desired channel without
effects applied.
Diffstat (limited to 'audio/out/ao_openal.c')
-rw-r--r-- | audio/out/ao_openal.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/audio/out/ao_openal.c b/audio/out/ao_openal.c index 3638bbabbd..ab61c80763 100644 --- a/audio/out/ao_openal.c +++ b/audio/out/ao_openal.c @@ -70,6 +70,7 @@ static struct ao *ao_data; struct priv { ALenum al_format; int chunk_size; + int direct_channels; }; static void reset(struct ao *ao); @@ -308,6 +309,10 @@ 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); + } + cur_buf = 0; unqueue_buf = 0; alGenBuffers(NUM_BUF, buffers); @@ -449,4 +454,9 @@ const struct ao_driver audio_out_openal = { .reset = reset, .drain = drain, .priv_size = sizeof(struct priv), + .options = (const struct m_option[]) { + OPT_FLAG("direct-channels", direct_channels, 0), + {0} + }, + .options_prefix = "openal", }; |