sclang: ServerShmInterface - try to avoid multiple destructor calls
[supercollider.git] / HelpSource / Classes / LastValue.schelp
blobd9de0b1a442a037e70d28018ae139450bd34d839
1 class:: LastValue
2 summary:: Output the last value before the input changed
3 related:: Classes/LeastChange, Classes/MostChange
4 categories::  UGens>Triggers
7 Description::
9 Output the last value before the input changed more than a threshhold.
12 classmethods::
14 method::ar, kr
16 argument::in
18 The input signal.
21 argument::diff
23 Difference threshhold.
26 Examples::
28 code::
29 d = { arg freq=440; SinOsc.ar(LastValue.ar(freq, 20), 0, 0.2) }.play;
31 d.set(\freq, 400);
32 d.set(\freq, 200);
33 d.set(\freq, 670);
34 d.set(\freq, 680);
35 d.set(\freq, 695);
36 d.free;
39 Return the difference between currrent and the last changed:
40 code::
42 d = { arg out=0, val=1;
43         SinOsc.ar(
44                         abs(val - LastValue.kr(val)) * 400 + 200,
45                         0, 0.2
46         )
47 }.play;
50 d.set(\val, 3);
51 d.set(\val, 2);
52 d.set(\val, 0.2);
53 d.set(\val, 1);
54 d.set(\val, 2);
55 d.free;