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 1 commit 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
28 changes: 13 additions & 15 deletions UI/volume-control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ VolumeMeter::VolumeMeter(QWidget *parent, obs_volmeter_t *obs_volmeter, bool ver
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 @@ -1111,18 +1111,17 @@ void VolumeMeter::paintHMeter(QPainter &painter, int x, int y, int width, int he
int errorLength = maximumPosition - errorPosition;
locker.unlock();

if (clipping) {
peakPosition = maximumPosition;
}
if (clipping)
peak = clipLevel + 0.1f;

if (peakPosition < minimumPosition) {
if (peak < minimumLevel) {
painter.fillRect(minimumPosition, y, nominalLength, height,
muted ? backgroundNominalColorDisabled : backgroundNominalColor);
painter.fillRect(warningPosition, y, warningLength, height,
muted ? backgroundWarningColorDisabled : backgroundWarningColor);
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 : foregroundNominalColor);
painter.fillRect(peakPosition, y, warningPosition - peakPosition, height,
Expand All @@ -1131,7 +1130,7 @@ void VolumeMeter::paintHMeter(QPainter &painter, int x, int y, int width, int he
muted ? backgroundWarningColorDisabled : backgroundWarningColor);
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);
painter.fillRect(warningPosition, y, peakPosition - warningPosition, height,
Expand All @@ -1140,7 +1139,7 @@ void VolumeMeter::paintHMeter(QPainter &painter, int x, int y, int width, int he
muted ? backgroundWarningColorDisabled : backgroundWarningColor);
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);
painter.fillRect(warningPosition, y, warningLength, height,
Expand Down Expand Up @@ -1195,18 +1194,17 @@ void VolumeMeter::paintVMeter(QPainter &painter, int x, int y, int width, int he
int errorLength = maximumPosition - errorPosition;
locker.unlock();

if (clipping) {
peakPosition = maximumPosition;
}
if (clipping)
peak = clipLevel + 0.1f;

if (peakPosition < minimumPosition) {
if (peak < minimumLevel) {
painter.fillRect(x, minimumPosition, width, nominalLength,
muted ? backgroundNominalColorDisabled : backgroundNominalColor);
painter.fillRect(x, warningPosition, width, warningLength,
muted ? backgroundWarningColorDisabled : backgroundWarningColor);
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 : foregroundNominalColor);
painter.fillRect(x, peakPosition, width, warningPosition - peakPosition,
Expand All @@ -1215,7 +1213,7 @@ void VolumeMeter::paintVMeter(QPainter &painter, int x, int y, int width, int he
muted ? backgroundWarningColorDisabled : backgroundWarningColor);
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);
painter.fillRect(x, warningPosition, width, peakPosition - warningPosition,
Expand All @@ -1224,7 +1222,7 @@ void VolumeMeter::paintVMeter(QPainter &painter, int x, int y, int width, int he
muted ? backgroundWarningColorDisabled : backgroundWarningColor);
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);
painter.fillRect(x, warningPosition, width, warningLength,
Expand Down
Loading