aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2015-10-02 23:54:30 -0700
committerChris Robinson <[email protected]>2015-10-03 19:59:21 -0700
commitaa10068ca20c2241c8d80627a5be3aeb39efcea2 (patch)
treecfe254301c5cb0f93940e790709aaf5f5b96e1ea /Alc
parent0fcd497796639a8af916dcfb0c61c67c1e76c6aa (diff)
Add methods to enumerate and query device HRTFs
Currently just returns a dummy entry.
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c123
1 files changed, 87 insertions, 36 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 77f263ca..b4545696 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -162,6 +162,7 @@ static const ALCfunction alcFunctions[] = {
DECL(alcGetInteger64vSOFT),
+ DECL(alcGetStringiSOFT),
DECL(alcResetDeviceSOFT),
DECL(alEnable),
@@ -389,6 +390,8 @@ static const ALCenums enumeration[] = {
DECL(ALC_HRTF_REQUIRED_SOFT),
DECL(ALC_HRTF_HEADPHONES_DETECTED_SOFT),
DECL(ALC_HRTF_UNSUPPORTED_FORMAT_SOFT),
+ DECL(ALC_NUM_HRTF_SPECIFIER_SOFT),
+ DECL(ALC_HRTF_SPECIFIER_SOFT),
DECL(ALC_NO_ERROR),
DECL(ALC_INVALID_DEVICE),
@@ -2662,6 +2665,17 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para
}
break;
+ case ALC_HRTF_SPECIFIER_SOFT:
+ if(!VerifyDevice(Device))
+ alcSetError(NULL, ALC_INVALID_DEVICE);
+ else
+ {
+ LockLists();
+ value = (Device->Hrtf ? "Preset 0" : "");
+ UnlockLists();
+ }
+ break;
+
default:
Device = VerifyDevice(Device);
alcSetError(Device, ALC_INVALID_ENUM);
@@ -2868,6 +2882,10 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC
values[0] = device->Hrtf_Status;
return 1;
+ case ALC_NUM_HRTF_SPECIFIER_SOFT:
+ values[0] = 1;
+ return 1;
+
default:
alcSetError(device, ALC_INVALID_ENUM);
return 0;
@@ -3279,42 +3297,6 @@ ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice(ALCcontext *Context)
}
-/* alcResetDeviceSOFT
- *
- * Resets the given device output, using the specified attribute list.
- */
-ALC_API ALCboolean ALC_APIENTRY alcResetDeviceSOFT(ALCdevice *device, const ALCint *attribs)
-{
- ALCenum err;
-
- LockLists();
- if(!(device=VerifyDevice(device)) || device->Type == Capture || !device->Connected)
- {
- UnlockLists();
- alcSetError(device, ALC_INVALID_DEVICE);
- if(device) ALCdevice_DecRef(device);
- return ALC_FALSE;
- }
-
- if((err=UpdateDeviceParams(device, attribs)) != ALC_NO_ERROR)
- {
- UnlockLists();
- alcSetError(device, err);
- if(err == ALC_INVALID_DEVICE)
- {
- V0(device->Backend,lock)();
- aluHandleDisconnect(device);
- V0(device->Backend,unlock)();
- }
- ALCdevice_DecRef(device);
- return ALC_FALSE;
- }
- UnlockLists();
- ALCdevice_DecRef(device);
-
- return ALC_TRUE;
-}
-
/* alcOpenDevice
*
* Opens the named device.
@@ -3982,3 +3964,72 @@ ALC_API void ALC_APIENTRY alcDeviceResumeSOFT(ALCdevice *device)
}
if(device) ALCdevice_DecRef(device);
}
+
+
+/************************************************
+ * ALC HRTF functions
+ ************************************************/
+
+/* alcGetStringiSOFT
+ *
+ * Gets a string parameter at the given index.
+ */
+ALC_API const ALCchar* ALC_APIENTRY alcGetStringiSOFT(ALCdevice *device, ALenum paramName, ALsizei index)
+{
+ const ALCchar *str = NULL;
+
+ if(!(device=VerifyDevice(device)) || device->Type == Capture)
+ alcSetError(device, ALC_INVALID_DEVICE);
+ else switch(paramName)
+ {
+ case ALC_HRTF_SPECIFIER_SOFT:
+ if(index < 0 || index > 0)
+ alcSetError(device, ALC_INVALID_VALUE);
+ else
+ str = "Preset 0";
+ break;
+
+ default:
+ alcSetError(device, ALC_INVALID_ENUM);
+ break;
+ }
+ if(device) ALCdevice_DecRef(device);
+
+ return str;
+}
+
+/* alcResetDeviceSOFT
+ *
+ * Resets the given device output, using the specified attribute list.
+ */
+ALC_API ALCboolean ALC_APIENTRY alcResetDeviceSOFT(ALCdevice *device, const ALCint *attribs)
+{
+ ALCenum err;
+
+ LockLists();
+ if(!(device=VerifyDevice(device)) || device->Type == Capture || !device->Connected)
+ {
+ UnlockLists();
+ alcSetError(device, ALC_INVALID_DEVICE);
+ if(device) ALCdevice_DecRef(device);
+ return ALC_FALSE;
+ }
+
+ if((err=UpdateDeviceParams(device, attribs)) != ALC_NO_ERROR)
+ {
+ UnlockLists();
+ alcSetError(device, err);
+ if(err == ALC_INVALID_DEVICE)
+ {
+ V0(device->Backend,lock)();
+ aluHandleDisconnect(device);
+ V0(device->Backend,unlock)();
+ }
+ ALCdevice_DecRef(device);
+ return ALC_FALSE;
+ }
+ UnlockLists();
+ ALCdevice_DecRef(device);
+
+ return ALC_TRUE;
+}