summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author[d.j.a.y] Jerome Blanchi <d.j.a.y@free.fr>2016-05-09 08:23:15 (GMT)
committer [d.j.a.y] Jerome Blanchi <d.j.a.y@free.fr>2016-05-09 08:23:15 (GMT)
commitb63f5db473ce280f8532e2eb6f4f6a5df9b7af91 (patch)
tree7a5d2e7272f6aefdebd0ef0c5c04a908a1aad82b
parent4bee72ebd99ad052e58c770df5a73be1868ec344 (diff)
Distort0r: new parameters - mode & velocity
* mode (bool) p3 : aim to select from 'time' (initial behavior) to speed based (controlled by p4 parameter) of the plasma signal * regarding mode, velocity parameter (p4) aim to control speed of the plasma signal
-rw-r--r--src/filter/distort0r/distort0r.c49
1 files changed, 41 insertions, 8 deletions
diff --git a/src/filter/distort0r/distort0r.c b/src/filter/distort0r/distort0r.c
index 5a9a9b4..8f597fc 100644
--- a/src/filter/distort0r/distort0r.c
+++ b/src/filter/distort0r/distort0r.c
@@ -21,12 +21,15 @@ typedef struct grid_point
typedef struct distorter_instance
{
unsigned int width, height;
- double amplitude, frequency;
+ double amplitude, frequency, change_speed;
grid_point_t* grid;
+ double time_stack;
+ double mode;
} distorter_instance_t;
//const double AMPLTUDE_SCALE = 10.0;
const double FREQUENCY_SCALE = 200.0;
+const double SPEED_SCALE = 2.0;
void interpolateGrid(grid_point_t* grid, unsigned int w, unsigned int h,
const uint32_t* src, uint32_t* dst);
@@ -47,8 +50,8 @@ void f0r_get_plugin_info(f0r_plugin_info_t* distorterInfo)
distorterInfo->color_model = F0R_COLOR_MODEL_PACKED32;
distorterInfo->frei0r_version = FREI0R_MAJOR_VERSION;
distorterInfo->major_version = 0;
- distorterInfo->minor_version = 9;
- distorterInfo->num_params = 2;
+ distorterInfo->minor_version = 10;
+ distorterInfo->num_params = 4;
distorterInfo->explanation = "Plasma";
}
@@ -66,6 +69,16 @@ void f0r_get_param_info(f0r_param_info_t* info, int param_index)
info->type = F0R_PARAM_DOUBLE;
info->explanation = "The frequency of the plasma signal";
break;
+ case 2:
+ info->name = "Use Velocity";
+ info->type = F0R_PARAM_BOOL;
+ info->explanation = "\'Time Based\' or \'Adjustable Velocity\'";
+ break;
+ case 3:
+ info->name = "Velocity";
+ info->type = F0R_PARAM_DOUBLE;
+ info->explanation = "Changing speed of the plasma signal";
+ break;
}
}
@@ -78,6 +91,9 @@ f0r_instance_t f0r_construct(unsigned int width, unsigned int height)
((width/GRID_SIZE)+1)*((height/GRID_SIZE)+1));
inst->amplitude = 1.0;
inst->frequency = 1.0;
+ inst->change_speed = 1.0;
+ inst->time_stack = 0.0;
+ inst->mode = 0.0;
return (f0r_instance_t)inst;
}
@@ -90,21 +106,28 @@ void f0r_destruct(f0r_instance_t instance)
void f0r_set_param_value(f0r_instance_t instance,
f0r_param_t param, int param_index)
-{
+{
assert(instance);
distorter_instance_t* inst = (distorter_instance_t*)instance;
switch(param_index)
{
case 0:
- // scale
+ // don't scale
inst->amplitude = *((double*)param);
break;
case 1:
// scale
inst->frequency = *((double*)param) * FREQUENCY_SCALE;
break;
- }
+ case 2:
+ inst->mode = *((f0r_param_bool *)param);
+ break;
+ case 3:
+ // scale
+ inst->change_speed = *((double*)param) * SPEED_SCALE;
+ break;
+ }
}
void f0r_get_param_value(f0r_instance_t instance,
@@ -127,6 +150,14 @@ void f0r_get_param_value(f0r_instance_t instance,
scaled = inst->frequency / FREQUENCY_SCALE;
*((double*)param) = scaled;
break;
+ case 2:
+ *((f0r_param_bool *)param) = inst->mode;
+ break;
+ case 3:
+ // scale to [0..1]
+ scaled = inst->change_speed / SPEED_SCALE;
+ *((double*)param) = scaled;
+ break;
}
}
@@ -156,13 +187,15 @@ void f0r_update(f0r_instance_t instance, double time,
unsigned int w = inst->width;
unsigned int h = inst->height;
unsigned int x,y;
-
+
+ inst->time_stack+=inst->change_speed;
+
grid_point_t* pt = inst->grid;
for(y=0;y<=h;y+= GRID_SIZE)
for(x=0;x<=w;x+=GRID_SIZE,++pt)
{
plasmaFunction(&pt->u, &pt->v, x, y, w, h,
- inst->amplitude, inst->frequency, time);
+ inst->amplitude, inst->frequency, inst->mode?inst->time_stack:time);
}
interpolateGrid(inst->grid, w, h, inframe, outframe);