| In a single thread, I am surprised this segfaults. I was thinking
you were using two threads. Not sure why.
Victor
----- Original Message -----
From: "Cesare Marilungo"
To:
Sent: Saturday, February 16, 2008 11:01 PM
Subject: [Csnd] Re: Re: Re: Re: Re: Accessing the api from mzscheme using
ffi - no swig involved
> victor wrote:
>> Or on the other hand, if you are calling Csound::InputMessage() instead
>> of CsoundPerformanceThread::InputMessage(), two threads might be
>> accesssing the same area of memory and causing the crash.
>>
>> The latter should be used, but it's very easy to get the two confused
>> or forget to use the correct one.
>>
>> Victor
>
> This makes sense. In fact from python I'm using the latter.
>
> With the code below (from MzScheme) I'm calling:
>
> PUBLIC void csoundInputMessage(CSOUND *, const char *message);
>
> But then, what is this for?
>
> Also, I call csoundInputMessage in a straight sequence and then I call
> csoundPerformKsmps. I have also tried to put a long delay before calling
> the loop with csoundPerformKsmps inside. It segfaults as soon as
> csoundPerformKsmps is called. It seems related to the number of events.
>
> Best,
>
> -c.
>
>>
>> ----- Original Message ----- From: "victor"
>> To:
>> Sent: Saturday, February 16, 2008 8:15 PM
>> 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"
>>>
>>>
>>>
>>> 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"
|