Update of /cvsroot/audacity/audacity-src/nyquist
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv4708/nyquist

Modified Files:
        system.lsp 
Log Message:
Use the Linux system.lsp as the default (even on OSX) and point the Windows 
project to the Windows version of the system.lsp.

Index: system.lsp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/nyquist/system.lsp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- system.lsp  5 Feb 2009 18:13:11 -0000       1.6
+++ system.lsp  23 Apr 2009 16:36:44 -0000      1.7
@@ -1,23 +1,16 @@
-; system.lsp -- machine/system-dependent definitions
-
-;; default behavior is to call SETUP-CONSOLE to get large white typescript
-;;
-;; set *setup-console* to nil in your personal init.lsp to override this 
behavior 
-;; (this may be necessary to work with emacs)
-;;
-(if (not (boundp '*setup-console*)) (setf *setup-console* t))
-(if *setup-console* (setup-console))
+;; system.lsp -- system-dependent lisp code
 
-(setf ny:bigendianp nil)
+; local definition for play
+;  this one is for Linux:
 
 (if (not (boundp '*default-sf-format*))
-    (setf *default-sf-format* snd-head-Wave))
+    (setf *default-sf-format* snd-head-wave))
 
-;(if (not (boundp '*default-sound-file*))
-;    (setf *default-sound-file* "temp.wav"))
+(if (not (boundp '*default-sound-file*))
+    (compute-default-sound-file))
 
-;(if (not (boundp '*default-sf-dir*))
-;    (setf *default-sf-dir* ""))
+(if (not (boundp '*default-sf-dir*))
+    (setf *default-sf-dir* "./"))
 
 (if (not (boundp '*default-sf-mode*))
     (setf *default-sf-mode* snd-mode-pcm))
@@ -25,25 +18,8 @@
 (if (not (boundp '*default-sf-bits*))
     (setf *default-sf-bits* 16))
 
-;(if (not (boundp '*default-plot-file*))
-;    (setf *default-plot-file* "points.dat"))
-
-;(if (not (boundp '*plotscript-file*))
-;    (setf *plotscript-file* "sys/unix/rs6k/plotscript"))
-
-; local definition for play
-;(defmacro play (expr)
-;  `(s-save-autonorm ,expr NY:ALL *default-sound-file* :play *soundenable*))
-
-
-;(defun r ()
-;  (s-save (s-read *default-sound-file*) NY:ALL "" :play t)
-;)
-
-
-; PLAY-FILE -- play a file
-;(defun play-file (name)
-;  (s-save (s-read name) NY:ALL "" :play t))
+(if (not (boundp '*default-plot-file*))
+    (setf *default-plot-file* (strcat (get-user) "-points.dat")))
 
 
 ; FULL-NAME-P -- test if file name is a full path or relative path
@@ -51,70 +27,64 @@
 ; (otherwise the *default-sf-dir* will be prepended
 ;
 (defun full-name-p (filename)
-  (or (eq (char filename 0) #\\)
-      (eq (char filename 0) #\.)
-      (and (> (length filename) 2)
-         (both-case-p (char filename 0))
-       (equal (char filename 1) #\:))))
+  (or (eq (char filename 0) #\/)
+      (eq (char filename 0) #\.)))
 
-(setf *file-separator* #\\)
+; RELATIVE-PATH-P -- test if filename or path is a relative path
+;
+(defun relative-path-p (filename)
+  (not (eq (char filename 0) #\/)))
 
-;(defun ny:load-file () (load "*.*"))
-;(defun ny:reload-file () (load "*"))
+(setf *file-separator* #\/)
 
 
-; save the standard function to write points to a file
-;
-;(setfn s-plot-points s-plot)
+;; PLAY-FILE - play a sound file
+;;
+(defun play-file (name)
+;;
+;; WARNING: if you invoke an external program to play files, 
+;; but Nyquist uses internal (portaudio) interface to
+;; play synthesized sound, Nyquist may fail to open the
+;; sound device while it is playing a sound file and then
+;; refuse to play anything. -RBD dec05
+;;  (system (strcat "sndplay " (soundfilename name))))
+;;  (system (strcat "play " (soundfilename name) )))
+;;
+  (play (s-read (soundfilename name))))
 
-;(defun array-max-abs (points)
-;  (let ((m 0.0))
-;        (dotimes (i (length points))
-;          (setf m (max m (abs (aref points i)))))
-;        m))
+;; R - replay last file written with PLAY
+(defun r () (play-file *default-sound-file*))
 
-;(setf graph-width 600)
-;(setf graph-height 220)
+;;;; use this old version if you want to use sndplay to play
+;;;; the result file rather than play the samples as they
+;;;; are computed. This version does not autonormalize.
+;; PLAY - write value of an expression to file and play it
+;;
+;(defmacro play (expr)
+;  `(prog (specs)
+;       (setf specs (s-save (force-srate *sound-srate* ,expr) 
+;                         1000000000 *default-sound-file*))
+;       (r)))
+;;;;
 
-;(defun s-plot (snd &optional (n 600))
-;  (show-graphics)
-;  (clear-graphics)
-;  (cond ((soundp snd)
-;               (s-plot-2 snd n (/ graph-height 2) graph-height))
-;              (t
-;               (let ((gh (/ graph-height (length snd)))
-;                     hs)
-;                 (dotimes (i (length snd))
-;                   (setf hs (s-plot-2 (aref snd i) n (+ (/ gh 2) (* i gh)) gh 
hs)))))))
-;
-;
-;(defun s-plot-2 (snd n y-offset graph-height horizontal-scale)
-;  (prog ((points (snd-samples snd n))
-;                   maxpoint horizontal-scale vertical-scale)
-;    (setf maxpoint (array-max-abs points))
-;    (moveto 0 y-offset)
-;    (lineto graph-width y-offset)
-;    (moveto 0 y-offset)
-;    (cond ((null horizontal-scale)
-;               (setf horizontal-scale (/ (float graph-width) (length 
points)))))
-;    (setf vertical-scale (- (/ (float graph-height) 2 maxpoint)))
-;    (dotimes (i (length points))
-;      (lineto (truncate (* horizontal-scale i))
-;              (+ y-offset (truncate (* vertical-scale (aref points i))))))
-;    (format t "X Axis: ~A to ~A (seconds)\n" (snd-t0 snd) (/ (length points) 
(snd-srate snd)))
-;    (format t "Y Axis: ~A to ~A\n" (- maxpoint) maxpoint)
-;    (format t "~A samples plotted.\n" (length points))
-;    (return horizontal-scale)
-;    ))
-;
-; S-EDIT - run the audio editor on a sound
-;
-;(defmacro s-edit (&optional expr)
-;  `(prog ()
-;         (if ,expr (s-save ,expr 1000000000 *default-sound-file*))
-;         (system (format nil "audio_editor ~A &" 
-;                         (soundfilename *default-sound-file*)))))
+; local definition for play
+(defmacro play (expr)
+  `(s-save-autonorm ,expr NY:ALL *default-sound-file* :play *soundenable*))
 
+;; for Linux, modify s-plot (defined in nyquist.lsp) by saving s-plot
+;; in standard-s-plot, then call gnuplot to display the points.
+;;
+;; we also need to save the location of this file so we can find
+;; nyquist-plot.txt, the command file for gnuplot
+;;
+(setf *runtime-path* (current-path))
+(display "system.lsp" *runtime-path*)
 
-; arch-tag: 01c1817b-9da4-4a6a-8cd7-99231844ceca
+(setfn standard-s-plot s-plot)
+
+(defun s-plot (s &optional (n 1000) (dur 2.0))
+  (let (plot-file)
+    (standard-s-plot s n dur) ;; this calculates the data points
+    (setf plot-file (strcat *runtime-path* "nyquist-plot.txt"))
+    (system (strcat "gnuplot -persist " plot-file))))
 


------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to