Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] CsoundAPI - how to synchronize

Date2005-03-11 01:05
From"Michael Gogins"
SubjectRe: [Cs-dev] CsoundAPI - how to synchronize
CppCsound.isScorePending, .setScorePending, .rewindScore, and 
.setScoreOffsetSeconds, and .getScoreOffsetSeconds and be used to control 
this. See the CoundVST.cpp code and the CppSound.hpp header file.

----- Original Message ----- 
From: "Jean-Pierre Lemoine" 
To: 
Sent: Thursday, March 10, 2005 11:04 AM
Subject: [Cs-dev] CsoundAPI - how to synchronize


> Many things are working with Cs5 CsoundAPI and Java, that's realy nice.
>
> I have a main Java program that is running a loop for rendering graphical 
> objects (I am using LWJGL). Inside this loop, I use Thread.sleep(10)  to 
> avoid  burning all the CPU resources. Before starting this loop, I start 
> another thread where a CppSound object  is created:
>        cs = new CppSound();
>        cs.load( 
> "C:/hplank/HPKComposerAV/compositions/horribilis/tube11rt.csd" );
>        cs.compile();
>
> The command in the CSD file is
> csound -h -d -m4 -odac1 -B441 -b441 temp.orc temp.sco
>
> Then just before starting the graphical loop, I start the Csound Thread 
> and the following code is executed in the run method:
>        cs.perform();
>
> Everything is working smoothly (and that is the first great point), in 
> real time, graphics and sound.
>
> Now the problem.
> cs.perform() doesn't start the score immediatly, cs.compile() doesnt' seem 
> to give a ready to go structure and there is a visible latency. I need to 
> start the graphical animation when  the first score event starts (at time 
> 0), and I have tried to use cs.getIsPerforming() but this method is always 
> returning false. Is that normal?
> Is there another way to do correct synchronization between the start of 
> the first score event and an external program?
>
> Thanks for any help on this subject
> jean-pierre
>
>
>
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-03-11 19:26
FromJean-Pierre Lemoine
SubjectRe: [Cs-dev] CsoundAPI - how to synchronize and other findings
Some more findings and test

1) temporary files -sco and orc) are generated and the following 
sequence seems mandatory
        cs.load( aCsdFile );
        boolean b = cs.exportForPerformance();
        cs.compile();
I have tried to remove exportForPerformance and was surprised to hear 
something, but this is coming from old temporary files.
This bring another question:  are these temporary files erased at some 
point in time? et why using this mecanism with csd file (legacy parser I 
presume)?

2) Thanks for your suggestion Michael
I have tested this
        cs.setScorePending(1);
        cs.rewindScore();
        cs.perform();
I dont' see how to use setScoreOffsetSeconds as the parameter is a SWIG 
type, and from the SWIG documentation, this type is not expected to be 
used directly. so ?????
I don't see any difference by doing this. Is it sure than cs.perform() 
is not going to compute anything and will just start playing the first 
score event?

3) Strange stuff
I launch CsoundVST from Java
                        Process exec = Runtime.getRuntime().exec(cmd);
                        BufferedReader input = new BufferedReader( new 
InputStreamReader(exec.getInputStream()));
                        String line = null;
                        while( (line = input.readLine() ) != null) {
                            CsoundMessageViewPart.display( line );
                        }
                        input.close();
CsoundVST is launched with  the csd file as a parameter (cmd string). 
The rendering is not started automaticly and when I click on "perfom" 
button CsoudnVST hangs. The same code works with CsoundAV.
Anyway I am now using csound.exe and it's ok.

Sorry if I am bringing more work for you, but I am with you on having a 
solid common Csound platform for all.

jean-pierre



Michael Gogins wrote:

> CppCsound.isScorePending, .setScorePending, .rewindScore, and 
> .setScoreOffsetSeconds, and .getScoreOffsetSeconds and be used to 
> control this. See the CoundVST.cpp code and the CppSound.hpp header file.
>





-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net