[Audacity-nyquist] "FORMAT T" vs. "FORMAT NIL" in Audacity Nyquist plugins
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: edgar <edg...@we...> - 2009-11-28 18:34:00
|
Edgar wrote: > format t "string") > > has the same effect as: > > (princ (format nil "string")) > > format t = print to stdout, return NIL > format nil = print nothing, instead return the string Steve wrote: > When I use (format t "string") I only see the output in the debug > window, (Audacity shows the message "Nyquist did not return audio") > whereas using (princ (format nil "string")) outputs the string as > a pop-up message. > > I assumed that that was supposed to happen? Now I understand what you mean. :-) There is once again a weirdness in the Audacity Nyquist interface (David Sky asked me this at least ten times): If a plugin returns a string instead of a sound, the string gets displayed in the popup window instead of the "Nyquist did not return audio" message. So if the last line in the plugin is: (format nil "string") then the FORMAT return-value (the string) gets displayed in the popup window, but not in the Debug window (you do not necessarily need the PRINC function for that, it also works without PRINC). While with: (format t "string") at any place in the Nyquist code the string gets displayed in the Debug window. If "format t" is the last line in the plugin code then "Nyquist did not return audio" will get displayed in the popup window because in this case the FORMAT return-value is NIL and NIL is not a string. See also the explanation of the different Nyquist return values: http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/devel/audacity-nyquist-en.htm#return If you want a string displayed in both, the popup window as well as in the Debug window there is no other way than to write: (format t "string") (format nil "string") The order is important: "format t" must come first, because it returns NIL, only "format nil" returns a string. - edgar -- The author of this email does not necessarily endorse the following advertisements, which are the sole responsibility of the advertiser: |