Csound Csound-dev Csound-tekno Search About

[Csnd] Re: Re: Re: Accessing the api from mzscheme using ffi - no swig involved

Date2008-02-16 20:15
Fromvictor
Subject[Csnd] Re: Re: Re: Accessing the api from mzscheme using ffi - no swig involved
Is that CsoundPerformanceThread::InputMessage() ? If so, it might
be the way that class queues event. There might be an upper limit
for it.

Victor
----- Original Message ----- 
From: "Cesare Marilungo" 
To: 
Sent: Saturday, February 16, 2008 7:38 PM
Subject: [Csnd] Re: Re: Accessing the api from mzscheme using ffi - no swig 
involved


> 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
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
> csound"