31 uint64_t globalSamples = 0;
37 static uint32_t SamplesPerSec;
38 static uint8_t nchannels;
39 static uint16_t buffer_size;
40 static uint32_t maxAudioSampleLatency;
42 static constexpr uint16_t config_buffersize = 512;
43 static constexpr uint16_t config_samplesPerSec = 44'100;
44 static constexpr uint32_t config_nchannels = 2;
48 std::optional<SingleAudioRenderBuffer> playerRenderBuffer;
50 tf::Executor audioExecutor;
51 tf::Taskflow audioTaskflow;
54 tf::Future<void> taskflowFuture;
56 void SetupAudioTaskGraph();
57 std::vector<entity_id_t> destroyedSources, destroyedMeshComponents;
59 decltype(AudioSnapshot::dataProviders.begin()) dataProvidersBegin, dataProvidersEnd;
60 decltype(AudioSnapshot::ambientSources.begin()) ambientSourcesBegin, ambientSourcesEnd;
61 decltype(AudioSnapshot::simpleAudioSpaces.begin()) simpleSpacesBegin, simpleSpacesEnd;
62 decltype(AudioSnapshot::geometryAudioSpaces.begin()) geometrySpacesBegin, geometrySpacesEnd;
63 decltype(AudioSnapshot::boxAudioSpaces.begin()) boxSpacesBegin, boxSpacesEnd;
67 matrix4 invListenerTransform{ 1 }, listenerTransform{ 1 };
69 std::optional<std::thread> audioTickThread;
70 std::atomic<bool> audioThreadShouldRun =
true;
71 std::vector<float> interleavedOutputBuffer;
73 void PerformAudioTickPreamble();
77 void CalculateFinalMix();
84 auto GetSteamAudioHRTF()
const {
85 return steamAudioHRTF;
87 auto GetSteamAudioContext()
const {
88 return steamAudioContext;
91 auto GetSteamAudioState()
const {
94 decltype(steamAudioHRTF)
hrtf;
95 decltype(steamAudioContext)
context;
97 .hrtf = steamAudioHRTF,
98 .context = steamAudioContext
124 const static auto GetSamplesPerSec() {
125 return SamplesPerSec;
128 const static auto GetNChannels(){
132 const static auto GetBufferSize(){
136 decltype(globalSamples) GetGlobalAudioTime()
const{
137 return globalSamples;