484{
485 try {
486 switch (op.get_type()) {
489
490 break;
491 }
492
497 } else {
499 input_data = it.second;
500 break;
501 }
502 }
503
504 if (op.m_transformer) {
505 auto transformed = op.m_transformer(input_data, cycle);
507
509 if (&m_operation == &op)
510 continue;
513 break;
514 }
515 }
516 }
517 break;
518 }
519
524 } else {
526 data_to_route = it.second;
527 break;
528 }
529 }
530
531 if (op.m_target_buffer) {
533 } else if (op.m_target_container) {
535 }
536 break;
537 }
538
541 op.m_start_frame,
542 op.m_load_length);
543
544 if (op.m_target_buffer) {
546 }
547
549 break;
550 }
551
553 std::vector<Kakshya::DataVariant> fusion_inputs;
554
555 for (auto& source_buffer : op.m_source_buffers) {
558 fusion_inputs.push_back(buffer_data);
559 }
560
561 for (auto& source_container : op.m_source_containers) {
563 fusion_inputs.push_back(container_data);
564 }
565
566 if (op.m_fusion_function && !fusion_inputs.empty()) {
567 auto fused_data = op.m_fusion_function(fusion_inputs, cycle);
568
569 if (op.m_target_buffer) {
571 } else if (op.m_target_container) {
573 }
574
576 }
577 break;
578 }
579
584 } else {
586 data_to_dispatch = it.second;
587 break;
588 }
589 }
590
591 if (op.m_dispatch_handler) {
592 op.m_dispatch_handler(data_to_dispatch, cycle);
593 }
594 break;
595 }
596
601 std::source_location::current(),
602 "BufferPipeline has no BufferManager for MODIFY operation");
603 }
604
605 if (!op.m_attached_processor) {
607 op.m_buffer_modifier,
611 }
612 }
613
614 if (op.m_modify_cycle_count > 0 && cycle >= op.m_modify_cycle_count - 1) {
615 if (op.m_attached_processor) {
617 op.m_attached_processor,
618 op.m_target_buffer);
619 op.m_attached_processor = nullptr;
620 }
621 }
622
623 break;
624 }
625
627 break;
628
629 default:
632 "Unknown operation type in pipeline : {} : {}",
634 break;
635 }
636 } catch (const std::exception& e) {
639 std::source_location::current(),
640 "Error processing operation in BufferPipeline: {}",
641 e.what());
642 }
643}
#define MF_ERROR(comp, ctx,...)
@ LOAD
Load data from container to buffer with position control.
@ CONDITION
Conditional operation for branching logic.
@ FUSE
Fuse multiple sources using custom fusion functions.
@ ROUTE
Route data to destination (buffer or container)
@ CAPTURE
Capture data from source buffer using BufferCapture strategy.
@ MODIFY
Modify Buffer Data using custom quick process.
@ DISPATCH
Dispatch to external handler for custom processing.
@ TRANSFORM
Apply transformation function to data variants.
std::unordered_map< BufferOperation *, Kakshya::DataVariant > m_operation_data
static void write_to_container(const std::shared_ptr< Kakshya::DynamicSoundStream > &container, const Kakshya::DataVariant &data)
void capture_operation(BufferOperation &op, uint64_t cycle)
std::vector< BufferOperation > m_operations
static Kakshya::DataVariant read_from_container(const std::shared_ptr< Kakshya::DynamicSoundStream > &container, uint64_t start, uint32_t length)
static void write_to_buffer(const std::shared_ptr< Buffers::AudioBuffer > &buffer, const Kakshya::DataVariant &data)
std::shared_ptr< Buffers::BufferManager > m_buffer_manager
static Kakshya::DataVariant extract_buffer_data(const std::shared_ptr< Buffers::AudioBuffer > &buffer, bool should_process=false)
@ AUDIO_BACKEND
Standard audio processing backend configuration.
@ CoroutineScheduling
Coroutine scheduling and temporal coordination (Vruta::TaskScheduler)
void error_rethrow(Component component, Context context, std::source_location location=std::source_location::current(), std::string_view additional_context="")
Catch and log an exception, then rethrow it.
@ Kriya
Automatable tasks and fluent scheduling api for Nodes and Buffers.
std::variant< std::vector< double >, std::vector< float >, std::vector< uint8_t >, std::vector< uint16_t >, std::vector< uint32_t >, std::vector< std::complex< float > >, std::vector< std::complex< double > >, std::vector< glm::vec2 >, std::vector< glm::vec3 >, std::vector< glm::vec4 >, std::vector< glm::mat4 > > DataVariant
Multi-type data storage for different precision needs.
constexpr std::string_view enum_to_string(EnumType value) noexcept
Universal enum to string converter using magic_enum (original case)