aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-08-18 14:49:42 -0700
committerChris Robinson <[email protected]>2012-08-18 14:49:42 -0700
commit2b020040b41a8a8a19869263ad2816daad2e1361 (patch)
treea5c7c078201fd4eddb0bf14bd561b64c8c588c4b /Alc
parent3ae5fcbd7e8759b0542a46f20d17cfb5610c5218 (diff)
Keep the backend device open until the last reference is released
This should generally happen with the next ALCdevice_DecRef call unless the device is in the middle of being used in another thread, in which case it's probably best to not remove the resources.
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 0fb87fad..f72122f3 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1686,6 +1686,11 @@ static ALCvoid FreeDevice(ALCdevice *device)
{
TRACE("%p\n", device);
+ if(device->Type != Capture)
+ ALCdevice_ClosePlayback(device);
+ else
+ ALCdevice_CloseCapture(device);
+
if(device->DefaultSlot)
{
ALeffectState_Destroy(device->DefaultSlot->EffectState);
@@ -2856,8 +2861,6 @@ ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *Device)
ALCdevice_StopPlayback(Device);
Device->Flags &= ~DEVICE_RUNNING;
- ALCdevice_ClosePlayback(Device);
-
ALCdevice_DecRef(Device);
return ALC_TRUE;
@@ -2962,8 +2965,6 @@ ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *Device)
*list = (*list)->next;
UnlockLists();
- ALCdevice_CloseCapture(Device);
-
ALCdevice_DecRef(Device);
return ALC_TRUE;