Line data Source code
1 : #pragma once
2 :
3 : #include <imgui.h>
4 :
5 : #include <functional>
6 : #include <memory>
7 : #include <string>
8 :
9 : namespace Amplitron {
10 :
11 : class Effect;
12 : class IAudioEngine;
13 : class GuiMidi;
14 :
15 : enum class ScreenType { Tuner, Cabinet, Looper, MultiBandCompressor };
16 :
17 46 : struct ScreenProps {
18 : ScreenType type;
19 : std::shared_ptr<Effect> effect;
20 23 : int index = 0;
21 23 : IAudioEngine* engine = nullptr;
22 23 : GuiMidi* gui_midi = nullptr;
23 :
24 : // Callback events for undo-able parameter changes
25 : std::function<void(int, float, float)> on_commit_param_change; // param_index, old_val, new_val
26 : };
27 :
28 : class ScreenComponent {
29 : public:
30 : /**
31 : * @brief Render a reusable screen display component for complex pedals (Tuner, Cabinet, Looper,
32 : * MultiBandCompressor).
33 : * @param dl ImDrawList pointer to draw custom shapes.
34 : * @param p0 Top-left corner position of the screen or display region.
35 : * @param pedal_width Width of the pedal containing this screen.
36 : * @param zoom DPI zoom multiplier.
37 : * @param props Configuration, references, and event callbacks.
38 : */
39 : static void render(ImDrawList* dl, ImVec2 p0, float pedal_width, float zoom,
40 : const ScreenProps& props);
41 :
42 : private:
43 : static void render_tuner_display(ImDrawList* dl, ImVec2 p0, float pedal_width, float zoom,
44 : const ScreenProps& props);
45 : static void render_ir_cabinet_display(ImDrawList* dl, ImVec2 p0, float pedal_width, float zoom,
46 : const ScreenProps& props);
47 : static void render_looper_display(ImDrawList* dl, ImVec2 p0, float pedal_width, float zoom,
48 : const ScreenProps& props);
49 : static void render_multiband_compressor_display(ImDrawList* dl, ImVec2 p0, float pedal_width,
50 : float zoom, const ScreenProps& props);
51 : };
52 :
53 : } // namespace Amplitron
|