Page 1 of 1

MultiChannel Audio

Posted: Sat Dec 22, 2018 5:26 pm
by jeffmikels
Hey everyone.

Love is by far the easiest way I have found to make little games and simple GUI apps that work the way you expect.

Currently, I'm working on a music app and I want to be able to tell the app which speaker to use when playing the metronome click sound. However, LÖVE is currently not able to either use multichannel audio files or to control which speaker plays the click in a multichannel setup. For my purposes, I want to play the audio on channel 3 of a 4 channel system.

Is there a lua library or some other method of playing audio on channels 3 and 4?

Re: MultiChannel Audio

Posted: Sat Dec 22, 2018 7:16 pm
by zorg
Löve uses OpenAlSoft, and currently only... how should i say this, "exposes support?" for mono and stereo, that is, 1 and 2 channel audio files and playback. (and somewhat related, 8 and 16 bit integer playback formats only as well, no 24bit integer or 32bit float).

As far as i know, OALS actually supports way more than what Löve is exposing, or what it was built with, if it depends on compile-time switches what get included... or if it even uses the latest release of it; since those include way more effect types than the current effect objects expose.

To be honest, i'm not sure since i haven't tested it, but if it's actually built into the lib, one might expose such functionality with luajit's ffi interface, but it's not simple; one of the forumgoers actually did a similar thing, by manually exposing the queuing capabilities in löve's 0.10 version (when it wasn't included by default), and the code was very involved.

Re: MultiChannel Audio

Posted: Sat Dec 22, 2018 10:39 pm
by pgimeno
zorg wrote: Sat Dec 22, 2018 7:16 pm To be honest, i'm not sure since i haven't tested it, but if it's actually built into the lib, one might expose such functionality with luajit's ffi interface, but it's not simple; one of the forumgoers actually did a similar thing, by manually exposing the queuing capabilities in löve's 0.10 version (when it wasn't included by default), and the code was very involved.
I'd say quite the opposite, the code is quite straightforward.
https://github.com/LPGhatguy/love-microphone

openal.lua is basically the OpenAL headers in FFI format, so that work is already done. QueueableSource.lua does a bit of buffer management and a bit of OOP management, but most functions are calls to the API and just a bit of housekeeping, and it's easy to read as an example of how to handle FFI calls to OpenAL.

Device.lua is more involved. but it has to do with microphone only.

Without looking into how easy or hard it would be, this sounds like something worth trying.