aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c17
-rw-r--r--Alc/inprogext.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 8d2e5727..2a89f455 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -38,6 +38,7 @@
#include "uhjfilter.h"
#include "bformatdec.h"
#include "static_assert.h"
+#include "ringbuffer.h"
#include "fpu_modes.h"
#include "cpu_caps.h"
@@ -1859,6 +1860,22 @@ void aluHandleDisconnect(ALCdevice *device)
while(ctx)
{
ALsizei i;
+
+ if((ATOMIC_LOAD(&ctx->EnabledEvts, almemory_order_acquire)&EventType_Disconnected))
+ {
+ AsyncEvent evt;
+ evt.EnumType = EventType_Disconnected;
+ evt.Type = AL_EVENT_TYPE_DISCONNECTED_SOFT;
+ evt.ObjectId = 0;
+ evt.Param = 0;
+ strcpy(evt.Message, "Device disconnected");
+ if(ll_ringbuffer_write_space(ctx->AsyncEvents) > 0)
+ {
+ ll_ringbuffer_write(ctx->AsyncEvents, (const char*)&evt, 1);
+ alsem_post(&ctx->EventSem);
+ }
+ }
+
for(i = 0;i < ctx->VoiceCount;i++)
{
ALvoice *voice = ctx->Voices[i];
diff --git a/Alc/inprogext.h b/Alc/inprogext.h
index 721f2370..619b604f 100644
--- a/Alc/inprogext.h
+++ b/Alc/inprogext.h
@@ -56,6 +56,7 @@ AL_API void AL_APIENTRY alFlushMappedBufferSOFT(ALuint buffer, ALsizei offset, A
#define AL_EVENT_TYPE_ERROR_SOFT 0x1224
#define AL_EVENT_TYPE_PERFORMANCE_SOFT 0x1225
#define AL_EVENT_TYPE_DEPRECATED_SOFT 0x1226
+#define AL_EVENT_TYPE_DISCONNECTED_SOFT 0x1227
typedef void (AL_APIENTRY*ALEVENTPROCSOFT)(ALenum eventType, ALuint object, ALuint param,
ALsizei length, const ALchar *message,
void *userParam);