|
From: Martin R. <ru...@us...> - 2004-08-30 18:06:30
|
Update of /cvsroot/foo/foo/elkfoo/scm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20344 Modified Files: next-compat.foo Log Message: fixed overlay compat functions in order to work with new foo:make-soundfile interface Index: next-compat.foo =================================================================== RCS file: /cvsroot/foo/foo/elkfoo/scm/next-compat.foo,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** next-compat.foo 7 Aug 2004 22:53:00 -0000 1.1 --- next-compat.foo 30 Aug 2004 18:06:21 -0000 1.2 *************** *** 1,20 **** ;; foo-2.1 (NeXTStep) compatability for foo ! (define foo-default-soundfile-format 'short) ! (define foo-default-soundfile-filetype 'snd) ! (define foo-default-soundfile-extension ".snd") ! (define (create-soundfile name format channels samplingrate . commentary) ! (set! name (tilde-expand name)) ! (if (file-exists? name) ! (system (string-append "rm -rf " name))) ! (foo:make-soundfile name format channels samplingrate foo-default-soundfile-filetype)) ! ! (define (make-soundfile name format channels samplingrate . commentary) ! (set! name (tilde-expand name)) ! (foo:make-soundfile name format channels samplingrate foo-default-soundfile-filetype)) (define-macro (synt c d s n f . e) ! `(foo:synthesize ,c ,d ,s ,n ,f foo-default-soundfile-filetype (lambda () ,@e))) (provide 'next-compat) --- 1,56 ---- ;; foo-2.1 (NeXTStep) compatability for foo ! (set! foo-default-soundfile-format 'short) ! (set! foo-default-soundfile-filetype 'snd) ! (set! create-soundfile ! (lambda (name sampleformat channels samplingrate . comment) ! (set! name (tilde-expand name)) ! (if (file-exists? name) ! (system (string-append "rm -rf " name))) ! (if (null? comment) ! (foo:make-soundfile name foo-default-soundfile-filetype sampleformat samplingrate channels) ! (foo:make-soundfile name foo-default-soundfile-filetype sampleformat samplingrate channels (car comment))))) ! ! (set! make-soundfile ! (lambda (name sampleformat channels samplingrate . comment) ! (set! name (tilde-expand name)) ! (if (null? comment) ! (foo:make-soundfile name foo-default-soundfile-filetype sampleformat samplingrate channels) ! (foo:make-soundfile name foo-default-soundfile-filetype sampleformat samplingrate channels (car comment))))) ! ! (set! foo:synthesize ! (lambda (channels duration srate filename sampleformat thunk) ! (let ((c (make-context channels)) ! (d (substring filename 0 (1+ (foo:string-rindex filename #\/))))) ! (if (> (string-length d) 0) ! (if (not (file-exists? d)) ! (system (string-append "mkdir -p " d)))) ! (create-soundfile filename sampleformat channels srate) ! (with-context c thunk) ! (let ((start 0) (finish 0) (done 0)) ! (define (pf f n) ! (let ((s (number->string f))) ! (substring s 0 (min (string-length s) n)))) ! (set! start (seconds)) ! (set! done (run-task (make-task 0 0 filename c 'punch srate) duration)) ! (set! finish (seconds)) ! (format #t ! "len: ~as, tim: ~as, rtf: ~a, sr: ~aHz~%fil: ~a, fmt: ~a" ! (pf done 7) ! (pf (- finish start) 7) ! (pf (/ (- finish start) done) 7) ! (pf srate 7) filename sampleformat))) #v)) ! ! (define-macro (syn c d . e) ! `(foo:synthesize ,c ! ,d ! (foo-default-srate) ! (foo:test-file-name) ! foo-default-soundfile-format ! (lambda () ,@e))) (define-macro (synt c d s n f . e) ! `(foo:synthesize ,c ,d ,s ,n ,f (lambda () ,@e))) (provide 'next-compat) |