2#include <audiopp/loaders/loader.h>
14 entt::meta_factory<sound_info>{}
15 .type(
"sound_info"_hs)
20 .data<nullptr, &sound_info::bits_per_sample>(
"bytes_per_sample"_hs)
26 .data<nullptr, &sound_info::sample_rate>(
"sample_rate"_hs)
32 .data<nullptr, &sound_info::channels>(
"channels"_hs)
38 .data<nullptr, &sound_info::duration>(
"duration"_hs)
44 .data<nullptr, &sound_info::frames>(
"frames"_hs)
54 try_save(ar, ser20::make_nvp(
"bits_per_sample", obj.bits_per_sample));
55 try_save(ar, ser20::make_nvp(
"sample_rate", obj.sample_rate));
56 try_save(ar, ser20::make_nvp(
"channels", obj.channels));
57 try_save(ar, ser20::make_nvp(
"duration", obj.duration));
58 try_save(ar, ser20::make_nvp(
"frames", obj.frames));
64 try_load(ar, ser20::make_nvp(
"bits_per_sample", obj.bits_per_sample));
65 try_load(ar, ser20::make_nvp(
"sample_rate", obj.sample_rate));
66 try_load(ar, ser20::make_nvp(
"channels", obj.channels));
67 try_load(ar, ser20::make_nvp(
"duration", obj.duration));
68 try_load(ar, ser20::make_nvp(
"frames", obj.frames));
74 try_save(ar, ser20::make_nvp(
"info", obj.info));
75 try_save(ar, ser20::make_nvp(
"data", obj.data));
83 try_load(ar, ser20::make_nvp(
"info", obj.info));
84 try_load(ar, ser20::make_nvp(
"data", obj.data));
97 entt::meta_factory<audio_clip>{}
98 .type(
"audio_clip"_hs)
103 .data<nullptr, &audio_clip::get_info>(
"info"_hs)
124void save_to_file(
const std::string& absolute_path,
const audio::sound_data& obj)
136 std::ofstream stream(absolute_path, std::ios::binary);
140 try_save(ar, ser20::make_nvp(
"sound_data", obj));
144auto load_from_file(
const std::string& absolute_path, audio::sound_data& obj, std::string& err) ->
bool
146 return audio::load_from_file(absolute_path, obj, err);
164 try_load(ar, ser20::make_nvp(
"sound_data", obj));
stdio-backed input stream. Accepts std::ios open flags (e.g. std::ios::binary) when opening a
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.