From 7a3d7d2779a99fda5362ca341c965ddff826b2b7 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Mon, 20 May 2013 18:15:13 +0100 Subject: no longer crashing or baffled --- rotord/rotor.h | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'rotord/rotor.h') diff --git a/rotord/rotor.h b/rotord/rotor.h index c38a83f..fe0f7d9 100755 --- a/rotord/rotor.h +++ b/rotord/rotor.h @@ -128,7 +128,8 @@ namespace Rotor { class Frame_spec: public Time_spec{ public: Frame_spec(float _time,float _framerate,float _duration,int _w,int _h){ time=_time; framerate=_framerate; duration=_duration; w=_w; h=_h;}; - Frame_spec(int _frame,float _framerate,float _duration,int _w,int _h){ time=((float)_frame)/_framerate; Frame_spec(time,_framerate,_duration,_w,_h);}; + Frame_spec(int _frame,float _framerate,float _duration,int _w,int _h){ time=((float)_frame)/_framerate; framerate=_framerate; duration=_duration; w=_w; h=_h;}; + //Frame_spec(time,_framerate,_duration,_w,_h);}; //float time; //this hould probably be implemented with a num/denom scheme eventually for accuracy //float framerate; @@ -769,7 +770,7 @@ namespace Rotor { Echo_trails(){}; Echo_trails(map &settings) { base_settings(settings); - duration=find_setting(settings,"duration",1.0f); + //duration=find_setting(settings,"duration",1.0f); number=find_setting(settings,"number",1); fadeto=find_setting(settings,"fadeto",1.0f); levels_settings(settings); @@ -798,16 +799,18 @@ namespace Rotor { images.clear(); lastframe=-1; //calculate frame interval - interval=(int)(((duration/number)*frame.framerate)+0.5); - total=interval*number; + //interval=(int)(((duration/number)*frame.framerate)+0.5); + //total=interval*number; } int thisframe=frame.frame(); //iterate cache and throw out any obsolete frames auto i = std::begin(images); while (i != std::end(images)) { // check if the image is in the range we need - if (thisframe-(*i).first>total||thisframe-(*i).first<0) + if (thisframe-(*i).first>number||thisframe-(*i).first<0) { + delete (*i).second; i = images.erase(i); + } else ++i; } @@ -822,28 +825,28 @@ namespace Rotor { //copy incoming image **writable image->free(); image=(((Image_node*)image_inputs[0]->connection)->get_output(frame))->clone(); - for (int i=0;i-1){ //check if image is in the cache if (images.find(absframe)==images.end()){ - //cerr<<"Rotor: preparing image ("<w<<"x"<h<<")"<w,image->h); - //cerr<<"Rotor: prepared image ("<connection)->get_output(wanted)),*images[absframe]); + apply_LUT(*(((Image_node*)image_inputs[0]->connection)->get_output(wanted)),*(images[absframe])); } //cerr<<"Rotor: about to apply image ("<add_wrap(*temp); delete temp; } - else (*image)+=*images[absframe]; + else { + if (mode<0.5) (*image)+=*(images[absframe]); + else (*image)=image->add_wrap(*(images[absframe])); + } } } //for (int i=0;i