Csound Csound-dev Csound-tekno Search About

[Cs-dev] Python: destroy csound instance

Date2006-06-08 18:01
FromSimon Schampijer
Subject[Cs-dev] Python: destroy csound instance
Hi,
does someone know what the python command is to destroy the csound instance?
I tried all the different possibilities without any luck. Am I missing 
something?
Thanks
   Simon

 >>> import csnd
 >>> csound = csnd.Csound()
 >>> csnd.csoundDestroy(csound)
Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/local/lib/csnd.py", line 263, in csoundDestroy
    return _csnd.csoundDestroy(*args)
TypeError: in method 'csoundDestroy', argument 1 of type 'CSOPython UND *'


_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-08 20:11
FromSimon Schampijer
SubjectRe: [Cs-dev] Python: destroy csound instance
Thanks Istvan for the quick reply. Got the concept now. That was what I 
was missing.
Best
     Simon


Istvan Varga wrote:
> With csoundDestroy(), you can only destroy instances of type CSOUND*
> returned by csoundCreate(). While CppSound, Csound, and CsoundVST
> instances may not be destroyed directly, you can release most of the
> associated resources with the "reset" method. The Csound instance
> itself will eventually be freed by Python garbage collection, but
> you can explicitly remove the reference from the object by assignment
> to 'None'. Here is an example:
>
> csound = csnd.Csound()
> # compile and perform here
> # ...
> csound.Reset()
> csound = None
>
> On Thursday 08 June 2006 19:01, Simon Schampijer wrote:
>
>   
>> does someone know what the python command is to destroy the csound instance?
>> I tried all the different possibilities without any luck. Am I missing 
>> something?
>>
>>  >>> import csnd
>>  >>> csound = csnd.Csound()
>>  >>> csnd.csoundDestroy(csound)
>> Traceback (most recent call last):
>>   File "", line 1, in ?
>>   File "/usr/local/lib/csnd.py", line 263, in csoundDestroy
>>     return _csnd.csoundDestroy(*args)
>> TypeError: in method 'csoundDestroy', argument 1 of type 'CSOPython UND *'
>>     
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>   



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-08 23:15
FromIstvan Varga
SubjectRe: [Cs-dev] Python: destroy csound instance
AttachmentsNone  

Date2006-06-09 20:27
FromSimon Schampijer
SubjectRe: [Cs-dev] Python: destroy csound instance
Istvan,
Actually the problem I am facing now,
is that the performance thread can not be
accessed any more. After stopping the performance
I can not join the thread, reset does not work neither.
 
Any Ideas on that?
Thanks,
    Simon


import csnd
import time

csound = csnd.Csound()
csound.Compile('univorc.csd')
perf = csnd.CsoundPerformanceThread(csound)
perf.Play()
csound.SetChannel('sfplay.1.on', 1)
perf.InputMessage('i 102 0 1 \"coltrane.wav\" 1 0.7 0.5 0')
time.sleep(1)

perf.Stop()
perf.Join()
csound.Reset()




Istvan Varga wrote:
> With csoundDestroy(), you can only destroy instances of type CSOUND*
> returned by csoundCreate(). While CppSound, Csound, and CsoundVST
> instances may not be destroyed directly, you can release most of the
> associated resources with the "reset" method. The Csound instance
> itself will eventually be freed by Python garbage collection, but
> you can explicitly remove the reference from the object by assignment
> to 'None'. Here is an example:
>
> csound = csnd.Csound()
> # compile and perform here
> # ...
> csound.Reset()
> csound = None
>
> On Thursday 08 June 2006 19:01, Simon Schampijer wrote:
>
>   
>> does someone know what the python command is to destroy the csound instance?
>> I tried all the different possibilities without any luck. Am I missing 
>> something?
>>
>>  >>> import csnd
>>  >>> csound = csnd.Csound()
>>  >>> csnd.csoundDestroy(csound)
>> Traceback (most recent call last):
>>   File "", line 1, in ?
>>   File "/usr/local/lib/csnd.py", line 263, in csoundDestroy
>>     return _csnd.csoundDestroy(*args)
>> TypeError: in method 'csoundDestroy', argument 1 of type 'CSOPython UND *'
>>     
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>   



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-09 20:40
FromIstvan Varga
SubjectRe: [Cs-dev] Python: destroy csound instance
AttachmentsNone  

Date2006-06-09 22:22
FromSimon Schampijer
SubjectRe: [Cs-dev] Python: destroy csound instance
Sorry for the wrong subject, true it was the problem of the csd. That 
was the part where I was not looking at.
-> The class works fine.

Thanks (that saved me some time)
Simon


Istvan Varga wrote:
> Do you mean the CsoundPerformanceThread class does not work
> (I assume this is not related to the original subject) ?
> I tried your Python script with a simple CSD file, but did
> not find problems. So, it is possible that it can only be
> reproduced with your CSD (that I do not have) or on the
> platform you use (OS X ?).
>
> On Friday 09 June 2006 21:27, Simon Schampijer wrote:
>
>   
>> Actually the problem I am facing now,
>> is that the performance thread can not be
>> accessed any more. After stopping the performance
>> I can not join the thread, reset does not work neither.
>>
>> import csnd
>> import time
>>
>> csound = csnd.Csound()
>> csound.Compile('univorc.csd')
>> perf = csnd.CsoundPerformanceThread(csound)
>> perf.Play()
>> csound.SetChannel('sfplay.1.on', 1)
>> perf.InputMessage('i 102 0 1 \"coltrane.wav\" 1 0.7 0.5 0')
>> time.sleep(1)
>>
>> perf.Stop()
>> perf.Join()
>> csound.Reset()
>>     
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>   



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net