event.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef AL_EVENT_H
  2. #define AL_EVENT_H
  3. #include "AL/al.h"
  4. #include "AL/alc.h"
  5. struct EffectState;
  6. enum {
  7. /* End event thread processing. */
  8. EventType_KillThread = 0,
  9. /* User event types. */
  10. EventType_SourceStateChange = 1<<0,
  11. EventType_BufferCompleted = 1<<1,
  12. EventType_Error = 1<<2,
  13. EventType_Performance = 1<<3,
  14. EventType_Deprecated = 1<<4,
  15. EventType_Disconnected = 1<<5,
  16. /* Internal events. */
  17. EventType_ReleaseEffectState = 65536,
  18. };
  19. struct AsyncEvent {
  20. unsigned int EnumType{0u};
  21. union {
  22. char dummy;
  23. struct {
  24. ALuint id;
  25. ALenum state;
  26. } srcstate;
  27. struct {
  28. ALuint id;
  29. ALuint count;
  30. } bufcomp;
  31. struct {
  32. ALenum type;
  33. ALuint id;
  34. ALuint param;
  35. ALchar msg[232];
  36. } user;
  37. EffectState *mEffectState;
  38. } u{};
  39. AsyncEvent() noexcept = default;
  40. constexpr AsyncEvent(unsigned int type) noexcept : EnumType{type} { }
  41. };
  42. void StartEventThrd(ALCcontext *ctx);
  43. void StopEventThrd(ALCcontext *ctx);
  44. #endif