import { foldback as _foldback } from "@thi.ng/math/interval" ; import { AProc } from "./aproc.js" ; remarks param thresh param amp export const foldback = ( thresh ? , amp ? ) => new Foldback ( thresh , amp ) ; export class Foldback extends AProc < number , number > { constructor ( protected _thresh = 1 , protected _amp = 1 / _thresh ) { super ( 0 ) ; } next ( x ) { return ( this . _val = _foldback ( this . _thresh , x ) * this . _amp ) ; } threshold ( ) { return this . _thresh ; } setThreshold ( t ) { this . _thresh = t ; } amp ( ) { return this . _amp ; } setAmp ( a ) { this . _amp = a ; } }