From 87bc35bc5bf7092ce7d50ce841f8b5b871aab1d4 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Sat, 19 Sep 2026 21:06:19 -0700 Subject: [PATCH] Invalidate stale curve payoff labels and process waiting blocks once --- roadscore/prototype/curve_reaction.py | 24 ++++++++++++------ roadscore/prototype/test_curve_reaction.py | 29 ++++++++++++++++++++++ 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/roadscore/prototype/curve_reaction.py b/roadscore/prototype/curve_reaction.py index 58c3f366d3..8b837e757c 100644 --- a/roadscore/prototype/curve_reaction.py +++ b/roadscore/prototype/curve_reaction.py @@ -8,20 +8,24 @@ class CurveReaction: self.grid=grid;self.rate=rate;self.enabled=enabled self.dsp=EngagementPresentation(rate,cutoff_hz=1800.,width=.92,gain=1.) self.config=PresentationConfig(enabled=True,attack_ms=130.,release_ms=180.) - self.activation=None;self.payoff=None;self.target=1.;self.phase='neutral';self.fresh=False;self.end_frame=0 + self.activation=None;self.payoff=None;self.target=1.;self.phase='neutral';self.fresh=False;self.end_frame=0;self.valid=False;self.armed=False def process(self,pcm,start_frame,state,source_fresh=True,blocked=False): self.end_frame=start_frame+len(pcm) amount=state.get('amount',0.) self.fresh=bool(source_fresh and isinstance(amount,(int,float)) and math.isfinite(amount)) phase=state.get('phase','neutral');activation=state.get('activation') - valid=self.enabled and self.fresh and not blocked and state.get('kind')=='curve' + identified=isinstance(activation,(int,float)) and not isinstance(activation,bool) and math.isfinite(activation) + valid=self.enabled and self.fresh and not blocked and state.get('kind')=='curve' and identified + self.valid=bool(valid) if activation!=self.activation: - self.activation=activation;self.payoff=None + self.activation=activation;self.payoff=None;self.armed=False + if not valid: + self.payoff=None;self.armed=False target=1. if valid and phase=='anticipation': target=1.-.8*min(1.,max(0.,amount));self.payoff=None - elif valid and phase=='event': + elif valid and phase=='event' and self.armed: if self.payoff is None: step=self.rate*60/self.grid.bpm/2 if self.grid.usable else 0. origin=self.grid.beat_phase*self.rate if self.grid.usable else 0. @@ -35,12 +39,18 @@ class CurveReaction: second=self.dsp.process(pcm[split:],False,self.config,target_mix=1.) self.target=1.;self.phase=phase return np.concatenate((first,second)) + self.target=target;self.phase=phase + return first self.target=target;self.phase=phase - return self.dsp.process(pcm,False,self.config,target_mix=target) + result=self.dsp.process(pcm,False,self.config,target_mix=target) + if valid and phase=='anticipation' and self.dsp.mix<.999:self.armed=True + return result def snapshot(self): + apex=bool(self.valid and self.phase=='event' and self.armed and self.payoff is not None and self.payoff