| 1 |
;; system.lsp -- system-dependent lisp code |
| 2 |
|
| 3 |
; local definition for play |
| 4 |
; this one is for Mac OS-X: |
| 5 |
|
| 6 |
(if (not (boundp '*default-sf-format*)) |
| 7 |
(setf *default-sf-format* snd-head-wave)) |
| 8 |
|
| 9 |
(if (not (boundp '*default-sound-file*)) |
| 10 |
(compute-default-sound-file)) |
| 11 |
|
| 12 |
(if (not (boundp '*default-sf-dir*)) |
| 13 |
(setf *default-sf-dir* "/tmp")) |
| 14 |
|
| 15 |
(format t "*default-sf-dir* (default sound file directory) is ~A~%" |
| 16 |
*default-sf-dir*) |
| 17 |
|
| 18 |
(if (not (boundp '*default-sf-mode*)) |
| 19 |
(setf *default-sf-mode* snd-mode-pcm)) |
| 20 |
|
| 21 |
(if (not (boundp '*default-sf-bits*)) |
| 22 |
(setf *default-sf-bits* 16)) |
| 23 |
|
| 24 |
(if (not (boundp '*default-plot-file*)) |
| 25 |
(setf *default-plot-file* (strcat (get-user) "-points.dat"))) |
| 26 |
|
| 27 |
|
| 28 |
; FULL-NAME-P -- test if file name is a full path or relative path |
| 29 |
; |
| 30 |
; (otherwise the *default-sf-dir* will be prepended |
| 31 |
; |
| 32 |
(defun full-name-p (filename) |
| 33 |
(or (eq (char filename 0) #\/) |
| 34 |
(eq (char filename 0) #\.))) |
| 35 |
|
| 36 |
; RELATIVE-PATH-P -- test if filename or path is a relative path |
| 37 |
; |
| 38 |
(defun relative-path-p (filename) |
| 39 |
(not (eq (char filename 0) #\/))) |
| 40 |
|
| 41 |
(setf *file-separator* #\/) |
| 42 |
|
| 43 |
|
| 44 |
;; PLAY-FILE - play a sound file |
| 45 |
;; |
| 46 |
(defun play-file (name) |
| 47 |
(s-save (s-read name) NY:ALL "" :play t)) |
| 48 |
|
| 49 |
|
| 50 |
;; R - replay last file written with PLAY |
| 51 |
(defun r () (play-file *default-sound-file*)) |
| 52 |
|
| 53 |
;;;; use this old version if you want to use sndplay to play |
| 54 |
;;;; the result file rather than play the samples as they |
| 55 |
;;;; are computed. This version does not autonormalize. |
| 56 |
;; PLAY - write value of an expression to file and play it |
| 57 |
;; |
| 58 |
;(defmacro play (expr) |
| 59 |
; `(prog (specs) |
| 60 |
; (setf specs (s-save (force-srate *sound-srate* ,expr) |
| 61 |
; 1000000000 *default-sound-file*)) |
| 62 |
; (r))) |
| 63 |
;;;; |
| 64 |
|
| 65 |
; local definition for play |
| 66 |
(defmacro play (expr) |
| 67 |
`(s-save-autonorm ,expr NY:ALL *default-sound-file* :play *soundenable*)) |
| 68 |
|
| 69 |
;; use standard s-plot |