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

◆ upload_audio_to_gpu()

void MayaFlux::Buffers::upload_audio_to_gpu ( const std::shared_ptr< AudioBuffer > &  audio_buffer,
const std::shared_ptr< VKBuffer > &  gpu_buffer,
const std::shared_ptr< VKBuffer > &  staging = nullptr 
)

Upload AudioBuffer to GPU (always double precision)

Parameters
audio_bufferSource audio buffer (double[])
gpu_bufferTarget GPU buffer (must support R64Sfloat format)
stagingOptional staging buffer (auto-created if needed)

AudioBuffer is always double precision. This function ensures the GPU buffer is configured for double precision and performs a direct upload with no conversion.

Exceptions
std::runtime_errorif gpu_buffer doesn't support double precision

Definition at line 339 of file StagingUtils.cpp.

343{
344 if (gpu_buffer->get_format() != vk::Format::eR64Sfloat && gpu_buffer->get_format() != vk::Format::eUndefined) {
345 MF_ERROR(Journal::Component::Buffers, Journal::Context::BufferProcessing,
346 "GPU buffer format is {} but audio requires R64Sfloat for double precision. "
347 "Create VKBuffer with DataModality::AUDIO_1D or AUDIO_MULTICHANNEL.",
348 vk::to_string(gpu_buffer->get_format()));
349 error<std::runtime_error>(
350 Journal::Component::Buffers,
351 Journal::Context::BufferProcessing,
352 std::source_location::current(),
353 "GPU buffer format mismatch for audio upload");
354 }
355
356 auto& audio_data = audio_buffer->get_data();
357
358 if (audio_data.empty()) {
359 MF_ERROR(Journal::Component::Buffers, Journal::Context::BufferProcessing,
360 "AudioBuffer contains no data to upload");
361 return;
362 }
363
364 const void* data_ptr = audio_data.data();
365 size_t data_bytes = audio_data.size() * sizeof(double);
366
367 upload_to_gpu(data_ptr, data_bytes, gpu_buffer, staging);
368
369 MF_DEBUG(Journal::Component::Buffers, Journal::Context::BufferProcessing,
370 "Uploaded {} bytes of double-precision audio to GPU", data_bytes);
371}
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MF_DEBUG, MF_ERROR, and upload_to_gpu().

Referenced by MayaFlux::Buffers::TransferProcessor::process_audio_to_gpu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: