aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2015-05-16 01:46:06 -0700
committerChris Robinson <[email protected]>2015-05-16 02:18:09 -0700
commit3058205963ee3293341bc7d92061fa18ccae4df8 (patch)
tree7e85b9134e2bbe35c535346b8aafe932abdc32b2 /Alc/ALc.c
parent80f0b5e736eaf4a19b6a0de8666e055816cba043 (diff)
Add a method to reset the device
This basically acts as if the app created a new context with the specified attributes (causing the device to reset with new parameters), then immediately delete it. Existing contexts remain undisturbed, except for a temporary pause while the device output is reconfigured.
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 672c8d61..ba8cb879 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -162,6 +162,8 @@ static const ALCfunction alcFunctions[] = {
DECL(alcGetInteger64vSOFT),
+ DECL(alcResetDeviceSOFT),
+
DECL(alEnable),
DECL(alDisable),
DECL(alIsEnabled),
@@ -3289,6 +3291,42 @@ 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.