From 40af1e696717c1a287204c35596bd5685771054d Mon Sep 17 00:00:00 2001 From: Comment Date: Thu, 7 Nov 2013 10:37:07 +0000 Subject: refining video bank --- rotord/src/rotor.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'rotord') diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h index ca3e5d2..fee29bc 100644 --- a/rotord/src/rotor.h +++ b/rotord/src/rotor.h @@ -612,8 +612,9 @@ namespace Rotor { } if (attributes["filenames"]->vals.size()){ float ph=inputs[0]->get((Time_spec)frame); - int wv=((int)ph)%attributes["filenames"]->vals.size(); - ph=fmod(ph,wv); + int seg=((int)ph); + int wv=seg%attributes["filenames"]->vals.size(); + ph=fmod(ph,seg); if (clip_loaded!=wv){ if (load(media_path+attributes["filenames"]->vals[wv] )) { clip_loaded=wv; @@ -627,25 +628,27 @@ namespace Rotor { if (isLoaded){ int wanted=0.0f; int thisframe=((Time_spec)frame).frame(); + float clipframerate=(parameters["framerate"]->value==0.0f?player.get_framerate():parameters["framerate"]->value); + float clipspeed=(clipframerate/frame.framerate)*parameters["speed"]->value; switch (attributes["frame_mode"]->intVal){ case VIDEOTIME_play: if(thisframe==lastframe||thisframe==lastframe+1){ - if (segment!=wv){ + if (segment!=seg){ //start of new segment - cerr<<"segment "<get(testframe)==wv&&testframe.frame()>0){ + while ((int)inputs[0]->get(testframe)==seg&&testframe.frame()>0){ testframe=testframe.lastframe(); } segment_start=testframe.time; } - wanted=(((Time_spec)frame).time-segment_start)*player.get_framerate(); + wanted=(((Time_spec)frame).time-segment_start)*clipspeed*frame.framerate; lastframe=thisframe; break; case VIDEOTIME_stretch: -- cgit v1.2.3