MultiChannel Audio

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
jeffmikels
Prole
Posts: 5
Joined: Thu Oct 15, 2015 9:26 pm

MultiChannel Audio

Post 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?
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: MultiChannel Audio

Post 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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
pgimeno
Party member
Posts: 3549
Joined: Sun Oct 18, 2015 2:58 pm

Re: MultiChannel Audio

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 63 guests