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