Skip to content

Commit

Permalink
UI: Change clip level to 0.0 dB
Browse files Browse the repository at this point in the history
This changes the clip level of the volume meters from -0.5 dB to 0.0 dB.
  • Loading branch information
cg2121 committed Nov 15, 2024
1 parent 7979421 commit 5fa1abd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 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 @@ -1115,14 +1115,14 @@ void VolumeMeter::paintHMeter(QPainter &painter, int x, int y, int width, int he
peakPosition = maximumPosition;
}

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 +1131,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 +1140,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 @@ -1199,14 +1199,14 @@ void VolumeMeter::paintVMeter(QPainter &painter, int x, int y, int width, int he
peakPosition = maximumPosition;
}

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 +1215,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 +1224,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

0 comments on commit 5fa1abd

Please sign in to comment.