11 AL_API
void AL_APIENTRY
alEventControlSOFT(ALsizei count
, const ALenum
*types
, ALboolean enable
)
14 ALbitfieldSOFT flags
= 0;
17 context
= GetContextRef();
20 if(count
< 0) SETERR_GOTO(context
, AL_INVALID_VALUE
, done
, "Controlling %d events", count
);
21 if(count
== 0) goto done
;
22 if(!types
) SETERR_GOTO(context
, AL_INVALID_VALUE
, done
, "NULL pointer");
24 for(i
= 0;i
< count
;i
++)
26 if(types
[i
] == AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT
)
27 flags
|= EventType_BufferCompleted
;
28 else if(types
[i
] == AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT
)
29 flags
|= EventType_SourceStateChange
;
30 else if(types
[i
] == AL_EVENT_TYPE_ERROR_SOFT
)
31 flags
|= EventType_Error
;
32 else if(types
[i
] == AL_EVENT_TYPE_PERFORMANCE_SOFT
)
33 flags
|= EventType_Performance
;
34 else if(types
[i
] == AL_EVENT_TYPE_DEPRECATED_SOFT
)
35 flags
|= EventType_Deprecated
;
37 SETERR_GOTO(context
, AL_INVALID_ENUM
, done
, "Invalid event type 0x%04x", types
[i
]);
42 ALbitfieldSOFT enabledevts
= ATOMIC_LOAD(&context
->EnabledEvts
, almemory_order_relaxed
);
43 while(ATOMIC_COMPARE_EXCHANGE_WEAK(&context
->EnabledEvts
, &enabledevts
, enabledevts
|flags
,
44 almemory_order_acq_rel
, almemory_order_acquire
) == 0)
46 /* enabledevts is (re-)filled with the current value on failure, so
53 ALbitfieldSOFT enabledevts
= ATOMIC_LOAD(&context
->EnabledEvts
, almemory_order_relaxed
);
54 while(ATOMIC_COMPARE_EXCHANGE_WEAK(&context
->EnabledEvts
, &enabledevts
, enabledevts
&~flags
,
55 almemory_order_acq_rel
, almemory_order_acquire
) == 0)
61 ALCcontext_DecRef(context
);
64 AL_API
void AL_APIENTRY
alEventCallbackSOFT(ALEVENTPROCSOFT callback
, void *userParam
)
68 context
= GetContextRef();
71 almtx_lock(&context
->EventCbLock
);
72 context
->EventCb
= callback
;
73 context
->EventParam
= userParam
;
74 almtx_unlock(&context
->EventCbLock
);
76 ALCcontext_DecRef(context
);