Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
Loading...
Searching...
No Matches
AudioFlow.h
1#pragma once
2
3#include <cstdint>
4#include <filesystem>
5#include <string>
6
7namespace Engine::Assets {
8
16 std::filesystem::path path;
17 std::string name;
18
19 [[nodiscard]] bool isValid() const noexcept { return !name.empty(); }
20 explicit operator bool() const noexcept { return isValid(); }
21
22 friend bool operator==( const AudioFlowHandle& a, const AudioFlowHandle& b ) noexcept
23 {
24 return a.path == b.path && a.name == b.name;
25 }
26 friend bool operator!=( const AudioFlowHandle& a, const AudioFlowHandle& b ) noexcept
27 {
28 return !( a == b );
29 }
30 };
31
40 uint32_t settingIndex = 0;
41 uint32_t generation = 0;
42
43 [[nodiscard]] bool isValid() const noexcept { return flow.isValid(); }
44 explicit operator bool() const noexcept { return isValid(); }
45
46 friend bool operator==( const FlowSettingHandle& a, const FlowSettingHandle& b ) noexcept
47 {
48 return a.flow == b.flow && a.settingIndex == b.settingIndex && a.generation == b.generation;
49 }
50 friend bool operator!=( const FlowSettingHandle& a, const FlowSettingHandle& b ) noexcept
51 {
52 return !( a == b );
53 }
54 };
55
56} // namespace Engine::Assets
57
58namespace std {
59 template<>
60 struct hash<Engine::Assets::AudioFlowHandle>
61 {
62 size_t operator()( const Engine::Assets::AudioFlowHandle& handle ) const noexcept
63 {
64 const size_t pathHash = hash<std::filesystem::path>{}( handle.path );
65 const size_t nameHash = hash<std::string>{}( handle.name );
66 return pathHash ^ ( nameHash + 0x9e3779b9u + ( pathHash << 6 ) + ( pathHash >> 2 ) );
67 }
68 };
69} // namespace std
STL namespace.
Stable identity of an audio flow: the glTF asset path plus the flow name (unique within the asset)....
Definition AudioFlow.h:15
bool isValid() const noexcept
Definition AudioFlow.h:19
friend bool operator==(const AudioFlowHandle &a, const AudioFlowHandle &b) noexcept
Definition AudioFlow.h:22
std::filesystem::path path
glTF asset path the flow belongs to.
Definition AudioFlow.h:16
std::string name
Flow identity within the asset.
Definition AudioFlow.h:17
friend bool operator!=(const AudioFlowHandle &a, const AudioFlowHandle &b) noexcept
Definition AudioFlow.h:26
Stable handle to a named, runtime-controllable setting of a flow.
Definition AudioFlow.h:38
bool isValid() const noexcept
Definition AudioFlow.h:43
uint32_t settingIndex
Index into the flow's settings array.
Definition AudioFlow.h:40
friend bool operator!=(const FlowSettingHandle &a, const FlowSettingHandle &b) noexcept
Definition AudioFlow.h:50
friend bool operator==(const FlowSettingHandle &a, const FlowSettingHandle &b) noexcept
Definition AudioFlow.h:46
uint32_t generation
Reserved for store generation validation.
Definition AudioFlow.h:41
size_t operator()(const Engine::Assets::AudioFlowHandle &handle) const noexcept
Definition AudioFlow.h:62