aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-08-26 19:15:17 -0700
committerChris Robinson <[email protected]>2009-08-26 19:15:17 -0700
commit7976de05a54fb84c575723d77465308e49c9a258 (patch)
tree5ea263be25c5bcafbc06a29e5c04ebf4e5a7a56d /Alc/ALu.c
parent70c88879abaa7f4946dc009770bf23fab3f2ee48 (diff)
Add base support for ALC_EXT_disconnect
Individual backends need to be updated to handle disconnection events
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index ba45f67f..cafc3174 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1385,3 +1385,39 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma
ProcessContext(ALContext);
}
+
+ALvoid aluHandleDisconnect(ALCdevice *device)
+{
+ if(!device->IsCaptureDevice)
+ {
+ ALsource *source = NULL;
+
+ SuspendContext(device->Context);
+ if(device->Context)
+ source = device->Context->Source;
+
+ while(source)
+ {
+ if(source->state == AL_PLAYING)
+ {
+ ALbufferlistitem *BufferListItem;
+
+ source->state = AL_STOPPED;
+ source->inuse = AL_FALSE;
+ source->BuffersPlayed = source->BuffersInQueue;
+ BufferListItem = source->queue;
+ while(BufferListItem != NULL)
+ {
+ BufferListItem->bufferstate = PROCESSED;
+ BufferListItem = BufferListItem->next;
+ }
+ source->position = 0;
+ source->position_fraction = 0;
+ }
+ source = source->next;
+ }
+ ProcessContext(device->Context);
+ }
+
+ device->Connected = ALC_FALSE;
+}