[Sugar-devel] Fw: Help Request - Python Timer

James Cameron quozl at laptop.org
Wed Feb 2 00:09:18 EST 2011


On Tue, Feb 01, 2011 at 09:29:04PM -0500, Art Hunkins wrote:
> Can anyone come up with a couple of lines of Python code that will
> let me know when an already-playing csd has finished, so I can call
> something else?
> 
> (I assume it will call the Csound Python API; and, FWIW, csndsugui
> is available.)

I'm looking at csndsugui.py from filemix git, and it has a set_timer
method that uses gobject.timeout_add to schedule a future timer event.

Also in csndsugui.py it uses csnd.CsoundPerformanceThread, and looking
at csnd.py there is an isRunning method for that class.

So to discover if "an already-playing csd has finished", it seems you
may call CsoundGUI.perf.isRunning() ... if the return value is False,
then the csd has finished.  I guess.

There is also a GetStatus method, and perhaps some sort of way to
request that a function of yours be called when the performance ceases.

-- 
James Cameron
http://quozl.linux.org.au/


More information about the Sugar-devel mailing list