Add value source card crosslinks and fix scene initial value bias

- Audio value source cards link to the referenced audio source
- Adaptive scene cards link to the referenced picture source
- Fix SceneValueStream starting at 0.5 regardless of actual scene;
  first frame now skips smoothing to avoid artificial bias
- Add crosslinks guidance to CLAUDE.md card appearance section

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-26 16:56:26 +03:00
parent dac0c2d418
commit bafd8b4130
3 changed files with 24 additions and 8 deletions

View File

@@ -449,7 +449,7 @@ class SceneValueStream(ValueStream):
self._max = max_value
self._live_stream_manager = live_stream_manager
self._live_stream = None
self._prev_value = 0.5 # neutral start
self._prev_value = None # None = no frame seen yet; skip smoothing on first frame
def start(self) -> None:
if self._live_stream_manager and self._picture_source_id:
@@ -471,15 +471,15 @@ class SceneValueStream(ValueStream):
except Exception as e:
logger.warning(f"SceneValueStream failed to release live stream: {e}")
self._live_stream = None
self._prev_value = 0.5
self._prev_value = None
def get_value(self) -> float:
if self._live_stream is None:
return self._prev_value
return self._prev_value if self._prev_value is not None else 0.0
frame = self._live_stream.get_latest_frame()
if frame is None:
return self._prev_value
return self._prev_value if self._prev_value is not None else 0.0
# Fast luminance: subsample to ~64x64 via numpy stride (zero-copy view)
img = frame.image
@@ -500,8 +500,11 @@ class SceneValueStream(ValueStream):
if self._behavior == "complement":
raw = 1.0 - raw
# Temporal smoothing (EMA)
smoothed = self._smoothing * self._prev_value + (1.0 - self._smoothing) * raw
# Temporal smoothing (EMA) — skip on first frame (no history to blend with)
if self._prev_value is None:
smoothed = raw
else:
smoothed = self._smoothing * self._prev_value + (1.0 - self._smoothing) * raw
self._prev_value = smoothed
# Map to output range