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