Toast Engine
Loading...
Searching...
No Matches
audio_snapshot.hpp
Go to the documentation of this file.
1
8
9#pragma once
10#include <toast/assets/data.hpp>
11#include <toast/export.hpp>
12
13namespace assets {
14
15class TOAST_API AudioSnapshot : public Data {
16public:
17 explicit AudioSnapshot(const toml::table& table, Handle<Schema> schema = {}) : Data(table, std::move(schema)) { }
18
19 [[nodiscard]]
20 auto type() const -> std::string_view override {
21 return "audio_snapshot";
22 }
23
24 // Type-safe string getters pulling from the underlying m_root DataValue
25 [[nodiscard]]
26 auto eventType() const -> std::string_view {
27 return m_root.contains("type") ? m_root["type"].as<std::string_view>() : "";
28 }
29
30 [[nodiscard]]
31 auto name() const -> std::string_view {
32 return m_root.contains("name") ? m_root["name"].as<std::string_view>() : "";
33 }
34
35 [[nodiscard]]
36 auto path() const -> std::string_view {
37 return m_root.contains("path") ? m_root["path"].as<std::string_view>() : "";
38 }
39
40 [[nodiscard]]
41 auto guid() const -> std::string_view {
42 return m_root.contains("guid") ? m_root["guid"].as<std::string_view>() : "";
43 }
44
45 void setIntensity(float intensity) const;
46 void setEnabled(bool enabled) const;
47};
48
49}
DataValue m_root
Object DataValue holding all fields.
Definition data.hpp:68
Type-safe smart pointer for assets.
Definition core_types.hpp:149
Typed data asset backed by schema-driven TOML.