hrtf working example

working example of hrtf set the pref usehrtf to true to test
For now any mhr file that is in the game directory can be used, just run once to get the index of that mhr and pass that index in to $pref::SFX::hrtfProfile
This commit is contained in:
marauder2k7 2026-05-09 12:02:01 +01:00
parent 345ce3f1d3
commit bcde183786
3 changed files with 32 additions and 0 deletions

View file

@ -352,6 +352,30 @@ void SFXALDevice::printALInfo(ALCdevice* device)
for (ALCint i = 0; i < profileCount; i++)
Con::printf("| [%d] %s", i,
alcGetStringiSOFT(device, ALC_HRTF_SPECIFIER_SOFT, i));
bool use_hrtf = Con::getBoolVariable("$pref::SFX::useHRTF");
if (use_hrtf && (mCaps & CAPS_HotReconnect))
{
ALCint attr[5];
ALCint index = Con::getIntVariable("$pref::SFX::hrtfProfile");
ALCint i;
i = 0;
attr[i++] = ALC_HRTF_SOFT;
attr[i++] = ALC_TRUE;
// load the default device hrtf.
if (index >= 0 && index < profileCount)
{
attr[i++] = ALC_HRTF_ID_SOFT;
attr[i++] = index;
}
attr[i] = 0;
if (!alcResetDeviceSOFT(mDevice, attr))
{
Con::printf("Failed to reset device: %s", alcGetString(mDevice, alcGetError(mDevice)));
}
}
}
// --- EFX ---