LCOV - code coverage report
Current view: top level - src/gui/components - knob.h (source / functions) Coverage Total Hit
Test: merged.info Lines: 100.0 % 7 7
Test Date: 2026-06-07 15:51:50 Functions: - 0 0

            Line data    Source code
       1              : #pragma once
       2              : 
       3              : #include <imgui.h>
       4              : 
       5              : #include <functional>
       6              : #include <string>
       7              : 
       8              : namespace Amplitron {
       9              : 
      10          410 : struct KnobProps {
      11              :     std::string name;
      12          205 :     float value = 0.0f;
      13          205 :     float min_val = 0.0f;
      14          205 :     float max_val = 1.0f;
      15          205 :     float default_val = 0.0f;
      16              :     std::string unit;
      17              :     std::string tooltip;
      18              : 
      19              :     // MIDI status
      20          205 :     bool is_learning = false;
      21              :     std::string midi_info;
      22              : 
      23              :     // Color theme
      24          205 :     ImVec4 led_color = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
      25              : 
      26              :     // Callback events
      27              :     std::function<void(float)> on_value_changed;
      28              :     std::function<void(float, float)> on_value_committed;  // old_val, new_val
      29              :     std::function<void()> on_midi_learn_param;
      30              :     std::function<void()> on_midi_clear_param;
      31              :     std::function<void()> on_midi_learn_bypass;
      32              :     std::function<void()> on_midi_clear_bypass;
      33              : };
      34              : 
      35              : class KnobComponent {
      36              :    public:
      37              :     /**
      38              :      * @brief Render a reusable parameter rotary knob.
      39              :      * @param imgui_id Unique ID string for ImGui tracking.
      40              :      * @param props    Configuration, current state, and callbacks.
      41              :      * @param zoom     DPI / GUI zoom multiplier.
      42              :      * @param center   Center coordinates where the knob should be drawn.
      43              :      */
      44              :     static void render(const char* imgui_id, const KnobProps& props, float zoom, ImVec2 center);
      45              : };
      46              : 
      47              : }  // namespace Amplitron
        

Generated by: LCOV version 2.0-1