aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2021-04-25 14:29:21 -0700
committerChris Robinson <[email protected]>2021-04-25 14:29:21 -0700
commit8d09d03ed363ab1735b1933588d8242ba85ddf10 (patch)
tree515b4149211d29b04f7076ee943bed6bb62d0a90 /alc
parent0fe38c053d8dd827e774fbe0aef121e7aa0a0f28 (diff)
Move async_event.h to core
Diffstat (limited to 'alc')
-rw-r--r--alc/alc.cpp2
-rw-r--r--alc/alu.cpp21
-rw-r--r--alc/async_event.h49
-rw-r--r--alc/voice.cpp4
4 files changed, 22 insertions, 54 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp
index 1d96cef0..8ba1c8a2 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -76,10 +76,10 @@
#include "alspan.h"
#include "alstring.h"
#include "alu.h"
-#include "async_event.h"
#include "atomic.h"
#include "bformatdec.h"
#include "core/ambidefs.h"
+#include "core/async_event.h"
#include "core/bs2b.h"
#include "core/cpu_caps.h"
#include "core/devformat.h"
diff --git a/alc/alu.cpp b/alc/alu.cpp
index 7221ce27..a97bc18b 100644
--- a/alc/alu.cpp
+++ b/alc/alu.cpp
@@ -50,10 +50,10 @@
#include "alnumeric.h"
#include "alspan.h"
#include "alstring.h"
-#include "async_event.h"
#include "atomic.h"
#include "bformatdec.h"
#include "core/ambidefs.h"
+#include "core/async_event.h"
#include "core/bs2b.h"
#include "core/bsinc_tables.h"
#include "core/cpu_caps.h"
@@ -1581,7 +1581,24 @@ void SendSourceStateEvent(ContextBase *context, uint id, VChangeState state)
AsyncEvent *evt{::new(evt_vec.first.buf) AsyncEvent{EventType_SourceStateChange}};
evt->u.srcstate.id = id;
- evt->u.srcstate.state = state;
+ switch(state)
+ {
+ case VChangeState::Reset:
+ evt->u.srcstate.state = AsyncEvent::SrcState::Reset;
+ break;
+ case VChangeState::Stop:
+ evt->u.srcstate.state = AsyncEvent::SrcState::Stop;
+ break;
+ case VChangeState::Play:
+ evt->u.srcstate.state = AsyncEvent::SrcState::Play;
+ break;
+ case VChangeState::Pause:
+ evt->u.srcstate.state = AsyncEvent::SrcState::Pause;
+ break;
+ /* Shouldn't happen. */
+ case VChangeState::Restart:
+ ASSUME(0);
+ }
ring->writeAdvance(1);
}
diff --git a/alc/async_event.h b/alc/async_event.h
deleted file mode 100644
index 1ee58b10..00000000
--- a/alc/async_event.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef ALC_EVENT_H
-#define ALC_EVENT_H
-
-#include "almalloc.h"
-
-struct EffectState;
-enum class VChangeState;
-
-using uint = unsigned int;
-
-
-enum {
- /* End event thread processing. */
- EventType_KillThread = 0,
-
- /* User event types. */
- EventType_SourceStateChange = 1<<0,
- EventType_BufferCompleted = 1<<1,
- EventType_Disconnected = 1<<2,
-
- /* Internal events. */
- EventType_ReleaseEffectState = 65536,
-};
-
-struct AsyncEvent {
- uint EnumType{0u};
- union {
- char dummy;
- struct {
- uint id;
- VChangeState 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()
-};
-
-#endif
diff --git a/alc/voice.cpp b/alc/voice.cpp
index 8782e916..6abfcf59 100644
--- a/alc/voice.cpp
+++ b/alc/voice.cpp
@@ -42,9 +42,9 @@
#include "alspan.h"
#include "alstring.h"
#include "alu.h"
-#include "async_event.h"
#include "buffer_storage.h"
#include "core/ambidefs.h"
+#include "core/async_event.h"
#include "core/cpu_caps.h"
#include "core/devformat.h"
#include "core/device.h"
@@ -185,7 +185,7 @@ void SendSourceStoppedEvent(ContextBase *context, uint id)
AsyncEvent *evt{::new(evt_vec.first.buf) AsyncEvent{EventType_SourceStateChange}};
evt->u.srcstate.id = id;
- evt->u.srcstate.state = VChangeState::Stop;
+ evt->u.srcstate.state = AsyncEvent::SrcState::Stop;
ring->writeAdvance(1);
}