LCOV - code coverage report
Current view: top level - src/gui/views - gui_midi.h (source / functions) Coverage Total Hit
Test: merged.info Lines: 100.0 % 3 3
Test Date: 2026-06-01 11:15:25 Functions: 100.0 % 2 2

            Line data    Source code
       1              : #pragma once
       2              : 
       3              : #include <string>
       4              : #include <vector>
       5              : 
       6              : namespace Amplitron {
       7              : 
       8              : class MidiManager;
       9              : 
      10              : #ifdef AMPLITRON_NO_MIDI
      11              : 
      12              : // Stub implementation for non-desktop platforms
      13              : class GuiMidi {
      14              : public:
      15              :     explicit GuiMidi(MidiManager& midi) : midi_(midi) {}
      16              :     void render(bool&) {}
      17              :     bool render_learn_menu_item(const std::string&, const std::string&) { return false; }
      18              :     bool render_learn_bypass_item(const std::string&) { return false; }
      19              :     bool render_remove_mapping_item(const std::string&, const std::string&) { return false; }
      20              :     bool render_remove_bypass_item(const std::string&) { return false; }
      21              :     std::string get_mapping_info(const std::string&, const std::string&) const { return ""; }
      22              : 
      23              :     const MidiManager& midi() const { return midi_; }
      24              :     MidiManager& manager() { return midi_; }
      25              : 
      26              : private:
      27              :     MidiManager& midi_;
      28              : };
      29              : 
      30              : #else
      31              : 
      32              : /**
      33              :  * @brief GUI module for MIDI settings window and MIDI Learn integration.
      34              :  *
      35              :  * Renders a floating settings window (port selection, mapping table,
      36              :  * learn status indicator) and provides menu items for knob right-click
      37              :  * popups to enable MIDI Learn.
      38              :  */
      39           33 : class GuiMidi {
      40              : public:
      41              :     explicit GuiMidi(MidiManager& midi);
      42              : 
      43              :     /** @brief Render the MIDI settings floating window. */
      44              :     void render(bool& show);
      45              : 
      46              :     /**
      47              :      * @brief Render a "MIDI Learn" item inside a knob's right-click popup.
      48              :      * @return true if learn was activated (caller should close the popup).
      49              :      */
      50              :     bool render_learn_menu_item(const std::string& effect_name, const std::string& param_name);
      51              : 
      52              :     /**
      53              :      * @brief Render a "MIDI Learn (Bypass)" item for effect bypass toggle.
      54              :      * @return true if learn was activated.
      55              :      */
      56              :     bool render_learn_bypass_item(const std::string& effect_name);
      57              : 
      58              :     /**
      59              :      * @brief Render a "Remove MIDI Mapping" item if one exists.
      60              :      * @return true if mapping was removed.
      61              :      */
      62              :     bool render_remove_mapping_item(const std::string& effect_name, const std::string& param_name);
      63              : 
      64              :     /**
      65              :      * @brief Render a "Remove MIDI Bypass Mapping" item if one exists.
      66              :      * @return true if mapping was removed.
      67              :      */
      68              :     bool render_remove_bypass_item(const std::string& effect_name);
      69              : 
      70              :     /**
      71              :      * @brief Get a formatted string describing the MIDI mapping for a parameter.
      72              :      */
      73              :     std::string get_mapping_info(const std::string& effect_name, const std::string& param_name) const;
      74              : 
      75              :     /** @brief Access the underlying MIDI manager (const). */
      76         1485 :     const MidiManager& midi() const { return midi_; }
      77              : 
      78              :     /** @brief Access the underlying MIDI manager (mutable). */
      79           39 :     MidiManager& manager() { return midi_; }
      80              : 
      81              : private:
      82              :     MidiManager& midi_;
      83              :     std::vector<std::string> cached_ports_;
      84              : };
      85              : 
      86              : #endif // AMPLITRON_NO_MIDI
      87              : 
      88              : } // namespace Amplitron
        

Generated by: LCOV version 2.0-1