kcat / openal-soft

OpenAL Soft is a software implementation of the OpenAL 3D audio API.
Other
2.22k stars 536 forks source link

Use specific HRTF path #1049

Closed ceski-1 closed 1 month ago

ceski-1 commented 1 month ago

If I understand correctly, the current approach to HRTF enumeration and selection is to follow what's described in the ALC_SOFT_HRTF extension. But this places the burden on the user to configure an alsoft.ini/alsoft.conf file or to locate the default search path, and then manually copy .mhr files there. But what if the application provides its own .mhr files? Is there any way to specify (without using an .ini/.conf) the application's own data path (or on Windows, a subfolder under the .exe location)?

ceski-1 commented 1 month ago

Even if an .ini is created, there's no way to use a path relative to the application directory?

alsoft.ini:

[general]
hrtf-paths = my_relative_folder

alsoft.log:

[ALSOFT] (II) Found hrtf-paths = "my_relative_folder"
[ALSOFT] (II) Searching C:\my_application\*.mhr
[ALSOFT] (II) Searching C:\Users\name\AppData\Roaming\my_relative_folder\*.mhr
[ALSOFT] (II) Searching C:\ProgramData\my_relative_folder\*.mhr
kcat commented 1 month ago

Relative paths in hrtf-paths are treated relative to the AppData\Roaming and ProgramData folders. Beyond that, OpenAL Soft will also search the path specified in the ALSOFT_LOCAL_PATH environment variable (which should preferably be set prior to opening a device, but should be reflected in subsequent enumerations regardless), or the current working directory if that's not set.

ceski-1 commented 1 month ago

Okay, thank you. There's one scenario that can cause problems: If ALSOFT_LOCAL_PATH is set by the application but the user has hrtf-paths set to an absolute path, the application's preference is ignored. There doesn't seem to be a way for the application to override the user/global preference in this case.

kcat commented 1 month ago

Commit eee7eb7d2faa220540cd3be78d6c6020e7ce72a2 changes this to always search ALSOFT_LOCAL_PATH or the current working directory first.

ceski-1 commented 1 month ago

Thanks again.