Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] AVSynthesis, java, thread and Linux

Date2008-04-16 19:06
Fromvictor
SubjectRe: [Cs-dev] AVSynthesis, java, thread and Linux
I think the only things to watch out are events, which you should
only send using CsoundPerformanceThread::InputMessage() or
CsoundPerformanceThread::ScoreEvent() instead of the
Csound methoids of the same name. There should be no problems
with GetChannel() or SetChannel().

Victor


----- Original Message ----- 
From: "Jean-Pierre Lemoine" 
To: "Developer discussions" 
Sent: Wednesday, April 16, 2008 6:32 PM
Subject: [Cs-dev] AVSynthesis, java, thread and Linux


> Just to try to clarify
>
> Thread
> The Java stuff (JOGL) has internal threads that I don't manage. My
> OpenGL code in in one thread. This thread use the csound API to start a
> thread that executes csound rendering
>    csoundPerformanceThread = new CsoundPerformanceThread( 
> csoundInstance );
>    csoundPerformanceThread.Play();
>
> During real time rendering, I access to the csound software bus for
> reading some values, used in the OpenGL loop.
> SoundBus w = firstSoundBus;
>        while( w != null ) {
>            w.v = (float)csoundInstance.GetChannel(w.name);
>            w = w.next;
>        }
>
> I presume that there is no lock on the software bus, but I only read
> values in the non csound thread. This has working nicely with 5.07, and
> seems ok with 5.08 (windows)
>
> jp
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save $100.
> Use priority code J8TL2D2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel 


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-04-16 19:48
FromJean-Pierre Lemoine
SubjectRe: [Cs-dev] AVSynthesis, java, thread and Linux
I have a doubt on how to clean csound after rendering. I am reusing a 
Csound object and CsoundPerformanceThread object
Here is how I quit the display loop (in fact end animation and change 
state to editor mode)
if ( csoundPerformanceThread.GetStatus() != 0 ) { // not running
            csoundInstance.Cleanup();
   ... other stuff not csound related
}

Is that sufficient? Do I have to use csoundPerformanceThread.Join(); ? 
what is the usage of join ?

I had trap when using reset, so I have stopped to use it

Thanks,
jp

victor a écrit :
> I think the only things to watch out are events, which you should
> only send using CsoundPerformanceThread::InputMessage() or
> CsoundPerformanceThread::ScoreEvent() instead of the
> Csound methoids of the same name. There should be no problems
> with GetChannel() or SetChannel().
>
> Victor
>
>
> ----- Original Message ----- 
> From: "Jean-Pierre Lemoine" 
> To: "Developer discussions" 
> Sent: Wednesday, April 16, 2008 6:32 PM
> Subject: [Cs-dev] AVSynthesis, java, thread and Linux
>
>
>   
>> Just to try to clarify
>>
>> Thread
>> The Java stuff (JOGL) has internal threads that I don't manage. My
>> OpenGL code in in one thread. This thread use the csound API to start a
>> thread that executes csound rendering
>>    csoundPerformanceThread = new CsoundPerformanceThread( 
>> csoundInstance );
>>    csoundPerformanceThread.Play();
>>
>> During real time rendering, I access to the csound software bus for
>> reading some values, used in the OpenGL loop.
>> SoundBus w = firstSoundBus;
>>        while( w != null ) {
>>            w.v = (float)csoundInstance.GetChannel(w.name);
>>            w = w.next;
>>        }
>>
>> I presume that there is no lock on the software bus, but I only read
>> values in the non csound thread. This has working nicely with 5.07, and
>> seems ok with 5.08 (windows)
>>
>> jp
>>
>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>> Don't miss this year's exciting event. There's still time to save $100.
>> Use priority code J8TL2D2.
>> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel 
>>     
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
> Don't miss this year's exciting event. There's still time to save $100. 
> Use priority code J8TL2D2. 
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
>   




-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-04-16 20:13
FromJean-Pierre Lemoine
SubjectRe: [Cs-dev] AVSynthesis, java, thread and Linux - test case
Attachmentsart.csd  hs_err_pid6024.log  None  None  
ok I have reproducible test case with the following code

public class Test1 {

    public static    Csound                     csoundInstance = null;
    public static     CsoundPerformanceThread csoundPerformanceThread = 
null;
   
    public static void main( String[] args ) {
        csoundInstance = new Csound();
        int rc = csoundInstance.Compile( "art.csd" );
        if ( rc == 0 ) {
            csoundPerformanceThread = new CsoundPerformanceThread( 
csoundInstance );
            csoundPerformanceThread.Play();
            while ( csoundPerformanceThread.GetStatus() == 0 ) {
               
            }
            csoundInstance.Cleanup();
            csoundInstance.delete();
        }
       
    }
}

the art.csd (from Dave Phillips)
and the java log file


jp



Jean-Pierre Lemoine a écrit :
> I have a doubt on how to clean csound after rendering. I am reusing a 
> Csound object and CsoundPerformanceThread object
> Here is how I quit the display loop (in fact end animation and change 
> state to editor mode)
> if ( csoundPerformanceThread.GetStatus() != 0 ) { // not running
>             csoundInstance.Cleanup();
>    ... other stuff not csound related
> }
>
> Is that sufficient? Do I have to use csoundPerformanceThread.Join(); ? 
> what is the usage of join ?
>
> I had trap when using reset, so I have stopped to use it
>
> Thanks,
> jp
>
> victor a écrit :
>   
>> I think the only things to watch out are events, which you should
>> only send using CsoundPerformanceThread::InputMessage() or
>> CsoundPerformanceThread::ScoreEvent() instead of the
>> Csound methoids of the same name. There should be no problems
>> with GetChannel() or SetChannel().
>>
>> Victor
>>
>>
>> ----- Original Message ----- 
>> From: "Jean-Pierre Lemoine" 
>> To: "Developer discussions" 
>> Sent: Wednesday, April 16, 2008 6:32 PM
>> Subject: [Cs-dev] AVSynthesis, java, thread and Linux
>>
>>
>>   
>>     
>>> Just to try to clarify
>>>
>>> Thread
>>> The Java stuff (JOGL) has internal threads that I don't manage. My
>>> OpenGL code in in one thread. This thread use the csound API to start a
>>> thread that executes csound rendering
>>>    csoundPerformanceThread = new CsoundPerformanceThread( 
>>> csoundInstance );
>>>    csoundPerformanceThread.Play();
>>>
>>> During real time rendering, I access to the csound software bus for
>>> reading some values, used in the OpenGL loop.
>>> SoundBus w = firstSoundBus;
>>>        while( w != null ) {
>>>            w.v = (float)csoundInstance.GetChannel(w.name);
>>>            w = w.next;
>>>        }
>>>
>>> I presume that there is no lock on the software bus, but I only read
>>> values in the non csound thread. This has working nicely with 5.07, and
>>> seems ok with 5.08 (windows)
>>>
>>> jp
>>>
>>>
>>>
>>> -------------------------------------------------------------------------
>>> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>>> Don't miss this year's exciting event. There's still time to save $100.
>>> Use priority code J8TL2D2.
>>> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel 
>>>     
>>>       
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
>> Don't miss this year's exciting event. There's still time to save $100. 
>> Use priority code J8TL2D2. 
>> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>>
>>   
>>     
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
> Don't miss this year's exciting event. There's still time to save $100. 
> Use priority code J8TL2D2. 
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
>