载入中...
搜索中...
未找到
EventSink.cpp
浏览该文件的文档.
1// eve-hot-path
2// Drives streaming-source refills once per event pump.
3//
4// Audio::pump has nothing to do with platform events, but it does need a
5// per-frame tick and the event pump was the only one available -- so the event
6// module called into audio. Hanging it off the sink's end-of-pump hook keeps
7// the timing identical without the dependency. The Audio module binds itself as
8// owner at construction so the hot path never looks up ModuleManager.
9
10#include "audio/Audio.h"
12#include "common/Capability.h"
14
15namespace eve::audio {
16namespace {
17
18Audio* g_owner = nullptr;
19
20class AudioPumpSink : public eve::platform_event::IPlatformEventSink {
21public:
22 void onPumpFinished() override {
23 if (g_owner) g_owner->pump();
24 }
25};
26
27struct Register {
28 Register() {
29 static AudioPumpSink sink;
30 eve::cap::addListener<eve::platform_event::IPlatformEventSink>(&sink);
31 }
32} g_register;
33
34} // namespace
35
36void bindAudioEventSinkOwner(Audio* owner) noexcept { g_owner = owner; }
37
38} // namespace eve::audio
std::shared_ptr< OceanGpuSpectrum > owner
OpenAL audio module: device management, master listener state, and Source factory....
Definition Audio.h:34
EVENGINE_API_FOUNDATION public API.
void bindAudioEventSinkOwner(Audio *owner) noexcept
Bind the live Audio module into the platform event pump sink. @ownership Borrowed; cleared when the A...
Definition EventSink.cpp:36