13namespace fs = std::filesystem;
17std::vector<std::shared_ptr<Buffers::SoundContainerBuffer>>
prepare_audio_buffers(
const std::shared_ptr<Kakshya::SoundFileContainer>& container)
21 "prepare_audio_buffers failed: null container");
25 uint32_t num_channels = container->get_num_channels();
26 std::vector<std::shared_ptr<Buffers::SoundContainerBuffer>> created_buffers;
29 auto container_buffer = std::make_shared<MayaFlux::Buffers::SoundContainerBuffer>(
35 container_buffer->initialize();
37 created_buffers.push_back(std::move(container_buffer));
40 return created_buffers;
45 if (!fs::exists(filepath) || !fs::is_regular_file(filepath)) {
49 auto ext = filepath.extension().string();
50 std::ranges::transform(ext, ext.begin(),
51 [](
unsigned char c) { return std::tolower(c); });
53 static const std::unordered_set<std::string> image_extensions = {
54 ".png",
".jpg",
".jpeg",
".bmp",
".tga",
55 ".psd",
".gif",
".hdr",
".pic",
".pnm",
".exr"
58 return image_extensions.contains(ext);
63 if (!fs::exists(filepath) || !fs::is_regular_file(filepath)) {
67 auto ext = filepath.extension().string();
68 std::ranges::transform(ext, ext.begin(),
69 [](
unsigned char c) { return std::tolower(c); });
71 static const std::unordered_set<std::string> audio_extensions = {
72 ".wav",
".aiff",
".aif",
".flac",
".ogg",
73 ".mp3",
".m4a",
".wma"
76 return audio_extensions.contains(ext);
86 "Attempted to access IOManager before engine initialization");
#define MF_ERROR(comp, ctx,...)
Core engine lifecycle and configuration API.
Audio file loading and container management API.
std::shared_ptr< IO::IOManager > get_io_manager()
Gets the IO manager.
uint32_t get_buffer_size()
Gets the buffer size from the default engine.
@ Runtime
General runtime operations (default fallback)
@ API
MayaFlux/API Wrapper and convenience functions.
bool is_engine_configured()
Checks if the default engine has currently accepted all configurations and initialized all managers.
bool is_image(const fs::path &filepath)
bool is_audio(const fs::path &filepath)
Core::Engine & get_context()
Gets the default engine instance.
std::shared_ptr< IO::IOManager > get_io_manager()
Retrieves the global IOManager instance for file loading and buffer management.
std::vector< std::shared_ptr< Buffers::SoundContainerBuffer > > prepare_audio_buffers(const std::shared_ptr< Kakshya::SoundFileContainer > &container)
Constructs and initializes per-channel SoundContainerBuffers without registering them.
Main namespace for the Maya Flux audio engine.