| I'm having some problems when populating the score using
csoundInputMessage. Basically if I add more than ~2000 events in this
way, it segfaults.
I've made some tests using python and the csnd module with the same
amount of events and it works without problems.
I'll make some tests using the api in the same way from plain c to see
what happens.
Best,
-c.
victor wrote:
> Looks like the lisp CFFI, which I am told also works...
> ----- Original Message ----- From: "Cesare Marilungo"
>
> To:
> Sent: Sunday, February 03, 2008 4:26 PM
> Subject: [Csnd] Accessing the api from mzscheme using ffi - no swig
> involved
>
>
>> DISCLAIMER: I've just started learning scheme, let alone the mzscheme
>> foreign function facilities. But it works!
>>
>> (require (lib "foreign.ss"))
>> (unsafe!)
>>
>> (file-stream-buffer-mode (current-output-port) 'line)
>>
>> (define libcsound (ffi-lib "libcsound"))
>>
>> (define CSOUND
>> (make-ctype _pointer #f #f))
>>
>> (define csoundCreate
>> (get-ffi-obj "csoundCreate" libcsound (_fun _int -> CSOUND)))
>>
>> (define csoundCompile
>> (get-ffi-obj "csoundCompile" libcsound (_fun CSOUND _int _cvector
>> -> _int)))
>>
>> (define csoundInputMessage
>> (get-ffi-obj "csoundInputMessage" libcsound (_fun CSOUND _string
>> -> _void)))
>>
>> (define csoundPerformKsmps
>> (get-ffi-obj "csoundPerformKsmps" libcsound (_fun CSOUND -> _int)))
>>
>> (define csoundDestroy
>> (get-ffi-obj "csoundDestroy" libcsound (_fun CSOUND -> _void)))
>>
>> (define comm (list->cvector '("csound" "template.csd") _string))
>>
>> (define cs (csoundCreate 0))
>>
>> (define (csloop)
>> (if (= (csoundPerformKsmps cs) 0) (csloop)))
>>
>> (csoundCompile cs 2 comm)
>>
>> (csoundInputMessage cs "i1 0 20 7.00 15000")
>>
>> (csloop)
>> (csoundDestroy cs)
>> (exit)
>>
>> Best,
>>
>> -c.
>>
>>
>>
>>
>>
>>
>> --
>> www.cesaremarilungo.com
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>> "unsubscribe csound"
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body
> "unsubscribe csound"
>
>
--
www.cesaremarilungo.com
|