diff --git a/audio_effects.py b/audio_effects.py index bbf01df..8103c55 100644 --- a/audio_effects.py +++ b/audio_effects.py @@ -265,17 +265,25 @@ class AudioEffects: def count_active_effects(cls, **effects) -> int: """Count how many effects are active (non-default).""" count = 0 - if effects.get("pitch", cls.PITCH_DEFAULT) != cls.PITCH_DEFAULT: + # Convert values to proper types (JSON stores them as strings) + pitch = int(effects.get("pitch", cls.PITCH_DEFAULT)) + speed = float(effects.get("speed", cls.SPEED_DEFAULT)) + echo = int(effects.get("echo", cls.ECHO_DEFAULT)) + robot = int(effects.get("robot", cls.ROBOT_DEFAULT)) + chorus = int(effects.get("chorus", cls.CHORUS_DEFAULT)) + tremolo_depth = float(effects.get("tremolo_depth", cls.TREMOLO_DEPTH_DEFAULT)) + + if pitch != cls.PITCH_DEFAULT: count += 1 - if effects.get("speed", cls.SPEED_DEFAULT) != cls.SPEED_DEFAULT: + if speed != cls.SPEED_DEFAULT: count += 1 - if effects.get("echo", cls.ECHO_DEFAULT) > cls.ECHO_DEFAULT: + if echo > cls.ECHO_DEFAULT: count += 1 - if effects.get("robot", cls.ROBOT_DEFAULT) > cls.ROBOT_DEFAULT: + if robot > cls.ROBOT_DEFAULT: count += 1 - if effects.get("chorus", cls.CHORUS_DEFAULT) > cls.CHORUS_DEFAULT: + if chorus > cls.CHORUS_DEFAULT: count += 1 - if effects.get("tremolo_depth", cls.TREMOLO_DEPTH_DEFAULT) > cls.TREMOLO_DEPTH_DEFAULT: + if tremolo_depth > cls.TREMOLO_DEPTH_DEFAULT: count += 1 # tremolo_rate only counts if depth is also active return count