aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alMain.h1
-rw-r--r--OpenAL32/Include/alu.h1
-rw-r--r--OpenAL32/alSource.c16
3 files changed, 18 insertions, 0 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 782252ba..ca9d8006 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -171,6 +171,7 @@ void alc_pulse_init(BackendFuncs *func_list);
struct ALCdevice_struct
{
+ ALCboolean Connected;
ALboolean IsCaptureDevice;
ALuint Frequency;
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index f2a7b023..4641a698 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -147,6 +147,7 @@ static __inline ALuint aluChannelsFromFormat(ALenum format)
ALvoid aluInitPanning(ALCcontext *Context);
ALvoid aluMixData(ALCcontext *context,ALvoid *buffer,ALsizei size,ALenum format);
+ALvoid aluHandleDisconnect(ALCdevice *device);
#ifdef __cplusplus
}
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 205a1c46..30be074e 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -1347,6 +1347,22 @@ ALAPI ALvoid ALAPIENTRY alSourcePlayv(ALsizei n, const ALuint *pSourceList)
// Check if an Offset has been set
if(pSource->lOffset)
ApplyOffset(pSource, AL_FALSE);
+
+ // If device is disconnected, go right to stopped
+ if(!pContext->Device->Connected)
+ {
+ pSource->state = AL_STOPPED;
+ pSource->inuse = AL_FALSE;
+ pSource->BuffersPlayed = pSource->BuffersInQueue;
+ ALBufferList = pSource->queue;
+ while(ALBufferList != NULL)
+ {
+ ALBufferList->bufferstate = PROCESSED;
+ ALBufferList = ALBufferList->next;
+ }
+ pSource->position = 0;
+ pSource->position_fraction = 0;
+ }
}
else
{