From dd357a7d53aba4a8146fb466251aed162f68785a Mon Sep 17 00:00:00 2001 From: LAGonauta Date: Wed, 28 Mar 2018 10:33:38 -0300 Subject: 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. --- audio/out/ao_openal.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'audio/out/ao_openal.c') 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", }; -- cgit v1.2.3