Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
Loading...
Searching...
No Matches
AudioFlowStore.h
1#pragma once
2
3#include "Engine/Audio/AudioFlow.h"
4
5#include <cstdint>
6#include <filesystem>
7#include <memory>
8#include <string>
9#include <unordered_map>
10#include <vector>
11
12namespace Engine::Assets {
13
23 public:
24 AudioFlowStore() = default;
25
26 AudioFlowStore( const AudioFlowStore& ) = delete;
28
37 AudioFlowHandle registerFlow( std::filesystem::path gltfPath, std::string flowName,
38 std::string flowJson, std::string baseDir );
39
44 [[nodiscard]] AudioFlowHandle find( const std::filesystem::path& gltfPath, const std::string& flowName ) const;
45
50 [[nodiscard]] bool flow( const AudioFlowHandle& handle, std::string* outJson, std::string* outBaseDir ) const;
51
56 [[nodiscard]] FlowSettingHandle findSetting( const AudioFlowHandle& handle, const std::string& settingName ) const;
57
61 [[nodiscard]] size_t size() const { return records_.size(); }
62
64 void clear();
65
66 private:
70 struct Record {
72 std::string json;
73 std::string baseDir;
74 uint32_t generation = 1;
75 std::vector<std::string> settingNames;
76 };
77
78 static std::string keyFor( const AudioFlowHandle& handle );
79
80 std::vector<Record> records_;
81 std::unordered_map<std::string, uint32_t> keyToIndex_;
82 };
83
84} // namespace Engine::Assets
static std::string keyFor(const AudioFlowHandle &handle)
void clear()
Drop all registered flows.
AudioFlowStore(const AudioFlowStore &)=delete
AudioFlowHandle find(const std::filesystem::path &gltfPath, const std::string &flowName) const
Get the registered handle for a flow identity.
AudioFlowHandle registerFlow(std::filesystem::path gltfPath, std::string flowName, std::string flowJson, std::string baseDir)
Register a flow document under its identity.
FlowSettingHandle findSetting(const AudioFlowHandle &handle, const std::string &settingName) const
Resolve a named setting of a flow to a stable handle.
AudioFlowStore & operator=(const AudioFlowStore &)=delete
bool flow(const AudioFlowHandle &handle, std::string *outJson, std::string *outBaseDir) const
Look up a flow's JSON + base directory.
std::unordered_map< std::string, uint32_t > keyToIndex_
std::vector< Record > records_
size_t size() const
Number of registered flows.
Stable identity of an audio flow: the glTF asset path plus the flow name (unique within the asset)....
Definition AudioFlow.h:15
uint32_t generation
Bumped when the flow is re-registered.
std::vector< std::string > settingNames
Settings array order (index = settingIndex).
Stable handle to a named, runtime-controllable setting of a flow.
Definition AudioFlow.h:38