LCOV - code coverage report
Current view: top level - src/audio/engine - audio_graph.h (source / functions) Coverage Total Hit
Test: merged.info Lines: 100.0 % 6 6
Test Date: 2026-06-07 15:51:50 Functions: 100.0 % 6 6

            Line data    Source code
       1              : #pragma once
       2              : 
       3              : #include <memory>
       4              : #include <string>
       5              : #include <vector>
       6              : 
       7              : #include "audio/engine/dsp_node.h"
       8              : #include "audio/engine/graph_link.h"
       9              : 
      10              : namespace Amplitron {
      11              : 
      12              : class AudioGraph {
      13              :    public:
      14         3906 :     AudioGraph() = default;
      15         3122 :     ~AudioGraph() = default;
      16              : 
      17              :     // Graph Construction Interface
      18              :     int add_node(const std::string &name, NodeRoutingType type,
      19              :                  std::shared_ptr<Effect> pedal = nullptr, int num_inputs = 0);
      20              :     bool remove_node(int node_id);
      21              :     int add_link(int source_pin_id, int dest_pin_id);
      22              :     bool remove_link(int link_id);
      23              : 
      24              :     void set_node_as_input(int node_id, bool is_input);
      25              :     void set_node_as_output(int node_id, bool is_output);
      26              :     void set_node_position(int node_id, float x, float y);
      27              : 
      28              :     // Topological Order & Loop Validation Core
      29              :     bool rebuild_topology();
      30              : 
      31              :     // For Undo/Redo System (forces cache reload)
      32              :     void restore_node(const DSPNode &node);
      33              :     void restore_link(const GraphLink &link);
      34              : 
      35              :     // Dynamic Mixer API
      36              :     bool add_input_pin(int node_id);
      37              :     bool remove_input_pin(int node_id, int pin_id = -1);
      38              :     void set_mixer_input_gain(int node_id, size_t pin_index, float gain);
      39              :     void restore_input_pin(int node_id, int pin_id, int index, float gain);
      40              : 
      41              :     // Dynamic Splitter API
      42              :     bool add_output_pin(int node_id);
      43              :     bool remove_output_pin(int node_id, int pin_id = -1);
      44              :     void restore_output_pin(int node_id, int pin_id, int index);
      45              : 
      46              :     // Accessors
      47         2515 :     const std::vector<int> &get_sorted_nodes() const { return sorted_node_ids_; }
      48         8921 :     const std::vector<DSPNode> &get_nodes() const { return nodes_; }
      49         2812 :     const std::vector<GraphLink> &get_links() const { return links_; }
      50              : 
      51              :     int get_node_from_pin(int pin_id) const;
      52              :     const DSPNode *find_node(int node_id) const;
      53              : 
      54              :    private:
      55              :     size_t get_node_index(int node_id) const;
      56              : 
      57          784 :     int next_id_ = 1;
      58              :     std::vector<DSPNode> nodes_;
      59              :     std::vector<GraphLink> links_;
      60              :     std::vector<int> sorted_node_ids_;
      61              : };
      62              : 
      63              : }  // namespace Amplitron
        

Generated by: LCOV version 2.0-1