2#include <audiopp/loaders/loader.h>
13 entt::meta_factory<sound_info>{}
14 .type(
"sound_info"_hs)
19 .data<nullptr, &sound_info::bits_per_sample>(
"bytes_per_sample"_hs)
25 .data<nullptr, &sound_info::sample_rate>(
"sample_rate"_hs)
31 .data<nullptr, &sound_info::channels>(
"channels"_hs)
37 .data<nullptr, &sound_info::duration>(
"duration"_hs)
43 .data<nullptr, &sound_info::frames>(
"frames"_hs)
53 try_save(ar, ser20::make_nvp(
"bits_per_sample", obj.bits_per_sample));
54 try_save(ar, ser20::make_nvp(
"sample_rate", obj.sample_rate));
55 try_save(ar, ser20::make_nvp(
"channels", obj.channels));
56 try_save(ar, ser20::make_nvp(
"duration", obj.duration));
57 try_save(ar, ser20::make_nvp(
"frames", obj.frames));
63 try_load(ar, ser20::make_nvp(
"bits_per_sample", obj.bits_per_sample));
64 try_load(ar, ser20::make_nvp(
"sample_rate", obj.sample_rate));
65 try_load(ar, ser20::make_nvp(
"channels", obj.channels));
66 try_load(ar, ser20::make_nvp(
"duration", obj.duration));
67 try_load(ar, ser20::make_nvp(
"frames", obj.frames));
73 try_save(ar, ser20::make_nvp(
"info", obj.info));
74 try_save(ar, ser20::make_nvp(
"data", obj.data));
80 try_load(ar, ser20::make_nvp(
"info", obj.info));
81 try_load(ar, ser20::make_nvp(
"data", obj.data));
92 entt::meta_factory<audio_clip>{}
93 .type(
"audio_clip"_hs)
98 .data<nullptr, &audio_clip::get_info>(
"info"_hs)
119void save_to_file(
const std::string& absolute_path,
const audio::sound_data& obj)
131 std::ofstream stream(absolute_path, std::ios::binary);
135 try_save(ar, ser20::make_nvp(
"sound_data", obj));
139auto load_from_file(
const std::string& absolute_path, audio::sound_data& obj, std::string& err) ->
bool
141 return audio::load_from_file(absolute_path, obj, err);
153 std::ifstream stream(absolute_path, std::ios::binary);
157 try_load(ar, ser20::make_nvp(
"sound_data", obj));
attributes::value_type attribute
std::map< std::string, meta_any > attributes
BinaryInputArchive iarchive_binary_t
BinaryOutputArchive oarchive_binary_t
void save_to_file_bin(const std::string &absolute_path, const animation_clip &obj)
void load_from_file(const std::string &absolute_path, animation_clip &obj)
void save_to_file(const std::string &absolute_path, const animation_clip &obj)
void load_from_file_bin(const std::string &absolute_path, animation_clip &obj)
#define REFLECT_EXTERN(cls)
#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
Struct representing an audio clip.