From dba01ce870165fd8d8a5fea921cb31f7c4e8c25f Mon Sep 17 00:00:00 2001 From: Comment Date: Mon, 10 Dec 2012 19:30:27 +0000 Subject: fixed race condition in asterisk driver --- vfg/src/Puppet.cpp | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'vfg/src/Puppet.cpp') diff --git a/vfg/src/Puppet.cpp b/vfg/src/Puppet.cpp index 90ba137..9d9a11e 100755 --- a/vfg/src/Puppet.cpp +++ b/vfg/src/Puppet.cpp @@ -36,38 +36,45 @@ void Puppet::load(string filename) { void Puppet::draw(float x, float y, float scale) { if (playlist.size()>0) { - if (!clips[playlist[0]].getIsPlaying()) { - playlist.erase(playlist.begin()); - if (playlist.size()>0) { - clips[playlist[0]].play(); + if (!clips[playlist[0].second].getIsPlaying()) { + if (ofGetElapsedTimeMillis()-playlist[0].first>clips[playlist[0].second].getDuration()) { + playlist.erase(playlist.begin()); + } + if (playlist.size()>0) { + if (playlist[0].first0) { - clips[playlist[0]].stop(); + clips[playlist[0].second].stop(); playlist.clear(); } play(clip); } bool Puppet::isPlaying(){ - if (playlist.size()>0) return clips[playlist[0]].getIsPlaying(); + if (playlist.size()>0) return clips[playlist[0].second].getIsPlaying(); else return false; } + +void Puppet::clear(){ + playlist.clear(); +} -- cgit v1.2.3