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

◆ on_attach()

void MayaFlux::Buffers::AudioComputeProcessor::on_attach ( const std::shared_ptr< Buffer > & )
overridevirtual

Called when this processor is attached to a buffer.

Parameters
bufferBuffer this processor is being attached to

Provides an opportunity for the processor to initialize buffer-specific state, allocate resources, or perform validation. With expanded processor capabilities, this method can also:

  • Analyze Buffer Characteristics: Examine data type, size, and format requirements
  • Select Optimal Backend: Choose the most appropriate processing backend for the buffer
  • Initialize Hardware Resources: Set up GPU contexts, CUDA streams, or other acceleration
  • Configure Processing Parameters: Adapt algorithm parameters to buffer characteristics
  • Establish Processing Strategy: Determine whether to use sequential or parallel execution
  • Validate Compatibility: Ensure the processor can handle the buffer's data type and format

Default implementation does nothing, but derived classes should override this method to leverage the full capabilities of the expanded processor architecture.

Reimplemented from MayaFlux::Buffers::BufferProcessor.

Definition at line 59 of file AudioComputeProcessor.cpp.

60{
61 auto audio = std::dynamic_pointer_cast<AudioBuffer>(buffer);
62 if (!audio) {
64 "AudioComputeProcessor can only attach to an AudioBuffer");
65 return;
66 }
67
68 if (m_native_f64) {
69 const auto features = Portal::Graphics::get_shader_foundry()
71 .getFeatures();
72 if (!features.shaderFloat64) {
73 error<std::runtime_error>(
76 std::source_location::current(),
77 "NATIVE_F64 requires shaderFloat64 on the selected device");
78 }
79 }
80
81 if (!m_block) {
82 resize_block(static_cast<uint32_t>(audio->get_data().size()));
83 }
84 if (m_block) {
87 }
88 m_attached.store(true, std::memory_order_seq_cst);
89}
#define MF_ERROR(comp, ctx,...)
std::atomic< bool > m_attached
Set on attach, cleared on detach.
void prepare_for(const std::shared_ptr< VKBuffer > &vk_buffer)
Creates or rebuilds the shader, pipeline and descriptors that the next dispatch needs.
vk::PhysicalDevice get_physical_device() const
Get physical device handle.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains).
@ Buffers
Buffers, Managers, processors and processing chains.
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Portal::Graphics::ShaderFoundry::get_physical_device(), MayaFlux::Portal::Graphics::get_shader_foundry(), m_attached, m_block, m_native_f64, MF_ERROR, MayaFlux::Buffers::ShaderProcessor::prepare_for(), resize_block(), and validate_shader().

Here is the call graph for this function: