MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ save_audio()

MAYAFLUX_API bool MayaFlux::save_audio ( const std::shared_ptr< Kakshya::SoundStreamContainer > &  container,
const std::string &  suggested_name = "output.wav" 
)

Present a native save-file dialog and write container to the chosen path via IOManager::write().

Blocks until the user confirms or cancels. The encode task is queued asynchronously; this function returns once the path is chosen and the task is enqueued. Returns false on cancellation, backend error, or if Portal::System is not initialized.

Parameters
containerSource container to encode.
suggested_nameFilename pre-filled in the dialog name field.

Definition at line 183 of file Depot.cpp.

186{
187 if (!require_portal("save_audio"))
188 return false;
189
190 auto iom = get_io_manager();
191 if (!iom) {
192 MF_ERROR(Journal::Component::API, Journal::Context::Runtime,
193 "save_audio: IOManager unavailable");
194 return false;
195 }
196
197 return Portal::System::Dialog::save_file<bool>(
198 [&iom, &container](const fs::path& p) {
199 iom->write(container, p.string());
200 return true;
201 },
202 [](Core::SystemDialogError) { },
203 suggested_name,
204 k_audio_save_filters);
205}
#define MF_ERROR(comp, ctx,...)
std::shared_ptr< IO::IOManager > get_io_manager()
Retrieves the global IOManager instance for file loading and buffer management.
Definition Depot.cpp:256

References MayaFlux::Journal::API, get_io_manager(), MF_ERROR, and MayaFlux::Journal::Runtime.

+ Here is the call graph for this function: