Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
79b7092
SampleTrack: Uncomment disabled recording-related code.
Reflexe Nov 6, 2017
50cc41a
Mixer & PlayHandle: Support PlayHandle without audioPort and set
Reflexe Nov 6, 2017
b8938fd
SampleTrack: Make sure an empty TCO with isRecord would still be
Reflexe Nov 8, 2017
ed7ff82
SampleTrack: In a case of recording, play a sample TCO even if its
Reflexe Nov 17, 2017
7184ce6
SampleRecordHandle: Obtain the offset to the record with a parameter
Reflexe Nov 17, 2017
333f43c
fixup: fix formatting issues
Reflexe May 17, 2021
cf9cea8
DataFile: Skip empty resource attributes
Reflexe Oct 23, 2021
1b39d39
Recoding: Disable recording buttons when recording is unavailable
Reflexe Dec 4, 2021
ca72d5b
Merge branch 'master'
PhysSong Feb 2, 2022
99d97fc
Fix indentation
PhysSong Feb 2, 2022
dfed374
Minor formatting changes
PhysSong Feb 3, 2022
2f02148
Merge branch 'master' into feature/recording-stage-one
PhysSong Mar 26, 2022
17efb13
Fix missing include after merge
PhysSong Mar 26, 2022
b2f3a1f
Merge branch 'master' into feature/recording-stage-one
PhysSong Aug 2, 2022
ed703c0
Merge branch 'master' into feature/recording-stage-one
PhysSong Oct 30, 2022
f254829
Merge branch 'master' into feature/recording-stage-one
PhysSong Jul 2, 2023
397b8d9
Merge branch 'master' into feature/recording-stage-one
zonkmachine Oct 10, 2023
9324658
Merge remote-tracking branch 'origin/master' into feature/recording-s…
michaelgregorius May 31, 2024
18efc12
Move "Rec" to lower left
michaelgregorius May 31, 2024
33139b9
Enable configuration of input device for SDL
michaelgregorius Jun 1, 2024
29c43c2
Provide a setting for system default input
michaelgregorius Jun 1, 2024
1ab45e4
Configuration of output device for SDL
michaelgregorius Jun 1, 2024
a123d0e
Ensure label visibility
michaelgregorius Jun 1, 2024
1f0cda4
Rename "Device"
michaelgregorius Jun 1, 2024
f9ea970
Remove repeated strings
michaelgregorius Jun 1, 2024
48c4dce
More prominent recording option
michaelgregorius Jun 2, 2024
5495530
Recording widget/options visibility
michaelgregorius Jun 2, 2024
3b7e330
Apply code review
sakertooth Jun 2, 2024
14c16be
Do not include ClipView.h
sakertooth Jun 2, 2024
d8c2716
Remove recording button
michaelgregorius Jun 14, 2024
3a3c213
Revert wording to match MIDI recording
tresf Jun 14, 2024
c1e5de5
Code review changes
michaelgregorius Jun 15, 2024
a1675e4
Adjust rendering of BarModelEditor (#7299)
michaelgregorius May 31, 2024
568abed
Add peak indicators (#7295)
michaelgregorius Jun 1, 2024
fbcf436
Change the wording of Instrument Plugin Dialogue (#7301)
AW1534 Jun 1, 2024
6ee0d9b
Modernize compiler and linker flags (#7255)
Rossmaxx Jun 2, 2024
d356b71
Fix noise generator (#7318)
LostRobotMusic Jun 13, 2024
bb03178
Add support for "factorysample:" prefix / Fix "bassloopes" typo (#7236)
michaelgregorius Jun 14, 2024
c1f3b0b
Remove `debian` folder (#7311)
Rossmaxx Jun 15, 2024
86073ed
Use `src_set_ratio` to fix artifacts within `Sample` playback (#7321)
sakertooth Jun 15, 2024
b1f0f89
arpeggiator sorted mode fixed (#7025)
szeli1 Jun 17, 2024
1ea27c0
Suppress warnings in third-party code (#7319)
DomClark Jun 17, 2024
f00f0c0
set "child subreaper" process attribute on Linux (#7315)
notaz Jun 18, 2024
a5e000f
Fix caching for macOS CI jobs (#7326)
DomClark Jun 18, 2024
b5b6e2d
Merge branch 'master' into sample-recording
Rossmaxx Jul 15, 2024
7d70c8b
remnants of master merge
Rossmaxx Jul 15, 2024
d883acc
Merge remote-tracking branch 'origin/master' into feature/recording-s…
michaelgregorius Aug 10, 2024
d586ea2
Merge remote-tracking branch 'origin/master' into feature/recording-s…
michaelgregorius Aug 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add peak indicators (#7295)
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.
  • Loading branch information
michaelgregorius authored and Rossmaxx committed Jun 21, 2024
commit 568abeddcfff2db7e53d909c07787137f72a95e1
5 changes: 5 additions & 0 deletions data/themes/classic/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,11 @@ lmms--gui--MixerChannelView QGraphicsView {
border-style: none;
}

lmms--gui--PeakIndicator {
background-color: #111811;
font-size: 7pt;
}

/* persistent peak markers for fx peak meters */
lmms--gui--Fader {
qproperty-peakOk: rgb( 74, 253, 133);
Expand Down
5 changes: 5 additions & 0 deletions data/themes/default/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,11 @@ lmms--gui--MixerChannelView QGraphicsView {
border-style: none;
}

lmms--gui--PeakIndicator {
background-color: #111811;
font-size: 7pt;
}

/* persistent peak markers for fx peak meters */
lmms--gui--Fader {
qproperty-peakOk: #0ad45c;
Expand Down
3 changes: 3 additions & 0 deletions include/Fader.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ class LMMS_EXPORT Fader : public QWidget, public FloatModelView
setUnit(txt_after);
}

signals:
void peakChanged(float peak);

private:
void contextMenuEvent(QContextMenuEvent* me) override;
void mousePressEvent(QMouseEvent* ev) override;
Expand Down
5 changes: 5 additions & 0 deletions include/MixerChannelView.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ namespace lmms

namespace lmms::gui
{
class PeakIndicator;

constexpr int MIXER_CHANNEL_INNER_BORDER_SIZE = 3;
constexpr int MIXER_CHANNEL_OUTER_BORDER_SIZE = 1;

Expand Down Expand Up @@ -90,6 +92,8 @@ namespace lmms::gui
QColor strokeInnerInactive() const;
void setStrokeInnerInactive(const QColor& c);

void reset();

public slots:
void renameChannel();
void resetColor();
Expand Down Expand Up @@ -119,6 +123,7 @@ namespace lmms::gui
QLabel* m_receiveArrow;
PixmapButton* m_muteButton;
PixmapButton* m_soloButton;
PeakIndicator* m_peakIndicator = nullptr;
Fader* m_fader;
EffectRackView* m_effectRackView;
MixerView* m_mixerView;
Expand Down
60 changes: 60 additions & 0 deletions include/PeakIndicator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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
1 change: 1 addition & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ SET(LMMS_SRCS
gui/widgets/MixerChannelLcdSpinBox.cpp
gui/widgets/NStateButton.cpp
gui/widgets/Oscilloscope.cpp
gui/widgets/PeakIndicator.cpp
gui/widgets/PixmapButton.cpp
gui/widgets/SimpleTextFloat.cpp
gui/widgets/TabBar.cpp
Expand Down
10 changes: 10 additions & 0 deletions src/gui/MixerChannelView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "Mixer.h"
#include "MixerChannelView.h"
#include "MixerView.h"
#include "PeakIndicator.h"
#include "Song.h"
#include "ConfigManager.h"

Expand Down Expand Up @@ -121,6 +122,9 @@ namespace lmms::gui

m_fader = new Fader{&mixerChannel->m_volumeModel, tr("Fader %1").arg(channelIndex), this};

m_peakIndicator = new PeakIndicator(this);
connect(m_fader, &Fader::peakChanged, m_peakIndicator, &PeakIndicator::updatePeak);

m_effectRackView = new EffectRackView{&mixerChannel->m_fxChain, mixerView->m_racksWidget};
m_effectRackView->setFixedWidth(EffectRackView::DEFAULT_WIDTH);

Expand All @@ -133,6 +137,7 @@ namespace lmms::gui
mainLayout->addWidget(m_channelNumberLcd, 0, Qt::AlignHCenter);
mainLayout->addWidget(m_renameLineEditView, 0, Qt::AlignHCenter);
mainLayout->addLayout(soloMuteLayout, 0);
mainLayout->addWidget(m_peakIndicator);
mainLayout->addWidget(m_fader, 1, Qt::AlignHCenter);

connect(m_renameLineEdit, &QLineEdit::editingFinished, this, &MixerChannelView::renameFinished);
Expand Down Expand Up @@ -340,6 +345,11 @@ namespace lmms::gui
m_strokeInnerInactive = c;
}

void MixerChannelView::reset()
{
m_peakIndicator->resetPeakToMinusInf();
}

void MixerChannelView::renameChannel()
{
m_inRename = true;
Expand Down
2 changes: 2 additions & 0 deletions src/gui/MixerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@ void MixerView::clear()
for (auto i = m_mixerChannelViews.size() - 1; i > 0; --i) { deleteChannel(i); }
getMixer()->clearChannel(0);

m_mixerChannelViews[0]->reset();

refreshDisplay();
}

Expand Down
4 changes: 2 additions & 2 deletions src/gui/widgets/Fader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,22 +207,22 @@ void Fader::wheelEvent (QWheelEvent* ev)
///
void Fader::setPeak(float fPeak, float& targetPeak, float& persistentPeak, QElapsedTimer& lastPeakTimer)
{
fPeak = std::clamp(fPeak, m_fMinPeak, m_fMaxPeak);

if (targetPeak != fPeak)
{
targetPeak = fPeak;
if (targetPeak >= persistentPeak)
{
persistentPeak = targetPeak;
lastPeakTimer.restart();
emit peakChanged(persistentPeak);
}
update();
}

if (persistentPeak > 0 && lastPeakTimer.elapsed() > 1500)
{
persistentPeak = qMax<float>(0, persistentPeak-0.05);
emit peakChanged(persistentPeak);
update();
}
}
Expand Down
84 changes: 84 additions & 0 deletions src/gui/widgets/PeakIndicator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* PeakIndicator.cpp - 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.
*
*/

#include "PeakIndicator.h"

#include "lmms_math.h"

#include <QBoxLayout>
#include <QMouseEvent>


namespace lmms::gui
{

PeakIndicator::PeakIndicator(QWidget* parent) :
QLabel(parent),
m_peak(0.f)
{
setAlignment(Qt::AlignCenter);

updatePeakDisplay();
}

void PeakIndicator::resetPeakToMinusInf()
{
m_peak = 0;
updatePeakDisplay();
}

void PeakIndicator::updatePeak(float peak)
{
if (peak > m_peak)
{
m_peak = peak;
updatePeakDisplay();
}
}

void PeakIndicator::mousePressEvent(QMouseEvent* e)
{
if (e->buttons() & Qt::LeftButton)
{
resetPeakToMinusInf();
}
}

void PeakIndicator::updatePeakDisplay()
{
// Treat everything below -144 dbFS as -inf. Otherwise some residual signals show up
// in the form of very small dbFS values, e.g. -857.1 dbFS.
// TODO Make the threshold configurable in the settings?
if (m_peak <= dbfsToAmp(-144.))
{
setText(tr("-inf"));
}
else
{
auto dbfs = ampToDbfs(m_peak);
setText(QString::number(dbfs, 'f', 1));
}
}

} // namespace lmms::gui