Overview Clamps Packages CM Dictionary Clamps Dictionary Fomus
Next: make-eventplayer , Previous: make-computed , Up: M , Home: Overview

Clamps Dictionary

make-ctl-fn

Macro

(make-ctl-fn (dur &optional (res 0.01)) &rest forms)

return a function which will run for dur when called with the node-id as argument, binding the symbol x in any of the forms to values on a linear ramp from 0 to 1 during the total duration and the symbol id to the node-id submitted to the function. The timing resolution is res in seconds.

The function returned by make-ctl-fn will return an unwatch function which stops the process immediately when called.

The purpose of this function is to automate setting of ctl parameters of a dsp while it is running. A form like (set-control id :freq (n-exp x 100 1000)) would change the freq parameter of the dsp with id from 100 to 1000 in an exponential curve over dur and could be started in the :action function when calling the dsp.

Arguments

dur total duration of the ramp
res the timing resolution of succesive values
forms zero or more forms to be evaluated on each timing step. In order for the form to be called it must contain a reference to x.

Example

;; define a ctl-fn which will run for 10 seconds when called
(defparameter test-ctl-fn
  (make-ctl-fn
      (10)
      (msg :warn "~5,3f, ~a" x id)))

;; start the ctl-fn, saving its stop function in the stop-ctl-fn parameter.
(defparameter stop-ctl-fn
   (funcall test-ctl-fn 21))

;; when the process should be stopped before 10 seconds, call the stop function:
(funcall stop-ctl-fn)

See also

Author: Orm Finnendahl

Created: 2026-08-15 Sa 16:32

Validate