15 #include "audio_mixer.h"
16 #include "midi_mapper.h"
24 class Ui_AudioExpandedView;
27 class AudioExpandedView;
36 class MainWindow : public QMainWindow, public ControllerReceiver
42 void resizeEvent(QResizeEvent *event) override;
43 void mixer_created(Mixer *mixer);
45 // Used to release FBOs on the global ResourcePool. Call after the
46 // mixer has been shut down but not destroyed yet.
47 void mixer_shutting_down();
51 void x264_bitrate_triggered();
52 void exit_triggered();
53 void manual_triggered();
54 void about_triggered();
55 void open_analyzer_triggered();
56 void simple_audio_mode_triggered();
57 void multichannel_audio_mode_triggered();
58 void input_mapping_triggered();
59 void midi_mapping_triggered();
60 void timecode_stream_triggered();
61 void timecode_stdout_triggered();
62 void transition_clicked(int transition_number);
63 void channel_clicked(int channel_number);
64 void quick_cut_activated(int channel_number);
65 void wb_button_clicked(int channel_number);
66 void audio_view_changed(int audio_view);
67 void set_transition_names(std::vector<std::string> transition_names);
68 void update_channel_name(Mixer::Output output, const std::string &name);
69 void update_channel_color(Mixer::Output output, const std::string &color);
70 void gain_staging_knob_changed(unsigned bus_index, int value);
71 void final_makeup_gain_knob_changed(int value);
72 void cutoff_knob_changed(int value);
73 void stereo_width_knob_changed(unsigned bus_index, int value);
74 void eq_knob_changed(unsigned bus_index, EQBand band, int value);
75 void limiter_threshold_knob_changed(int value);
76 void compressor_threshold_knob_changed(unsigned bus_index, int value);
77 void mini_fader_changed(int bus, double db_volume);
78 void mute_button_toggled(int bus, bool checked);
79 void reset_meters_button_clicked();
82 // ControllerReceiver interface.
83 void set_locut(float value) override;
84 void set_limiter_threshold(float value) override;
85 void set_makeup_gain(float value) override;
87 void set_stereo_width(unsigned bus_idx, float value) override;
88 void set_treble(unsigned bus_idx, float value) override;
89 void set_mid(unsigned bus_idx, float value) override;
90 void set_bass(unsigned bus_idx, float value) override;
91 void set_eq_absolute(unsigned bus_idx, EQBand eq_band, float value_db);
92 void set_gain(unsigned bus_idx, float value) override;
93 void set_compressor_threshold(unsigned bus_idx, float value) override;
94 void set_fader(unsigned bus_idx, float value) override;
95 void set_fader_absolute(unsigned bus_idx, float value_db); // Used by the theme only.
97 void toggle_mute(unsigned bus_idx) override;
98 void toggle_locut(unsigned bus_idx) override;
99 void toggle_auto_gain_staging(unsigned bus_idx) override;
100 void toggle_compressor(unsigned bus_idx) override;
101 void clear_peak(unsigned bus_idx) override;
102 void toggle_limiter() override;
103 void toggle_auto_makeup_gain() override;
105 void switch_video_channel(int channel_number) override;
106 void apply_transition(int transition_number) override;
107 void prev_audio_view() override;
108 void next_audio_view() override;
109 void begin_new_segment() override;
110 void exit() override;
112 void clear_all_highlights() override;
114 void highlight_locut(bool highlight) override;
115 void highlight_limiter_threshold(bool highlight) override;
116 void highlight_makeup_gain(bool highlight) override;
118 void highlight_stereo_width(unsigned bus_idx, bool highlight) override;
119 void highlight_treble(unsigned bus_idx, bool highlight) override;
120 void highlight_mid(unsigned bus_idx, bool highlight) override;
121 void highlight_bass(unsigned bus_idx, bool highlight) override;
122 void highlight_gain(unsigned bus_idx, bool highlight) override;
123 void highlight_compressor_threshold(unsigned bus_idx, bool highlight) override;
124 void highlight_fader(unsigned bus_idx, bool highlight) override;
126 void highlight_mute(unsigned bus_idx, bool highlight) override;
127 void highlight_toggle_locut(unsigned bus_idx, bool highlight) override;
128 void highlight_toggle_auto_gain_staging(unsigned bus_idx, bool highlight) override;
129 void highlight_toggle_compressor(unsigned bus_idx, bool highlight) override;
130 void highlight_clear_peak(unsigned bus_idx, bool highlight) override {} // We don't mark this currently.
131 void highlight_toggle_limiter(bool highlight) override;
132 void highlight_toggle_auto_makeup_gain(bool highlight) override;
134 // Raw receivers are not used.
135 void controller_changed(unsigned controller) override {}
136 void note_on(unsigned note) override {}
139 void reset_audio_mapping_ui();
140 void setup_audio_miniview();
141 void setup_audio_expanded_view();
142 bool eventFilter(QObject *watched, QEvent *event) override;
143 void closeEvent(QCloseEvent *event) override;
144 void update_cutoff_labels(float cutoff_hz);
145 void update_stereo_knob_and_label(unsigned bus_index, int stereo_width_percent);
146 void update_stereo_label(unsigned bus_index, int stereo_width_percent);
147 void update_eq_label(unsigned bus_index, EQBand band, float gain_db);
148 void setup_theme_menu();
149 void fill_menu_from_theme_menu(const std::vector<std::unique_ptr<Theme::MenuEntry>> &entries, QMenu *menu);
153 // Called from DiskSpaceEstimator.
154 void report_disk_space(off_t free_bytes, double estimated_seconds_left, double file_length_seconds);
156 // Called from the mixer.
157 void audio_level_callback(float level_lufs, float peak_db, std::vector<AudioMixer::BusLevel> bus_levels, float global_level_lufs, float range_low_lufs, float range_high_lufs, float final_makeup_gain_db, float correlation);
158 std::chrono::steady_clock::time_point last_audio_level_callback;
160 void audio_state_changed();
163 void set_relative_value(T *control, float value);
166 void set_relative_value_if_exists(unsigned bus_idx, T *Ui_AudioExpandedView::*control, float value);
168 void set_db_value_if_exists(unsigned bus_idx, QDial *Ui_AudioExpandedView::*control, float value_db);
171 void click_button_if_exists(unsigned bus_idx, T *Ui_AudioExpandedView::*control);
174 void highlight_control(T *control, bool highlight);
177 void highlight_mute_control(T *control, bool highlight);
180 void highlight_control_if_exists(unsigned bus_idx, T *(Ui_AudioExpandedView::*control), bool highlight, bool is_mute_button = false);
183 QLabel *disk_free_label;
184 QMenu *theme_menu = nullptr;
185 QPushButton *transition_btn1, *transition_btn2, *transition_btn3;
186 std::vector<Ui::Display *> previews;
187 std::vector<Ui::AudioMiniView *> audio_miniviews;
188 std::vector<Ui::AudioExpandedView *> audio_expanded_views;
189 int current_wb_pick_display = -1;
190 int current_audio_view = -1;
191 MIDIMapper midi_mapper;
192 std::unique_ptr<Analyzer> analyzer;
195 extern MainWindow *global_mainwindow;