Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Change clip level to 0.0 dB #11230

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
20 changes: 10 additions & 10 deletions UI/volume-control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ VolumeMeter::VolumeMeter(QWidget *parent, obs_volmeter_t *obs_volmeter,
minimumLevel = -60.0; // -60 dB
warningLevel = -20.0; // -20 dB
errorLevel = -9.0; // -9 dB
clipLevel = -0.5; // -0.5 dB
clipLevel = 0.0; // 0 dB
minimumInputLevel = -50.0; // -50 dB
peakDecayRate = 11.76; // 20 dB / 1.7 sec
magnitudeIntegrationTime = 0.3; // 99% in 300 ms
Expand Down Expand Up @@ -1191,7 +1191,7 @@ void VolumeMeter::paintHMeter(QPainter &painter, int x, int y, int width,
peakPosition = maximumPosition;
}

if (peakPosition < minimumPosition) {
if (peak < minimumLevel) {
painter.fillRect(minimumPosition, y, nominalLength, height,
muted ? backgroundNominalColorDisabled
: backgroundNominalColor);
Expand All @@ -1201,7 +1201,7 @@ void VolumeMeter::paintHMeter(QPainter &painter, int x, int y, int width,
painter.fillRect(errorPosition, y, errorLength, height,
muted ? backgroundErrorColorDisabled
: backgroundErrorColor);
} else if (peakPosition < warningPosition) {
} else if (peak < warningLevel) {
painter.fillRect(minimumPosition, y,
peakPosition - minimumPosition, height,
muted ? foregroundNominalColorDisabled
Expand All @@ -1216,7 +1216,7 @@ void VolumeMeter::paintHMeter(QPainter &painter, int x, int y, int width,
painter.fillRect(errorPosition, y, errorLength, height,
muted ? backgroundErrorColorDisabled
: backgroundErrorColor);
} else if (peakPosition < errorPosition) {
} else if (peak < errorLevel) {
painter.fillRect(minimumPosition, y, nominalLength, height,
muted ? foregroundNominalColorDisabled
: foregroundNominalColor);
Expand All @@ -1231,7 +1231,7 @@ void VolumeMeter::paintHMeter(QPainter &painter, int x, int y, int width,
painter.fillRect(errorPosition, y, errorLength, height,
muted ? backgroundErrorColorDisabled
: backgroundErrorColor);
} else if (peakPosition < maximumPosition) {
} else if (peak <= clipLevel) {
painter.fillRect(minimumPosition, y, nominalLength, height,
muted ? foregroundNominalColorDisabled
: foregroundNominalColor);
Expand All @@ -1246,7 +1246,7 @@ void VolumeMeter::paintHMeter(QPainter &painter, int x, int y, int width,
maximumPosition - peakPosition, height,
muted ? backgroundErrorColorDisabled
: backgroundErrorColor);
} else if (int(magnitude) != 0) {
} else {
if (!clipping) {
QTimer::singleShot(CLIP_FLASH_DURATION_MS, this,
[&]() { clipping = false; });
Expand Down Expand Up @@ -1303,7 +1303,7 @@ void VolumeMeter::paintVMeter(QPainter &painter, int x, int y, int width,
peakPosition = maximumPosition;
}

if (peakPosition < minimumPosition) {
if (peak < minimumLevel) {
painter.fillRect(x, minimumPosition, width, nominalLength,
muted ? backgroundNominalColorDisabled
: backgroundNominalColor);
Expand All @@ -1313,7 +1313,7 @@ void VolumeMeter::paintVMeter(QPainter &painter, int x, int y, int width,
painter.fillRect(x, errorPosition, width, errorLength,
muted ? backgroundErrorColorDisabled
: backgroundErrorColor);
} else if (peakPosition < warningPosition) {
} else if (peak < warningLevel) {
painter.fillRect(x, minimumPosition, width,
peakPosition - minimumPosition,
muted ? foregroundNominalColorDisabled
Expand All @@ -1328,7 +1328,7 @@ void VolumeMeter::paintVMeter(QPainter &painter, int x, int y, int width,
painter.fillRect(x, errorPosition, width, errorLength,
muted ? backgroundErrorColorDisabled
: backgroundErrorColor);
} else if (peakPosition < errorPosition) {
} else if (peak < errorLevel) {
painter.fillRect(x, minimumPosition, width, nominalLength,
muted ? foregroundNominalColorDisabled
: foregroundNominalColor);
Expand All @@ -1343,7 +1343,7 @@ void VolumeMeter::paintVMeter(QPainter &painter, int x, int y, int width,
painter.fillRect(x, errorPosition, width, errorLength,
muted ? backgroundErrorColorDisabled
: backgroundErrorColor);
} else if (peakPosition < maximumPosition) {
} else if (peak <= clipLevel) {
painter.fillRect(x, minimumPosition, width, nominalLength,
muted ? foregroundNominalColorDisabled
: foregroundNominalColor);
Expand Down