# Qt objects
OBJS=glwidget.o main.o mainwindow.o vumeter.o lrameter.o vu_common.o correlation_meter.o aboutdialog.o input_mapping_dialog.o nonlinear_fader.o
-OBJS += glwidget.moc.o mainwindow.moc.o vumeter.moc.o lrameter.moc.o correlation_meter.moc.o aboutdialog.moc.o ellipsis_label.moc.o input_mapping_dialog.moc.o nonlinear_fader.moc.o
+OBJS += glwidget.moc.o mainwindow.moc.o vumeter.moc.o lrameter.moc.o correlation_meter.moc.o aboutdialog.moc.o ellipsis_label.moc.o input_mapping_dialog.moc.o nonlinear_fader.moc.o clickable_label.moc.o
# Mixer objects
AUDIO_MIXER_OBJS = audio_mixer.o alsa_input.o ebu_r128_proc.o stereocompressor.o resampling_queue.o flags.o correlation_measurer.o filter.o disk_space_estimator.o
lock_guard<timed_mutex> lock(audio_mutex);
return input_mapping;
}
+
+void AudioMixer::reset_peak(unsigned bus_index)
+{
+ lock_guard<timed_mutex> lock(audio_mutex);
+ for (unsigned channel = 0; channel < 2; ++channel) {
+ PeakHistory &history = peak_history[bus_index][channel];
+ history.current_level = 0.0f;
+ history.historic_peak = 0.0f;
+ history.current_peak = 0.0f;
+ history.last_peak = 0.0f;
+ history.age_seconds = 0.0f;
+ }
+}
return final_makeup_gain_auto;
}
+ void reset_peak(unsigned bus_index);
+
struct BusLevel {
float current_level_dbfs[2]; // Digital peak of last frame, left and right.
float peak_level_dbfs[2]; // Digital peak with hold, left and right.
float last_peak = 0.0f;
float age_seconds = 0.0f; // Time since "last_peak" was set.
};
- PeakHistory peak_history[MAX_BUSES][2]; // Separate for each channel.
+ PeakHistory peak_history[MAX_BUSES][2]; // Separate for each channel. Under audio_mutex.
double final_makeup_gain = 1.0; // Under compressor_mutex. Read/write by the user. Note: Not in dB, we want the numeric precision so that we can change it slowly.
bool final_makeup_gain_auto = true; // Under compressor_mutex.
--- /dev/null
+#ifndef _CLICKABLE_LABEL_H
+#define _CLICKABLE_LABEL_H 1
+
+// Just like a normal QLabel, except that it can also emit a clicked signal.
+
+#include <QLabel>
+
+class QMouseEvent;
+
+class ClickableLabel : public QLabel {
+ Q_OBJECT
+
+public:
+ ClickableLabel(QWidget *parent) : QLabel(parent) {}
+
+signals:
+ void clicked();
+
+protected:
+ void mousePressEvent(QMouseEvent *event) override
+ {
+ emit clicked();
+ }
+};
+
+#endif // !defined(_CLICKABLE_LABEL_H)
connect(ui_audio_miniview->fader, &NonLinearFader::dbValueChanged,
bind(&MainWindow::mini_fader_changed, this, bus_index, _1));
+ connect(ui_audio_miniview->peak_display_label, &ClickableLabel::clicked,
+ [bus_index]() {
+ global_mixer->get_audio_mixer()->reset_peak(bus_index);
+ });
}
}
peak_meter->set_max_level(0.0f);
peak_meter->set_ref_level(0.0f);
+ connect(ui_audio_expanded_view->peak_display_label, &ClickableLabel::clicked,
+ [bus_index]() {
+ global_mixer->get_audio_mixer()->reset_peak(bus_index);
+ });
+
// Set up the compression attenuation meter.
VUMeter *reduction_meter = ui_audio_expanded_view->reduction_meter;
reduction_meter->set_min_level(0.0f);
</layout>
</item>
<item>
- <widget class="QLabel" name="peak_display_label">
+ <widget class="ClickableLabel" name="peak_display_label">
<property name="minimumSize">
<size>
<width>60</width>
<extends>QLabel</extends>
<header>ellipsis_label.h</header>
</customwidget>
+ <customwidget>
+ <class>ClickableLabel</class>
+ <extends>QLabel</extends>
+ <header>clickable_label.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
</layout>
</item>
<item>
- <widget class="QLabel" name="peak_display_label">
+ <widget class="ClickableLabel" name="peak_display_label">
<property name="minimumSize">
<size>
<width>30</width>
<extends>QSlider</extends>
<header>nonlinear_fader.h</header>
</customwidget>
+ <customwidget>
+ <class>ClickableLabel</class>
+ <extends>QLabel</extends>
+ <header>clickable_label.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>