From 14c53f269427a1dcce350fc1ad98a34b387820ca Mon Sep 17 00:00:00 2001 From: Denny Sheirer Date: Sat, 21 Nov 2026 02:57:20 -0500 Subject: [PATCH] #2738 Master mute disables the channel audio level meters (#2739) Co-authored-by: denny --- .../dsheirer/gui/audio/AudioChannelView.java | 9 +++++++++ .../github/dsheirer/gui/audio/AudioView.java | 7 ++++++- .../github/dsheirer/gui/audio/LevelMeter.java | 19 +++++++++++++++++-- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/dsheirer/gui/audio/AudioChannelView.java b/src/main/java/io/github/dsheirer/gui/audio/AudioChannelView.java index 6cdbbbdb..1c5d9ace 100644 --- a/src/main/java/io/github/dsheirer/gui/audio/AudioChannelView.java +++ b/src/main/java/io/github/dsheirer/gui/audio/AudioChannelView.java @@ -242,6 +242,15 @@ public class AudioChannelView extends HBox updateDisplay(); } + /** + * Disables the level meter while the whole audio output (every channel) is muted. + * @param outputMuted true when every channel is muted + */ + public void setOutputMuted(boolean outputMuted) + { + mLevelMeter.setDisable(outputMuted); + } + /** * Updates the muted display after the channel or the whole output was (un)muted. */ diff --git a/src/main/java/io/github/dsheirer/gui/audio/AudioView.java b/src/main/java/io/github/dsheirer/gui/audio/AudioView.java index 46cb31d4..3979245e 100644 --- a/src/main/java/io/github/dsheirer/gui/audio/AudioView.java +++ b/src/main/java/io/github/dsheirer/gui/audio/AudioView.java @@ -302,7 +302,7 @@ public class AudioView extends HBox } /** - * Updates the master mute button. The output is muted when every channel is muted. + * Updates the master mute button and disables the channel level meters when every channel is muted. */ private void updateMuted() { @@ -313,6 +313,11 @@ public class AudioView extends HBox muted &= view.getAudioChannel().isMuted(); } + for(AudioChannelView view: mChannelViews) + { + view.setOutputMuted(muted); + } + mMuteButton.setSelected(muted); mMuteIcon.setIconCode(muted ? FontAwesome.VOLUME_OFF : FontAwesome.VOLUME_UP); mMuteButton.setTooltip(new Tooltip(muted ? "Unmute all audio" : "Mute all audio")); diff --git a/src/main/java/io/github/dsheirer/gui/audio/LevelMeter.java b/src/main/java/io/github/dsheirer/gui/audio/LevelMeter.java index 9c02df04..4e6c1dc7 100644 --- a/src/main/java/io/github/dsheirer/gui/audio/LevelMeter.java +++ b/src/main/java/io/github/dsheirer/gui/audio/LevelMeter.java @@ -26,7 +26,8 @@ import javafx.scene.paint.Color; /** * Segmented horizontal audio level meter in dBFS with peak hold and level ballistics. Feed it with peak sample - * levels via {@link #update(float)} at a steady rate from the JavaFX application thread. + * levels via {@link #update(float)} at a steady rate from the JavaFX application thread. While the meter is + * disabled, for example when the whole audio output is muted, it shows silence and ignores updates. */ public class LevelMeter extends Region { @@ -70,6 +71,10 @@ public class LevelMeter extends Region setPrefHeight(PREFERRED_HEIGHT); setMaxHeight(PREFERRED_HEIGHT); setMinWidth(40); + disabledProperty().addListener((observable, wasDisabled, disabled) -> { + updateOpacity(); + reset(); + }); } /** @@ -78,6 +83,11 @@ public class LevelMeter extends Region */ public void update(float peak) { + if(isDisabled()) + { + return; + } + double db = peak > 0.0f ? Math.max(MINIMUM_DB, Math.min(MAXIMUM_DB, 20.0 * Math.log10(peak))) : MINIMUM_DB; double level = Math.max(db, mLevelDb - mFallPerUpdateDb); @@ -111,10 +121,15 @@ public class LevelMeter extends Region if(mDimmed != dimmed) { mDimmed = dimmed; - mCanvas.setOpacity(dimmed ? 0.45 : 1.0); + updateOpacity(); } } + private void updateOpacity() + { + mCanvas.setOpacity(isDisabled() ? 0.3 : mDimmed ? 0.45 : 1.0); + } + /** * Resets the meter to silence. */