blob: 4d687fbccc19273cd062d06c6d54bcf9c14a8da7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
; this test should display a plot of x^2
; it gives an example of constructing a DSP primitive
; (in this case, product) using Lisp rather than C
; for the computation
(setf product-class (send class :new '(s1 s2)))
(send product-class :answer :next '()
'((let ((f1 (snd-fetch s1))
(f2 (snd-fetch s2)))
(cond ((and f1 f2)
(* f1 f2))
(t nil)))))
(send product-class :answer :isnew '(p1 p2)
'((setf s1 (snd-copy p1))
(setf s2 (snd-copy p2))))
(defun snd-product (s1 s2)
(let (obj)
(setf obj (send product-class :new s1 s2))
(snd-fromobject (snd-t0 s1) (snd-srate s1) obj)))
(set-control-srate 100)
(s-plot (snd-product (ramp) (ramp)))
|