14 entt::meta_factory<audio_source_component>{}
15 .type(
"audio_source_component"_hs)
31 .data<&audio_source_component::set_loop, &audio_source_component::is_looping>(
"loop"_hs)
36 .data<&audio_source_component::set_mute, &audio_source_component::is_muted>(
"mute"_hs)
41 .data<&audio_source_component::set_volume, &audio_source_component::get_volume>(
"volume"_hs)
48 .data<&audio_source_component::set_pitch, &audio_source_component::get_pitch>(
"pitch"_hs)
52 entt::attribute{
"tooltip",
"A multiplier for the frequency (sample rate) of the source's buffer."},
56 .data<&audio_source_component::set_volume_rolloff, &audio_source_component::get_volume_rolloff>(
"volume_rolloff"_hs)
63 .data<&audio_source_component::set_range, &audio_source_component::get_range>(
"range"_hs)
68 .data<&audio_source_component::set_clip, &audio_source_component::get_clip>(
"clip"_hs)
77 try_save(ar, ser20::make_nvp(
"auto_play", obj.get_autoplay()));
78 try_save(ar, ser20::make_nvp(
"loop", obj.is_looping()));
79 try_save(ar, ser20::make_nvp(
"volume", obj.get_volume()));
80 try_save(ar, ser20::make_nvp(
"pitch", obj.get_pitch()));
81 try_save(ar, ser20::make_nvp(
"volume_rolloff", obj.get_volume_rolloff()));
82 try_save(ar, ser20::make_nvp(
"range", obj.get_range()));
83 try_save(ar, ser20::make_nvp(
"clip", obj.get_clip()));
91 if(
try_load(ar, ser20::make_nvp(
"auto_play", auto_play)))
93 obj.set_autoplay(auto_play);
97 if(
try_load(ar, ser20::make_nvp(
"loop", loop)))
103 if(
try_load(ar, ser20::make_nvp(
"volume", volume)))
105 obj.set_volume(volume);
109 if(
try_load(ar, ser20::make_nvp(
"pitch", pitch)))
111 obj.set_pitch(pitch);
114 float volume_rolloff{1.0f};
115 if(
try_load(ar, ser20::make_nvp(
"volume_rolloff", volume_rolloff)))
117 obj.set_volume_rolloff(volume_rolloff);
123 obj.set_range(
range);
127 if(
try_load(ar, ser20::make_nvp(
"clip", clip)))
Class that contains core data for audio sources.
void set_autoplay(bool on)
Sets whether the audio source should autoplay.
auto get_autoplay() const -> bool
Gets whether the audio source is set to autoplay.
attributes::value_type attribute
std::map< std::string, meta_any > attributes
BinaryInputArchive iarchive_binary_t
simd::JSONOutputArchive oarchive_associative_t
BinaryOutputArchive oarchive_binary_t
simd::JSONInputArchive iarchive_associative_t
#define SAVE_INSTANTIATE(cls, Archive)
auto try_save(Archive &ar, ser20::NameValuePair< T > &&t, const hpp::source_location &loc=hpp::source_location::current()) -> bool
#define LOAD_INSTANTIATE(cls, Archive)
auto try_load(Archive &ar, ser20::NameValuePair< T > &&t, const hpp::source_location &loc=hpp::source_location::current()) -> bool
Represents a handle to an asset, providing access and management functions.