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 31 32 33 34 35 36
|
(FROMOBJ-ALG
(NAME "fromobject")
(ARGUMENTS ("time_type" "t0") ("rate_type" "sr") ("LVAL" "src"))
(SUPPORT-FUNCTIONS "
/* IMPLEMENTATION NOTE:
* The src argument is an XLisp object that returns either a
* FLONUM sample or NIL. The output of fromobj is simply the
* sequence of the samples.
*/
#include \"samples.h\"
")
(SAMPLE-RATE "sr")
(STATE
("boolean" "done" "false")
("LVAL" "src" "src"))
(OUTER-LOOP " if (susp->done) {
togo = 0; /* indicate termination */
break; /* we're done */
}
")
(INNER-LOOP "LVAL rslt = xleval(cons(s_send, cons(src,
consa(s_next))));
if (floatp(rslt)) {
output = (sample_type) getflonum(rslt);
} else {
done = true;
/* adjust togo to what it should have been */
break;
}")
(CONSTANT "length" "samples" "array" "src")
(TERMINATE COMPUTED)
)
|