mirror of
https://github.com/love2d/megasource.git
synced 2026-08-19 20:20:11 +02:00
Update OpenAL-soft to 1.23.1-bc7cb17.
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
#ifndef CORE_EVENT_H
|
||||
#define CORE_EVENT_H
|
||||
|
||||
#include <array>
|
||||
#include <stdint.h>
|
||||
#include <variant>
|
||||
|
||||
#include "almalloc.h"
|
||||
|
||||
struct EffectState;
|
||||
@@ -8,48 +12,53 @@ struct EffectState;
|
||||
using uint = unsigned int;
|
||||
|
||||
|
||||
struct AsyncEvent {
|
||||
enum : uint {
|
||||
/* End event thread processing. */
|
||||
KillThread = 0,
|
||||
|
||||
/* User event types. */
|
||||
SourceStateChange = 1<<0,
|
||||
BufferCompleted = 1<<1,
|
||||
Disconnected = 1<<2,
|
||||
|
||||
/* Internal events. */
|
||||
ReleaseEffectState = 65536,
|
||||
};
|
||||
|
||||
enum class SrcState {
|
||||
Reset,
|
||||
Stop,
|
||||
Play,
|
||||
Pause
|
||||
};
|
||||
|
||||
uint EnumType{0u};
|
||||
union {
|
||||
char dummy;
|
||||
struct {
|
||||
uint id;
|
||||
SrcState state;
|
||||
} srcstate;
|
||||
struct {
|
||||
uint id;
|
||||
uint count;
|
||||
} bufcomp;
|
||||
struct {
|
||||
char msg[244];
|
||||
} disconnect;
|
||||
EffectState *mEffectState;
|
||||
} u{};
|
||||
|
||||
AsyncEvent() noexcept = default;
|
||||
constexpr AsyncEvent(uint type) noexcept : EnumType{type} { }
|
||||
|
||||
DISABLE_ALLOC()
|
||||
enum class AsyncEnableBits : uint8_t {
|
||||
SourceState,
|
||||
BufferCompleted,
|
||||
Disconnected,
|
||||
Count
|
||||
};
|
||||
|
||||
|
||||
enum class AsyncSrcState : uint8_t {
|
||||
Reset,
|
||||
Stop,
|
||||
Play,
|
||||
Pause
|
||||
};
|
||||
|
||||
using AsyncKillThread = std::monostate;
|
||||
|
||||
struct AsyncSourceStateEvent {
|
||||
uint mId;
|
||||
AsyncSrcState mState;
|
||||
};
|
||||
|
||||
struct AsyncBufferCompleteEvent {
|
||||
uint mId;
|
||||
uint mCount;
|
||||
};
|
||||
|
||||
struct AsyncDisconnectEvent {
|
||||
std::array<char,244> msg;
|
||||
};
|
||||
|
||||
struct AsyncEffectReleaseEvent {
|
||||
EffectState *mEffectState;
|
||||
};
|
||||
|
||||
using AsyncEvent = std::variant<AsyncKillThread,
|
||||
AsyncSourceStateEvent,
|
||||
AsyncBufferCompleteEvent,
|
||||
AsyncEffectReleaseEvent,
|
||||
AsyncDisconnectEvent>;
|
||||
|
||||
template<typename T, typename ...Args>
|
||||
auto &InitAsyncEvent(std::byte *evtbuf, Args&& ...args)
|
||||
{
|
||||
auto *evt = al::construct_at(reinterpret_cast<AsyncEvent*>(evtbuf), std::in_place_type<T>,
|
||||
std::forward<Args>(args)...);
|
||||
return std::get<T>(*evt);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user