mirror of
https://github.com/LMMS/lmms.git
synced 2025-12-23 22:58:33 -05:00
Add peak indicators to the mixer strips. They show the maximum peak value that was observed and can be reset by clicking on them. ## Implementation details The implementation works via a signal/slot mechanism. The `Fader` class has a new signal `peakChanged` which reports peak values as amplifications. A new class `PeakIndicator` is added which has a slot `updatePeak` which is connected to the new signal in `Fader`. The `PeakIndicator` inherits from `QLabel` and mainly deals with updating the label text from the current peak value. Add a `PeakIndicator` instance to `MixerChannelView`. Add a `reset` method to `MixerChannelView` so that the mixer channel can be reset on the loading of new projects, etc. The current implementation resets the peak indicator back to -inf dbFS. The `reset` method is called in `MixerView::clear`. Remove the clamping in `Fader::setPeak` so that all peaks are reported. Emit the new signal if the peak changes.
61 lines
1.4 KiB
C++
61 lines
1.4 KiB
C++
/*
|
|
* PeakIndicator.h - Peak indicator widget
|
|
*
|
|
* Copyright (c) 2024- Michael Gregorius
|
|
*
|
|
* This file is part of LMMS - https://lmms.io
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public
|
|
* License along with this program (see COPYING); if not, write to the
|
|
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
* Boston, MA 02110-1301 USA.
|
|
*
|
|
*/
|
|
|
|
|
|
#ifndef LMMS_GUI_PEAKINDICATOR_H
|
|
#define LMMS_GUI_PEAKINDICATOR_H
|
|
|
|
#include "lmms_export.h"
|
|
|
|
#include <QLabel>
|
|
|
|
|
|
namespace lmms::gui
|
|
{
|
|
|
|
class LMMS_EXPORT PeakIndicator : public QLabel
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
PeakIndicator(QWidget* parent);
|
|
|
|
void resetPeakToMinusInf();
|
|
|
|
public slots:
|
|
void updatePeak(float peak);
|
|
|
|
protected:
|
|
void mousePressEvent(QMouseEvent* e) override;
|
|
|
|
private:
|
|
void updatePeakDisplay();
|
|
|
|
private:
|
|
float m_peak;
|
|
} ;
|
|
|
|
} // namespace lmms::gui
|
|
|
|
#endif // LMMS_GUI_PEAKINDICATOR_H
|