async_event.h 932 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef ALC_EVENT_H
  2. #define ALC_EVENT_H
  3. #include "almalloc.h"
  4. struct EffectState;
  5. enum class VChangeState;
  6. using uint = unsigned int;
  7. enum {
  8. /* End event thread processing. */
  9. EventType_KillThread = 0,
  10. /* User event types. */
  11. EventType_SourceStateChange = 1<<0,
  12. EventType_BufferCompleted = 1<<1,
  13. EventType_Disconnected = 1<<2,
  14. /* Internal events. */
  15. EventType_ReleaseEffectState = 65536,
  16. };
  17. struct AsyncEvent {
  18. uint EnumType{0u};
  19. union {
  20. char dummy;
  21. struct {
  22. uint id;
  23. VChangeState state;
  24. } srcstate;
  25. struct {
  26. uint id;
  27. uint count;
  28. } bufcomp;
  29. struct {
  30. char msg[244];
  31. } disconnect;
  32. EffectState *mEffectState;
  33. } u{};
  34. AsyncEvent() noexcept = default;
  35. constexpr AsyncEvent(uint type) noexcept : EnumType{type} { }
  36. DISABLE_ALLOC()
  37. };
  38. #endif