Csound Csound-dev Csound-tekno Search About

[Cs-dev] CsoundAPI - how to synchronize

Date2005-03-10 16:04
FromJean-Pierre Lemoine
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