Open lilmike opened 3 years ago
First, you need to create your alsoftrc.ini file, then set environment variable ALSOFT_CONF
to point to absolute, OS-dependent path of the alsoftrc.ini (love.filesystem.getSaveDirectory().."/alsoftrc.ini"
for example).
You need to do that before the love.audio
module is loaded. Either by delay-load it by t.modules.audio = false
at conf.lua
then require("love.audio")
at main.lua
or do everything in love.conf
.
The relevant HRTF setting can be found at https://github.com/kcat/openal-soft/blob/openal-soft-1.19.1/alsoftrc.sample#L122-L133
I quickly sketched out support for the OpenAL ALC_HRTF_SOFT
extension here. It enables HRTFs when supported and adds love.audio.isSpatialized
to check if audio is being spatialized with HRTFs. It has some serious flaws in its current state:
isSpatialized
name is bad and could be confused with panning-based spatialization. Feel free to bikeshed it.Solutions to the first issue could include adding a conf.lua
flag (wasn't sure how to plumb this through so I didn't do it) and/or love.audio.setSpatializationEnabled
(this would require resetting the device which may not be desirable).
That sounds nice. I would like to mention, however, that you can load a different hrtf file at runtime. This could be used, for example, to allow users to hear an example of the hrtf using the game, and then pick their prefered one which would then be loaded. Just food for thought. -Michael.
-- Michael Taboada, Creator of Games. Does that make me a god, well, sorta. My pgp key: 79BC390E8864CD71305D4DD606CD2197A6EE5ED7 My website: https://michaels.world 2MB website: https://2mb.games Don't believe everything you read on the internet. I might not be real, you might not be real, and this email certainly isn't real. Sent from my hall closet... stationary bicycle
I found this issue while planning to request hrtf support, and I'm wondering if there's been any more interest or work on this? I'd like to use hrtf in some games, and I would ideally have the following features:
Let me know if there's anything I can do to test or anything else. I know I've got some c++ code for this very purpose in my game-kit collection of c++ stuff, maybe it could be a good reference: https://git.2mb.codes/~lilmike/game-kit (under the allegro-stuff/sound3d folder) doesn't require allegro, not sure why I put it there...
-Michael.
I'd like to request hrtf support using openAL in love.audio. The usage for this feature for me is that I plan to write mostly audio specific games, and without hrtf support openAL doesn't do a good job of placing sounds behind versus in front of the user (especially when the user cannot see what's on screen or there is intensionally nothing on screen to begin with which is often true of audio only games). If I remember correctly there is a quick code snippet on the openAL site, or it might have been in the mailing list, but changing hrtf settings in code didn't seem that hard last time I looked at it. Let me know if I can help anyway with this issue, or if I'm missing something. Thanks! -Michael.