George Jenner wrote:
> I was using the xlisp (round ...) function quite happily in jnyqide,
> but when I took the code to audacity it doesn't work. I notice "round"
> doesn't exist in the docs.
Edgar: and in Audacity it doesn't exist too (as you already have noticed).
The solution is quite easy: "round" is a Lisp function defined in the
Roger Dannenberg Nyquist version in the file "runtime/fileio.lsp":
(defun round (x)
(cond ((> x 0) (truncate (+ x 0.5)))
((= (- x 0.5) (truncate (- x 0.5))) (truncate x))
(t (truncate (- x 0.5)))))
Just add this code to the beginning of your Audacity plugin code and
"round" will work in Audacity too, but only in the specific plugins where
the code is explicitely added. With the next run of Nyquist in Audacity with
another plugin, Nyquist will have "forgotten" the "round" function again.
You can add the "round" function to your Audacity permanently by copying
the code to the "init.lsp" file in the Audacity Nyquist subdirectory after
; add your customizations here:
; e.g. (setf *default-sf-dir* "...")
but then again your plugin will only work for people, who have added the
"round" function to their Audacity too. So the safest way is to add missing
Lisp functions (from Nyquist versions newer than Nyquist in Audacity)
directly into the plugin code.
The author of this email does not necessarily endorse the
following advertisements, which are the sole responsibility
of the advertiser:
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Thanks edgar. I thought someone might have done this.
> (defun round (x)
> (cond ((> x 0) (truncate (+ x 0.5)))
> ((= (- x 0.5) (truncate (- x 0.5))) (truncate x))
> (t (truncate (- x 0.5)))))
But I'm glad I didn't have to work this function out myself :-)