diff --git a/server/src/wled_controller/storage/value_source.py b/server/src/wled_controller/storage/value_source.py index 965c263..84c91bf 100644 --- a/server/src/wled_controller/storage/value_source.py +++ b/server/src/wled_controller/storage/value_source.py @@ -91,6 +91,8 @@ class ValueSource: mode=data.get("mode") or "rms", sensitivity=float(data.get("sensitivity") or 1.0), smoothing=float(data.get("smoothing") or 0.3), + min_value=float(data.get("min_value") or 0.0), + max_value=float(data["max_value"]) if data.get("max_value") is not None else 1.0, ) if source_type == "adaptive_time": @@ -167,10 +169,12 @@ class AudioValueSource(ValueSource): into a scalar value for brightness modulation. """ - audio_source_id: str = "" # references a MonoAudioSource + audio_source_id: str = "" # references an audio source (mono or multichannel) mode: str = "rms" # rms | peak | beat sensitivity: float = 1.0 # gain multiplier (0.1–5.0) smoothing: float = 0.3 # temporal smoothing (0.0–1.0) + min_value: float = 0.0 # minimum output (0.0–1.0) + max_value: float = 1.0 # maximum output (0.0–1.0) def to_dict(self) -> dict: d = super().to_dict() @@ -178,6 +182,8 @@ class AudioValueSource(ValueSource): d["mode"] = self.mode d["sensitivity"] = self.sensitivity d["smoothing"] = self.smoothing + d["min_value"] = self.min_value + d["max_value"] = self.max_value return d diff --git a/server/src/wled_controller/storage/value_source_store.py b/server/src/wled_controller/storage/value_source_store.py index 9acb494..bfe44ad 100644 --- a/server/src/wled_controller/storage/value_source_store.py +++ b/server/src/wled_controller/storage/value_source_store.py @@ -142,6 +142,8 @@ class ValueSourceStore: mode=mode or "rms", sensitivity=sensitivity if sensitivity is not None else 1.0, smoothing=smoothing if smoothing is not None else 0.3, + min_value=min_value if min_value is not None else 0.0, + max_value=max_value if max_value is not None else 1.0, ) elif source_type == "adaptive_time": schedule_data = schedule or [] @@ -225,6 +227,10 @@ class ValueSourceStore: source.sensitivity = sensitivity if smoothing is not None: source.smoothing = smoothing + if min_value is not None: + source.min_value = min_value + if max_value is not None: + source.max_value = max_value elif isinstance(source, AdaptiveValueSource): if schedule is not None: if source.source_type == "adaptive_time" and len(schedule) < 2: diff --git a/server/src/wled_controller/templates/modals/value-source-editor.html b/server/src/wled_controller/templates/modals/value-source-editor.html index 2085d2e..195bef9 100644 --- a/server/src/wled_controller/templates/modals/value-source-editor.html +++ b/server/src/wled_controller/templates/modals/value-source-editor.html @@ -160,6 +160,32 @@ 0.3 + +
+
+ + +
+ +
+ + 0 +
+
+ +
+
+ + +
+ +
+ + 1 +
+