summaryrefslogtreecommitdiff
path: root/rotord/src
diff options
context:
space:
mode:
authorComment <tim@gray.(none)>2013-08-22 19:49:55 +0100
committerComment <tim@gray.(none)>2013-08-22 19:49:55 +0100
commit153fefb66f2f8495d772e7b673e3556adc00d975 (patch)
tree5c861b2a09c23299a0476151f521593eef1e18ae /rotord/src
parentb7992bab3a5087bdfb1d2c25b1b3e0bad339b588 (diff)
mix mode of cycler node
Diffstat (limited to 'rotord/src')
-rwxr-xr-xrotord/src/rotor.cpp4
-rwxr-xr-xrotord/src/rotor.h24
2 files changed, 25 insertions, 3 deletions
diff --git a/rotord/src/rotor.cpp b/rotord/src/rotor.cpp
index c45ce5e..8883a71 100755
--- a/rotord/src/rotor.cpp
+++ b/rotord/src/rotor.cpp
@@ -346,10 +346,10 @@ Image* Video_loader::output(const Frame_spec &frame){
int wanted;
if (attributes["mode"]->intVal==VIDEOFRAMES_frame) {
- wanted=(((int) ((frame.time*frame.framerate)+0.5))%(player.getNumberOfFrames()-1))+1; //+1 is necessary because 1st frame in a video is number 1?
+ wanted=(((int) ((frame.time*frame.framerate)+0.5))%(player.getNumberOfFrames()))+1; //+1 is necessary because 1st frame in a video is number 1?
}
if (attributes["mode"]->intVal==VIDEOFRAMES_blend) {
- wanted=(((int) ((frame.time*frame.framerate*clipspeed)+0.5))%(player.getNumberOfFrames()-1))+1; //+1 is necessary because 1st frame in a video is number 1?
+ wanted=(((int) ((frame.time*frame.framerate*clipspeed)+0.5))%(player.getNumberOfFrames()))+1; //+1 is necessary because 1st frame in a video is number 1?
}
if (wanted!=lastframe){
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h
index ec9f072..6b80762 100755
--- a/rotord/src/rotor.h
+++ b/rotord/src/rotor.h
@@ -374,11 +374,14 @@ namespace Rotor {
}
private:
};
- class Video_cycler: public Image_node {
+ #define CYCLER_cut 1
+ #define CYCLER_mix 2
+ class Video_cycler: public Image_node {
public:
Video_cycler(){
create_image_input("Image input","Image input");
create_signal_input("Selector","Selector input");
+ create_attribute("mode","Cycling mode {cut|mix}","Mode","cut",{"cut","mix"});
title="Video cycler";
description="Cycles through video inputs according to selector signal";
duplicate_inputs=true;
@@ -389,6 +392,25 @@ namespace Rotor {
~Video_cycler(){};
bool load(const string &filename);
Image *output(const Frame_spec &frame){
+ if (attributes["mode"]->intVal==CYCLER_mix&&image_inputs.size()>1){
+ int im1=((int)inputs[0]->get((Time_spec)frame))%image_inputs.size();
+ int im2=(im1+1)%image_inputs.size();
+ float f=fmod(inputs[0]->get((Time_spec)frame),1.0f);
+ Image *in1=image_inputs[im1]->get(frame);
+ if (in1){
+ Image *in2=image_inputs[im2]->get(frame);
+ if (in2){
+ image=(*in1);
+ image*=(1.0f-f);
+ Image i2=(*in2);
+ i2*=f;
+ image+=i2;
+ return &image;
+ }
+ return in1;
+ }
+ return nullptr;
+ }
return image_inputs[((int)inputs[0]->get((Time_spec)frame))%image_inputs.size()]->get(frame);
}
Video_cycler* clone(map<string,string> &_settings) { return new Video_cycler(_settings);};