[CM] ats which lisp

Kjetil Svalastog Matheussen k.s.matheussen@notam02.no
Fri, 9 Mar 2007 15:53:49 +0100 (CET)


On Thu, 8 Mar 2007, Juan I Reyes wrote:

> Hola Juan!
> 
> Thanks a lot for your response.
> 
> I was afraid this was going to be the answer. I have not had any luck
> with ATS on clm-2 on Fedora Extras' cmucl-19c-7.fc6. But please forgive
> me for not having tried de C version but I feel the Lisp code is quite
> exquisite (and flexible) for many musical expression algorithms compared
> to the graphical interface. I'll give it few more shots.
> 
> BTW, Could ATS Scheme be a nice project for SND gurus: Kjetil and
> Michael Scholz ? 
> 


I don't know if this helps, but interfacing with c libraries and c arrays 
are very easy using snd. If you load the file "eval-c.scm", doing
something like this might get you started:


(eval-c "-latsa"
	"#include <atsa.h>"
	(proto->public
	 "void init_atsa();"
	 "int get_atsa_length(char* filename);"
	 "float *get_atsa_data(char* filename);"))

(init_atsa)
(define list-of-atsa-data
        (ec-get-floats (get_atsa_data "afile")
                       (get_atsa_length "afile")))


(define (put-data-back newvals)
  (let ((data (get_atsa_data "afile")))
    (c-for-each (lambda (n val)
                  (ec-put-floats-element data n val))
                newvals)))

(put-data-back (map 1+ list-of-atsa-data))