25 constexpr Descriptor(std::string name, std::filesystem::path path,
const bool preDecode =
true) noexcept
29 m_RuntimeID(s_NextRuntimeID.fetch_add(1, std::memory_order_relaxed))
34 [[nodiscard]] uint32_t
GetRuntimeID()
const {
return m_RuntimeID; }
37 return m_RuntimeID == other.m_RuntimeID;
42 return std::hash<uint32_t>{}(handle.m_RuntimeID);
51 const uint32_t m_RuntimeID{ 0 };
52 inline static std::atomic<uint32_t> s_NextRuntimeID{ 1 };
62 [[nodiscard]]
bool IsValid()
const;
84 [[nodiscard]]
static std::shared_ptr<Sound>
Create(
const std::string& name,
const std::filesystem::path& path,
const bool preDecode =
true);
87 [[nodiscard]]
static std::shared_ptr<Sound>
Create(
const Descriptor& descriptor);
88 Sound(std::string name,
const std::filesystem::path& path,
const bool preDecode);
90 bool m_Valid{
false };
91 bool m_Placeholder{
false };
93 inline static std::atomic<SoundID> s_NextIndex{ 1 };
Used when you want to manually control the asset lifetime, loading, preloading, unloading.
Sound Descriptor meant to be used with AssetManager only.
constexpr Descriptor(std::string name, std::filesystem::path path, const bool preDecode=true) noexcept
Constructs a descriptor.
constexpr bool operator==(const Descriptor &other) const noexcept
uint32_t GetRuntimeID() const
const std::filesystem::path m_Path
bool IsPlaceholder() const
Checks if the sound was created with a placeholder.
static std::shared_ptr< Sound > Create(const std::string &name, const std::filesystem::path &path, const bool preDecode=true)
Creates a Sound object.
SoundID GetID() const
Returns the SoundID associated with Sound.
bool IsValid() const
Check if the Sound is valid.
For InstanceMetrics to work with a type it should derive from this.
Everything connected to audio is in this namespace.
std::size_t operator()(const Descriptor &handle) const noexcept