Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
Loading...
Searching...
No Matches
AudioAssetPipeline.h
1#pragma once
2#include <filesystem>
3#include <future>
4#include <vector>
5
6#include "Engine/Audio/AudioConfig.h"
7#include "Engine/Audio/AudioAssetRef.h"
8#include "Engine/Audio/AudioLoader.h"
9
10class NamedThreadPool;
11
12namespace Engine::Assets
13{
15} // namespace Engine::Assets
16
17namespace Engine
18{
19 class EngineKern;
20}
21
22namespace Engine::Core
23{
24 class AudioEngine;
25 class AssetManager;
26}
27
28namespace Engine::Ecs
29{
38 friend class AssetManager;
39 friend class EngineKern;
40
41 public:
48 Assets::AudioAssetManager * audioAssetManager,
49 NamedThreadPool* assetLoaderPool);
50
55 void submitAsset(const std::filesystem::path& asset);
56
61 void tick(bool async = true);
62
67 void setAudioEngine( Core::AudioEngine * engine) { audioEngine_ = engine; }
68
73 [[nodiscard]] size_t getPendingCount() const {
74 return assetQueue_.size() + loadFutures_.size();
75 }
76
81
82 private:
85
87 std::filesystem::path path;
89 uint64_t generation = 0;
90 std::future<Assets::AudioData> future;
91 };
92
95 NamedThreadPool* assetLoaderPool_ = nullptr;
96
97 std::vector<std::filesystem::path> assetQueue_;
98 std::vector<AudioLoadFuture> loadFutures_;
99
101 };
102
103} // namespace Engine::Ecs
Manages audio assets by filesystem path, providing dedup and lookup.
Definition AudioAsset.h:80
Coordinates engine asset loading pipelines and runtime texture descriptor ownership.
Owns the miniaudio engine and provides the playback API.
Definition AudioEngine.h:49
void setAudioEngine(Core::AudioEngine *engine)
Set the AudioEngine to notify when assets finish loading.
std::vector< AudioLoadFuture > loadFutures_
void tick(bool async=true)
Advances the pipeline state machine (call once per frame)
size_t getPendingCount() const
Returns the number of audio assets still pending.
void submitAsset(const std::filesystem::path &asset)
Submit an audio file for async loading.
void discardPendingWork()
Clears all queued and in-flight audio loading work.
AudioAssetPipeline(Assets::AudioAssetManager *audioAssetManager, NamedThreadPool *assetLoaderPool)
Create an audio asset loading pipeline.
std::vector< std::filesystem::path > assetQueue_
Assets::AudioAssetManager * audioAssetManager_
Owns the engine runtime and provides access to engine subsystems.
Definition Engine.h:67
Asset::Ref< Asset::Path, Audio > AudioAssetRef
Asset reference to decoded audio data loaded from a filesystem path.
constexpr size_t MAX_AUDIO_LOADS_PER_FRAME
Maximum audio assets to finalize per frame in the pipeline.
Definition AudioConfig.h:24
EnTT component data used by engine systems.