^
Coding Introduction
To write code, load the Video Processor Plugin into item-FX of the video or track-FX of the track containing your video. It opens a editor window, in which you can write the code. Hit F1 for commands and variables valid for use in the video processor plugin.
Next to it, on the left side of the editor-field, your parameter-knobs will appear(if you've defined some).
Code for the Video-Processor-Plugin must be written in EEL, not in Lua or Python.
Example code, with a knob for turning the video on the current track on and off(use this as track-fx!):
//A small demo-script that turns video of the current track on and off
//@param 1:VideoOnOff 'Video Off(0) On(1)' 1 0 1 0.5 1
frame=1; // variable frame set with the videoframe from the first
// videoitem in the project at a given position
gfx_fillrect(0,0,project_w,project_h); // deletes last frame, by putting a black rectangle on top of it
// to prevent from having the last frame(s) be shown indefinately
//Now, put the picture to the framebuffer -> outputting the video
gfx_blit(frame, // the current video-frame
1, // don't preserve aspect-ratio
0,0, // put upper right corner of the video at position 0,0
project_w*VideoOnOff,project_h*VideoOnOff // size of the video width, height,
// multiplied by the VideoOnOff-Parameter
// 1=video squeezed to 100% height and width
// 0=video squeezed to 0% height and width
);
The following code allows turning the video of the track above(!) the current track on/off and allows moving it and turning it on and off
// A small demo-script that turns video of the current track on and off
//@param 1:VideoOnOff 'Video Off(0) On(1)' 1 0 1 0.5 1
//@param 2:MoveX 'Move X' 0 0 2048 1024 1
//@param 3:MoveY 'Move Y' 0 0 2048 1024 1
frame=input_track(0); // variable frame set with the videoframe from the first
// videoitem in the project at a given position above the current one
gfx_fillrect(0,0,project_w,project_h); // deletes last frame, by putting a black rectangle on top of it
// to prevent from having the last frame(s) be shown indefinately
//Now, put the picture to the framebuffer -> outputting the video
gfx_blit(frame, // the current video-frame
1, // don't preserve aspect-ratio
0+MoveX,0+MoveY, // put upper right corner of the video at position 0,0
// and add the knob-value of MoveX and MoveY to the position
// so changing position is possible
project_w*VideoOnOff, project_h*VideoOnOff // size of the video width, height,
// multiplied by the VideoOnOff-Parameter
// 1=video squeezed to 100% height and width
// 0=video squeezed to 0% height and width
);
^
Introduction
Since Reaper 5, Reaper has proper video-editing support. In addition to that, Reaper has a plugin, called "Video Processor Plugin", that is focused on video-effect handling.
Though it is still in it's very early stages, it supports already a handful of useful effects that can be selected via the presets-selection.
It is also programmable. It opens up a small IDE-window, as part of the "Video-Processor-Plugin"-UI, in which you can put Eel-code(no Lua or Python!), that processes the video.
Unlike with other scripts, the scripts for the video processor plugin do not support the standard-reaper-API-commands, but have an own set of variables and functions. The list of functions can be reached by clicking into the IDE-window of the "video processor plugin" and hitting the F1-key.
Some general notes on the video-processor-plugin:
It has a very limited set of programmable UI-elements, means, only a knob (refer the param-variable for more details) at the time.
The plugin has also sometimes the behaviour of "added effects". That means: If you have several tracks whith video items and you put a video processor plugin on every track as track-FX, they do not only influence the video-items in this track. In fact, they also influence the video-items on the other tracks as well. If you have 10 tracks and every track has a video-effect as track-FX that turns the brightness down by 10%, the resulting image will be a black one. All effects added up each other (10 times -10% brightness).
This effect can be circumvented by putting the video-processor-plugin as item-FX, NOT as track-FX.
^
colorspace
current rendering colorspace, e.g. 'RGBA', 'YV12', or 'YUY2'.
You can override this before drawing (or between drawing).
This may be set to 0 initially if the user has the Auto project colorspace set.
It will be automatically changed if 0 and a drawing operation occurs or an input is successfully queried via input_info().
^
framerate
project FPS (30.0, 29.97, etc)
^
gfx_a
current drawing color (alpha 0..1)
^
gfx_a2
current drawing color alpha channel value (RGB-only, 0..1, defaults to 1)
^
gfx_b
current drawing color (blue 0..1)
^
gfx_dest
destination image handle, or -1 for main framebuffer
^
gfx_g
current drawing color (green 0..1)
^
gfx_mode
drawing mode
0 = normal
1 = additive
3 = multiply (very different in YUV vs RGBA)
17 = (dest + src*gfx_a)*.5 + .5 (only valid when using YUV colorspaces)
18 = dest + (src-0.5)*gfx_a*2.0 (only valid when using YUV colorspaces)
19 = absolute difference: abs(dest-src)*gfx_a (only valid when using YUV colorspaces)
0x100 (flag ORed to above mode) for blit() to enable filtering (if possible)
0x10000 (flag ORed to above mode) to use source alpha (only valid when using RGBA colorspace)
0x40000 (flag ORed to above mode) to use extra clamping in normal mode (for out of range alpha/gradient values)
0x80000 (flag ORed to above mode) to interpret gfx_r/gfx_g/gfx_b as YUV values (in YUV colorspaces)
^
gfx_r
current drawing color (red 0..1)
^
param1..param40
Manage the knobs of your video-processor-script.
param1 hold the value for parameter 1 .. param40 for parameter 40.
used as:
//@param X:ParameterVariableName "ParamShownName" default_value minimum_val maximum_val medium_value step_size
Parameters:
@param X: |
the parameter number, where X is a number between 1 and 40 |
string ParameterVariableName |
the variable, which holds the current setting of the knob |
string "ParamShownName" |
this will be shown at the knob |
number default_value |
the default-value, with which it will be initialized or reset to, when doubleclicking the knob; can be float and/or negative as well; should be between minimum_val and maximum_val; 0, if not given |
number minimum_val |
the minimum value; can be any value, float and negative; should be lower than minimum_val; 0, if not given |
number maximum_val |
the maximum value; can be any value, float and negative; should be bigger than minimum_val; 1, if not given |
number medium_value |
the value that shall be the medium value, which is the value when the knobposition is at 12 o clock; must be bwetween minimum_val and maximum_val; can be float and negative; middle between minimum_val and maximum_va, if not given |
number step_size |
the size of each step, when turning around the knob; can be float; negative values are interpreted as between 0 and 1; 0.005, if not given |
^
param_wet
if in FX form, wet/dry mix of effect.
^
project_h
project preferred video height (code can override this before drawing)
^
project_tempo
current tempo in BPM
^
project_time
project time in seconds
^
project_time_qn
current project position in QN
^
project_timeoffs
project setting time offset in seconds
^
project_ts_denom
current time signature denominator
^
project_ts_num
current time signature numerator
^
project_w
project preferred video width (code can override this before drawing)
^
project_wh_valid
set nonzero if project_w/project_h reflect actual project setting (otherwise could be media-defined)
^
time
item time in seconds (if in item)
^
gfx_blit
EEL2: integer retval = gfx_blit(integer input[, optional integer preserve_aspect=0, integer x, optional integer y, optional integer w, optional integer h, optional integer srcx, optional integer srcy, optional integer srcw, optional integer srch])
Draws input to framebuffer. preserve_aspect=-1 for no fill in pad areas
Returnvalues:
integer retval |
0, if blitting is impossible; 1, if blitting was successful |
Parameters:
integer input |
the input, that shall be blit into the framebuffer |
optional integer preserve_aspect |
0, preserve aspect ratio; -1, no fill in pad areas |
optional integer x |
the x-position in pixels, at which the input shall be blit to |
optional integer y |
the y-position in pixels, at which the input shall be blit to |
optional integer w |
the width in pixels, with which the input shall be blit to |
optional integer h |
the height in pixels, with which the input shall be blit to |
optional integer srcx |
the x-offset in the source pixels, from which the input shall be blit from |
optional integer srcy |
the y-offset in the source pixels, from which the input shall be blit from |
optional integer srcw |
the width-offset in the source pixels, from which the input shall be blit from |
optional integer srch |
the height-offset in the source pixels, from which the input shall be blit from |
^
gfx_deltablit
EEL2: integer retval = gfx_deltablit(integer srcidx, integer x, integer y, integer w, integer h, integer srcx, integer srcy, integer dsdx, integer dtdx, integer dsdy, integer dtdy, integer dsdxdy, integer dtdxdy[, optional integer dadx, optional integer dady, optional integer dadxdy])
Blits with source pixel transformation control.
S and T refer to source coordinates:
dsdx is how much the source X position changes with each X destination pixel,
dtdx is how much the source Y position changes with each X destination pixel, etc.
All of the S, T and A parameters accept negative values as well.
Returnvalues:
integer retval |
0, blitting was unsuccessful(possibly due invalid image-source); 1, blitting was successful |
Parameters:
integer srcidx |
the index of the image, from which you want to deltablit |
integer x |
the x-position of the blitted-image in pixels |
integer y |
the y-position of the blitted-image in pixels |
integer w |
the width of the blitted-image in pixels |
integer h |
the height of the blitted-image in pixels |
integer srcx |
the x-offset in pixels of the source-image, that shall be blitted; use 0 for original picture position |
integer srcy |
the y-offset in pixels of the source-image, that shall be blitted; use 0 for original picture position |
float dsdx |
the source X position change with each X destination pixel; use 1 for original picture position |
float dtdx |
the source Y position change with each X destination pixel; use 0 for original picture position |
float dsdy |
the source X position change with each Y destination pixel; use 1 for original picture position |
float dtdy |
the source Y position change with each Y destination pixel; use 0 for original picture position |
float dsdxdy |
affects x and y-direction at the same time and can be produced for curved images; use 0 for original picture position |
float dtdxdy |
affects x and y-direction at the same time and can be produced for curved images; use 0 for original picture position |
optional float dadx |
the source-alpha change with each X destination pixel; can be used for noise-effects; use 0 for original picture position |
optional float dady |
the source-alpha change with each Y destination pixel; can be used for noise-effects; use 0 for original picture position |
optional float dadxdy |
affects x and y-direction at the same time; can be used for noise-effects; use 0 for original picture position |
^
gfx_destkeyedblit
EEL2: integer retval = gfx_destkeyedblit(input input[, optional integer x, optional integer y, optional integer w, optional integer h, optional integer srcx, optional integer srcy, optional float kv1, optional float kv2, optional float kv3, optional float kv4])
Chroma-key blits, using destination color as key. ignores gfx_a and gfx_mode.
kv1-kv4 meaning depends on colorspace:
YV12/YUY2:
kv1 is U target (-0.5 default)
kv2 is V target (-0.5 default)
kv3 is closeness-factor (0.4 default)
kv4 is the gain (2.0 default)
RGBA:
kv1 is green-factor (1.0 default)
kv2 is blue-factor (-1.0 default)
kv3 is offset (-1.0 default)
kv4 enables spill removal (1.0 default)
Returnvalues:
Parameters:
integer input |
the image, to which the chroma-key shall be applied to |
optional integer x |
the x-position of the chroma-key-area in pixels |
optional integer y |
the y-position of the chroma-key-area in pixels |
optional integer w |
the width-position of the chroma-key-area in pixels |
optional integer h |
the height-position of the chroma-key-area in pixels |
optional integer srcx |
the offset-x-position of the source-image |
optional integer srcy |
the offset-y-position of the source-image |
optional float kv1 |
U target(YV12/YUV2) / green(RGBA) |
optional float kv2 |
V target(YV12/YUV2) / blue(RGBA) |
optional float kv3 |
closeness-factor(YV12/YUV2) / offset(RGBA) |
optional float kv4 |
gain(YV12/YUV2) / spill removal(RGBA) |
see:
gfx_keyedblit - alternative chroma-key blitting method, using sourcecolor as key |
^
gfx_evalrect
EEL2: integer retval = gfx_evalrect(integer x, integer y, integer w, integer h, string code_string[, optional integer flags, optional integer src, optional string init_code_string, optional string src2])
Processes a rectangle with code_string being executed for every pixel/pixel-group.
Returns -1 if code_string failed to compile.
Code should reference per pixel values (0-255, unclamped), depending on colorspace:
RGBA: r/g/b/a (0-255, unclamped)
YUY2: y1,y2, u, v (0-255, unclamped; u/v are centered at 128)
YV12: y1-y4, u, v (0-255, unclamped; u/v are centered at 128)
example for a codestring:
"r[0]+=1; g[256]+=1; b[512]+=1;
(0.299*r + 0.587*g + 0.114*b)[768] += 1;"
Additional options:
flags|=1 in order to prevent multiprocessing (if your routine needs to process pixels in-order)
flags|=2 to ignore output (analysis-only). This is only valid when not using src2 and not using one of the 4/8 modes.
flags|=4,8 -- only valid in RGBA/YV12, and only if src/src2 not specified. flags&8 means process in vertical slices (top to bottom unless flags&4). flags&4 but not flags&8 means right-to-left. In each case y1-y4 are reordered for convenience (the same filter code can typically be used in various orientations).
If init_code_string specified, it will be executed in each thread context before processing
If src specified (and >= -1), sr/sg/sb/sa, sy1/su/sv etc will be available to read. In this case only the intersection of valid rectangles between src and the destination buffer will be processed.
If src and src2 specified (and >= -1), s2r/s2g/s2b/s2a, s2y1/s2u/s2v etc will also be available to read.
Note: variables _1-_99 are thread-local variables which will always be initialized to 0, and _0 will be initialized to the thread index (usually 0 or 1). 6.70+: _slice is an alias of _0. _slices is a count of the multiprocessing slices, _span is the number of calls per line, and _slice_size is the size of each slice in lines (the last slice may vary in size).
Returnvalues:
integer retval |
-1, in case of an error(compilation of the code_string was unsuccessful) |
Parameters:
integer x |
the x-position of the rectangle |
integer y |
the y-position of the rectangle |
integer w |
the width of the rectangle |
integer h |
the height of the rectangle |
string code_string |
a string with code, with which the rectangle shall be processed |
optional integer flags |
flags, that influence the processing |
optional integer src |
the source-image |
optional string init_code_string |
a code-string, that shall be used during initialization |
optional string src2 |
a second source-image |
^
gfx_fillrect
EEL2: integer retval = gfx_fillrect(integer x, integer y, integer w, integer h)
Fills a rectangle with the current color/mode/alpha set by gfx_set
Returnvalues:
integer retval |
0, in case of an error; 1, in case of success |
Parameters:
integer x |
the x-position of the rectangle in pixels |
integer y |
the y-position of the rectangle in pixels |
integer w |
the width of the rectangle in pixels |
integer h |
the height of the rectangle in pixels |
see:
gfx_set - sets color, alpha and mode for drawing |
^
gfx_getpixel
EEL2: integer retval = gfx_getpixel(integer input, integer x, integer y, integer #v1, integer #v2, integer #v3[, optional integer #v4])
Gets the value of a pixel from input at x,y.
Unlike other gfx-functions, the values returned by this function are of the range of 0-255, NOT 0-1!
v1/v2/v3 will be YUV or RGB (v4 can be used to get Alphavalue), returns 1 on success
Returnvalues:
integer retval |
0, getting the pixel wasn't successful; 1, getting the pixel was successful |
Parameters:
integer input |
the input-image from which to get the pixel |
integer x |
the x-position of the pixel, whose color you want |
integer y |
the y-position of the pixel, whose color you want |
integer #v1 |
a pointer to a variable, into which gfx_getpixel writes the red-value |
integer #v2 |
a pointer to a variable, into which gfx_getpixel writes the green-value |
integer #v3 |
a pointer to a variable, into which gfx_getpixel writes the blue-value |
optional integer #v4 |
a pointer to a variable, into which gfx_getpixel writes the alpha-value |
^
gfx_gradrect
EEL2: integer retval = gfx_gradrect(integer x, integer y, integer w, integer h, float r, float g, float b, float a [, optional float drdx, optional float dgdx, optional float dbdx, optional float dadx, optional float drdy, optional float dgdy, optional float dbdy, optional float dady])
Fills rectangle. r/g/b/a supply color at top left corner, drdx (if specified) is amount red changes per X-pixel, etc.
Returnvalues:
Parameters:
integer x |
the x-position of the rectangle in pixels |
integer y |
the y-position of the rectangle in pixels |
integer w |
the width of the rectangle in pixels |
integer h |
the height of the rectangle in pixels |
float r |
the red-color-value(0-1) |
float g |
the green-color-value(0-1) |
float b |
the blue-color-value(0-1) |
float a |
the alpha-color-value(0-1) |
optional float drdx |
the amount of delta-value, how the red-color shall be changed each pixel in x-direction |
optional float dgdx |
the amount of delta-value, how the green-color shall be changed each pixel in x-direction |
optional float dbdx |
the amount of delta-value, how the blue-color shall be changed each pixel in x-direction |
optional float dadx |
the amount of delta-value, how the alpha-color shall be changed each pixel in x-direction |
optional float drdy |
the amount of delta-value, how the red-color shall be changed each pixel in y-direction |
optional float dgdy |
the amount of delta-value, how the green-color shall be changed each pixel in y-direction |
optional float dbdy |
the amount of delta-value, how the blue-color shall be changed each pixel in y-direction |
optional float dady |
the amount of delta-value, how the alpha-color shall be changed each pixel in y-direction |
^
gfx_img_alloc
EEL2: integer image_index = gfx_img_alloc([optional integer w, optional integer h, optional integer clear])
Returns an image index for drawing (can create up to 32 images). Contents of image undefined unless clear set.
Returnvalues:
integer image_index |
the index of the newly created image |
Parameters:
optional integer w |
set the width in pixels |
optional integer h |
set the height in pixels |
optional integer clear |
clear the image, before using it |
^
gfx_img_free
EEL2: gfx_img_free(integer handle)
Releases an earlier allocated image index.
Parameters:
integer handle |
the image handle, that you want to delete from further use |
^
gfx_img_getptr
EEL2: integer unique_identifier = gfx_img_getptr(integer handle)
Gets a unique identifier for an image, valid for while the image is retained.
Can be used (along with gfx_img_hold) to detect when frames change in a low frame rate video
Returnvalues:
integer unique_identifier |
the unique identifier for image "handle" |
Parameters:
integer handle |
the image-handle, of which you want to have a unique identifier |
see:
^
gfx_img_hold
EEL2: gfx_img_hold(integer handle)
Retains (cheaply) a read-only copy of an image in handle.
This copy should be released using gfx_img_free() when finished. Up to 32 images can be held.
Parameters:
integer handle |
the handle, that you want to make read-only |
see:
^
gfx_img_info
EEL2: integer retval = gfx_img_info(integer handle, integer #w, integer #h)
Gets dimensions of image, returns 1 if valid (resize it if it's inexplicably invalidated)
Returnvalues:
integer retval |
1, if it's a valid image-handle |
Parameters:
integer handle |
the image-handle, whose dimensions you want to retrieve |
integer #w |
the pointer of a variable, into which the width in pixels shall be stored |
integer #h |
the pointer of a variable, into which the height in pixels shall be stored |
^
gfx_img_resize
EEL2: integer image_handle = gfx_img_resize(integer handle, integer w, integer h[, optional integer clear])
Sets an image size (handle can be -1 for main framebuffer).
Contents of image undefined after resize, unless clear set.
Clear=-1 will only clear if resize occurred.
Returns the image handle (if handle is invalid, returns a newly-allocated image handle)
Returnvalues:
integer image_handle |
the image-handle of the resized image; will be a newly allocated one, if parameter handle was invalid |
Parameters:
integer handle |
the handle of the image, that you want to resize |
integer w |
the new width in pixels |
integer h |
the new height in pixels |
optional integer clear |
set to clear the image; -1, clears only, if resize has occurred. |
^
gfx_keyedblit
EEL2: integer retval = gfx_keyedblit(integer input[, optional integer x, optional integer y, optional integer w, optional integer h, optional integer srcx, optional integer srcy, optional float kv1, optional float kv2, optional float kv3, optional float kv4])
Chroma-key blits, using the source color as key. kv1-kv4 meaning depends on colorspace:
YV12/YUY2:
kv1 is U target (-0.5 default)
kv2 is V target (-0.5 default)
kv3 is closeness-factor (0.4 default)
kv4 is the gain (2.0 default)
RGBA:
kv1 is green-factor (1.0 default)
kv2 is blue-factor (-1.0 default)
kv3 is offset (-1.0 default)
kv4 enables spill removal (1.0 default)
Returnvalues:
Parameters:
integer input |
the image, to which the chroma-key shall be applied to |
optional integer x |
the x-position of the chroma-key-area in pixels |
optional integer y |
the y-position of the chroma-key-area in pixels |
optional integer w |
the width-position of the chroma-key-area in pixels |
optional integer h |
the height-position of the chroma-key-area in pixels |
optional integer srcx |
the offset-x-position of the source-image |
optional integer srcy |
the offset-y-position of the source-image |
optional float kv1 |
U target(YV12/YUV2) / green(RGBA) |
optional float kv2 |
V target(YV12/YUV2) / blue(RGBA) |
optional float kv3 |
closeness-factor(YV12/YUV2) / offset(RGBA) |
optional float kv4 |
gain(YV12/YUV2) / spill removal(RGBA) |
^
gfx_procrect
EEL2: integer retval = gfx_procrect(integer x, integer y, integer w, integer h, table channel_tab[, optional integer mode])
Processes a rectangle with 768-entry channel table [256 items of 0..1 per channel].
Specify mode=1 to use Y value for U/V source channels (colorization mode).
Returnvalues:
Parameters:
integer x |
the x-position of the rectangle in pixels |
integer y |
the y-position of the rectangle in pixels |
integer w |
the width of the rectangle in pixels |
integer h |
the height of the rectangle in pixels |
table channel_tab |
a 768-entry-table which will be used for the processing |
integer mode |
1, to use Y-value for U/V-source-channels |
^
gfx_rotoblit
EEL2: integer retval = gfx_rotoblit(integer srcidx, float angle [, optional integer x, optional integer y, optional integer w, optional integer h, optional integer srcx, optional integer srcy, optional integer w, optional integer h, optional integer cliptosrcrect, optional integer centxoffs, optional integer centyoffs])
Blits with rotate. This function behaves a bit odd when the source and destination sizes/aspect ratios differ, so gfx_deltablit is generally more useful.
Returnvalues:
integer retval |
0, blitting was unsuccessful(possibly due invalid image-source); 1, blitting was successful |
Parameters:
integer srcidx |
the source-image, that shall be blit as rotated image |
float angle |
the angle by width the image shall be rotated |
optional integer x |
the x-position in pixels, at which the blitting shall be put to |
optional integer y |
the y-position in pixels, at which the blitting shall be put to |
optional integer w |
the width in pixels of the rotated-blit-image; affects stretching of the image! |
optional integer h |
the height in pixels of the rotated-blit-image; affects stretching of the image! |
optional integer srcx |
the x-position in pixels in the source-image, from which to blit from |
optional integer srcy |
the y-position in pixels in the source-image, from which to blit from |
optional integer w |
the width in pixels of the source-image, from which to blit from; affects stretching of the image! |
optional integer h |
the height in pixels of the source-image, from which to blit from; affects stretching of the image! |
optional integer cliptosrcrect=0 |
clips the source-image rectangle; 1, clip; 0, don't clip |
optional integer centxoffs=0 |
adds an offset to the center of the image at x-position in pixels |
optional integer centyoffs=0 |
adds an offset to the center of the image at x-position in pixels |
see:
gfx_deltablit - alternative blitting method with source pixel transformation control |
^
gfx_set
EEL2: gfx_set(float r,[optional float g, optional float b, optional float a=1, integer mode=0, optional integer dest, optional float a2=1])
Updates r/g/b/a/mode to values specified, dest is only updated if parameter specified.
Parameters:
float r |
the red-value(0 to 1); if set as the only parameter, this will be used for g and b as well |
optional float g |
the green-value(0 to 1); if unset, the value of r will be used |
optional float b |
the blue-value(0 to 1); if unset, the value of r will be used |
optional float a=1 |
the alpha-value(0 to 1); if unset, the value defaults to 1 |
integer mode |
see gfx_mode for the available modes; if unset, defaults to 0 |
optional integer dest |
the destination, into which to draw |
optional float a2 |
the alpha2-value, see gfx_a2; if unset, defaults to 1 |
^
gfx_setfont
EEL2: integer retval = gfx_setfont(integer pxsize[, optional string #fontname, optional integer flags)
Sets a font. flags are specified as a multibyte integer, using a combination of the following flags (specify multiple as 'BI' or 'OI' or 'OBI' etc):
'B' - Bold
'I' - Italics
'R' - Blur
'V' - Invert
'M' - Mono
'S' - Shadow
'O' - Outline
Returnvalues:
Parameters:
integer pxsize |
the size of the font in pixels |
optional string #fontname |
the name of the font you want to use |
optional integer flags |
the flags, that can influence the design of the font. Just put one or more of the following into single quotes
'B' - Bold
'I' - Italics
'R' - Blur
'V' - Invert
'M' - Mono
'S' - Shadow
'O' - Outline
example: 'BI' |
^
gfx_str_draw
EEL2: integer retval = gfx_str_draw(string #string[, optional integer x, optional integer y, optional float fxc_r, optional float fxc_g, optional float fxc_b])
Draw string, fxc_r/g/b are the FX color if Shadow/Outline are set in the font
Returnvalues:
Parameters:
string #string |
the string, that shall be drawn into the video |
optional integer x |
x-position of the string, in pixels |
optional integer y |
y-position of the string, in pixels |
optional float fxc_r |
red-color-value for outline/shadow, if set in the current font(0-1) |
optional float fxc_g |
green-color-value for outline/shadow, if set in the current font(0-1) |
optional float fxc_b |
blue-color-value for outline/shadow, if set in the current font(0-1) |
^
gfx_str_measure
EEL2: integer string_length = gfx_str_measure(string #string[, optional integer #w, optional integer #h])
Measures the size of #string, returns width
Returnvalues:
integer string_length |
the length of the string in pixels |
Parameters:
string #string |
the string, whose width/height you want to know; it depends on the currently set font and fontsize |
optional integer #w |
a reference to a variable, that shall be set with the width in pixels by the function gfx_str_measure |
optional integer #h |
a reference to a variable, that shall be set with the height in pixels by the function gfx_str_measure |
^
gfx_xformblit
EEL2: integer retval = gfx_xformblit(integer srcidx, integer x, integer y, integer w, integer h, integer wdiv, integer hdiv, table tab[, optional integer wantalpha])
Blits with a transformation table.
tab is wdiv*hdiv*2 table of source point coordinates in float-values.
If wantalpha=1, tab is wdiv*hdiv*3 table of src points including alpha for each point.
Returnvalues:
integer retval |
0, blitting was unsuccessful(possibly due invalid image-source); 1, blitting was successful |
Parameters:
integer srcidx |
the index of the image, that you want to transformblit |
integer x |
x-position in pixels of the transform-blitted-image |
integer y |
y-position in pixels of the transform-blitted-image |
integer w |
width in pixels of the transform-blitted-image |
integer h |
height in pixels of the transform-blitted-image |
integer wdiv |
the divisor of the table tab for width transformation |
integer hdiv |
the divisor of the table tab for height transformation |
table tab |
a table with all the transform-values in them, who are float and can be negative as well |
optional integer wantalpha |
0, transform the image only; 1, transform on an alpha-level |
^
input_count
EEL2: integer count_inputs = input_count()
Returns number of inputs available (total), range [0..n)
Returnvalues:
integer count_inputs |
the number of inputs available |
^
input_get_name
EEL2: integer retval = input_get_name(integer input, string #str)
Gets the input take name or track name. returns >0 on success
Returnvalues:
integer retval |
>0, if name can be gotten |
Parameters:
integer input |
the input, whose name you want to query |
string #str |
the pointer to a string-variable, into which the input-name shall be stored |
^
input_info
EEL2: integer retval = input_info(integer input, integer w, integer h[, double srctime, double wet, double parm1, ...])
Returns 1 if input is available, sets w/h to dimensions.
If srctime specified, it will be set with the source-local time of the underlying media.
If input is a video processor in effect form, automated parameters can be queried via wet/parm1/...
Returnvalues:
integer retval |
1, if input is available |
Parameters:
integer input |
the input, whose information you want |
integer w |
width-dimension in pixels; will be set, if input is available |
integer h |
height-dimension in pixels; will be set, if input is available |
^
input_ismaster
EEL2: float fx_position = input_ismaster()
Returns 1.0 if current FX is on master chain, 2.0 if on monitoring FX chain
Returnvalues:
float fx_position |
1.0, FX is on master chain; 2.0, FX is on monitoring FX chain |
^
input_next_item
EEL2: integer next_input = input_next_item(integer input)
Returns the next_input after input which is on a different item or track
Returnvalues:
integer next_input |
the next input after input |
Parameters:
integer input |
the input whose next_input you want |
^
input_next_track
EEL2: integer next_input = input_next_track(integer input)
Returns the next_input after input which is on a different track.
Returnvalues:
integer next_input |
the next input on a different track |
Parameters:
integer input |
the input, whose next input on a different track you want |
^
input_track
EEL2: integer input = input_track(integer track)
Returns input for bottommost item or FX on discrete-track track (0 is first track with video item above current, etc)
Returnvalues:
integer input |
the input for bottomost item or FX |
Parameters:
integer track |
the track, whose bottommost item or FX you want |
^
input_track_count
EEL2: integer count_tracks = input_track_count()
Returns the number of available inputs on discrete tracks
Returnvalues:
integer count_tracks |
the number of tracks available |
^
input_track_exact
EEL2: integer inputs = input_track_exact(integer track)
Returns input for bottommost item or FX on track relative to current track.
Returns -1000 if track does not contain any video items at the current time, or -10000 if no further tracks contain video.
Returnvalues:
integer inputs |
the input for bottommost item or FX |
Parameters:
integer track |
the tracknumber, whose bottommost input you want |
^
input_track_exact_count
EEL2: nteger num_tracks = input_track_exact_count()
Returns the number of tracks above the current track that could possibly contain video items.
Returnvalues:
integer num_tracks |
the number of tracks above the current track, that could contain videoitems |
^
rgb2yuv
EEL2: integer retval = rgb2yuv(float #r, float #g, float #b)
Converts r,g,b to YUV, does not clamp [0..1]
Returnvalues:
Parameters:
float #r |
a pointer-variable; put the r-value into it, pass it to the function and it will replace the r-value with the y value |
float #g |
a pointer-variable; put the g-value into it, pass it to the function and it will replace the g-value with the u value |
float #b |
a pointer-variable; put the b-value into it, pass it to the function and it will replace the b-value with the v value |
^
yuv2rgb
EEL2: integer retval = yuv2rgb(float #r, float #g, float #b)
Converts YUV to r,g,b, not clamping [0..1]
Returnvalues:
Parameters:
float #y |
a pointer-variable; put the y-value into it, pass it to the function and it will replace the y-value with the r value |
float #u |
a pointer-variable; put the u-value into it, pass it to the function and it will replace the u-value with the g value |
float #v |
a pointer-variable; put the v-value into it, pass it to the function and it will replace the v-value with the b value |
^
convolve_c
EEL2: integer retval = convolve_c(table dest, table src, integer size)
Multiplies each of size complex pairs in dest by the complex pairs in src. Often used for convolution.
Returnvalues:
Parameters:
table dest |
the table, in which the function will write the destination-values |
table src |
the table, from which the function will get the destination-values |
integer size |
the size of the tables |
^
fft
EEL2: integer retval = fft(table buffer, integer size)
Performs a FFT on the data in the local memory buffer at the offset specified by the first parameter.
The size of the FFT is specified by the second parameter, which must be a power of two 16-32768.
The outputs are permuted, so if you plan to use them in-order, call fft_permute(buffer, size) before and fft_ipermute(buffer,size) after in-order use.
Inputs or outputs will need to be scaled down by 1/size.
Notes:
fft()/ifft() require real / imaginary input pairs, so a 256 point FFT actually works with 512 items.
fft()/ifft() must NOT cross a 65,536 item boundary, so be sure to specify the offset accordingly.
Returnvalues:
integer retval |
value of buffer, if buffer is only one variable instead of a table |
Parameters:
table buffer |
a table, with all values that shall be processed using the FFT |
integer size |
the size of the FFT, as a power of two between 2^4(16) to 2^15(32768) |
^
fft_ipermute
EEL2: integer retval = fft_ipermute(buffer,size)
Permutes the input for ifft(), taking bands from in-order to the order ifft() requires. See fft() for more information.
Returnvalues:
integer retval |
value of buffer, if buffer is only one variable instead of a table |
Parameters:
table buffer |
a table, with all values that shall be processed using the FFT |
integer size |
the size of the FFT, as a power of two between 2^4(16) to 2^15(32768) |
^
fft_permute
EEL2: integer retval = fft_permute(table buffer, integer size)
Permutes the output of fft() to have bands in-order.
Returnvalues:
integer retval |
value of buffer, if buffer is only one variable instead of a table |
Parameters:
table buffer |
a table, with all values that shall be processed using the FFT |
integer size |
the size of the FFT, as a power of two between 2^4(16) to 2^15(32768) |
^
fft_real
EEL2: integer retval = fft_real(table buffer, integer size)
Performs a real FFT, taking size input samples and producing size/2 complex output pairs. Usually used along with fft_permute(size/2).
Inputs/outputs will need to be scaled by 0.5/size. The first output complex pair will be (DC, nyquist).
Returnvalues:
integer retval |
value of buffer, if buffer is only one variable instead of a table |
Parameters:
table buffer |
a table, with all values that shall be processed using the FFT |
integer size |
the size of the FFT, as a power of two between 2^4(16) to 2^15(32768) |
^
gmem
gmem[] can be used for a shared memory buffer (similar to JSFX) --
you can specify a named buffer which can be shared with EEL2 ReaScripts and JSFX, by using:
//@gmem=sharedBufferName
on a line by itself.
Note that when synchronizing with ReaScripts or JSFX, all processing is asynchronous, so your code will have to deal with
synchronization issues (including vast differences between project_time and playback_position, and including race conditions). For Lua ReaScripts, see the function Lua-ReaScript function gmem_attach(), gmem_write() and gmem_read().
To get/set values from gmem, use gmem[index].
Example:
variable=gmem[7]; // put the value from gmem with index 7 into variable
gmem[8]=project_time; // put the current project_time into gmem with index 8
Note: you can have only one gmem-buffername attached per video-processor-script.
^
ifft
EEL2: integer retval = ifft(table buffer, integer size)
Performs an inverse FFT. For more information see fft().
Returnvalues:
integer retval |
value of buffer, if buffer is only one variable instead of a table |
Parameters:
table buffer |
a table, with all values that shall be processed using the iFFT |
integer size |
the size of the FFT, as a power of two between 2^4(16) to 2^15(32768) |
^
ifft_real
EEL2: integer retval = ifft_real(table buffer, integer size)
Performs an inverse FFT, taking size/2 complex input pairs (the first being DC, nyquist) and producing size real output values.
Usually used along with fft_ipermute(size/2).
Returnvalues:
integer retval |
value of buffer, if buffer is only one variable instead of a table |
Parameters:
table buffer |
a table, with all values that shall be processed using the iFFT |
integer size |
the size of the FFT, as a power of two between 2^4(16) to 2^15(32768) |
^
on_parameter_change
EEL2: on_parameter_change(float pvar[, optional integer isdone])
Notifies that the parameter pointed to by pvar (must be param1..param40 or a user-defined parameter) has changed.
Specify isdone=1 when done modifying parameter (e.g. releasing touch)
Parameters:
float pvar |
the parameter, whose parameter-change you want to notify |
optional integer isdone |
1, when done modifying parameter |
^
time_precise
EEL2: integer retval = time_precise([optional float #val])
Sets the parameter (or a temporary buffer if omitted) to a system-local timestamp in seconds, and returns a reference to that value.
The granularity of the value returned is system defined (but generally significantly smaller than one second).
Returnvalues:
integer retval |
the precise time |
Parameters:
optional float |
a pointer to a variable, into which time_precise can write the current time |
^
ui_get_state
EEL2: integer click_modifier_state = ui_get_state(integer #ctx[, optional integer #mouse_x, optional integer #mouse_y, optional integer force_frame_in, optional integer #mouse_wheel_state, optional integer #mouse_hwheel_state])
Gets UI state and context, only usable from Monitoring FX (returns 0 if used from track).
Returns state
(1/2/4 are l/r/m mouse buttons,
8/16/32 are ctrl/shift/alt,
1024 is whether configuration for this processor is visible).
If 'ctx' set to -1, context is video window and any returned mouse coordinates are [0..1] (where 0,0 is upper left corner, 1,1 is lower right corner of the video area).
If 'ctx' is set to [1..24], it means the user is editing that knob.
If force_frame_in is specified and is positive, then the processor will be re-executed in this amount of time (even if no new video source is available), otherwise only updated during playback or change of the video.
Returnvalues:
integer click_modifier_state |
1/2/4 are l/r/m mouse buttons,
8/16/32 are ctrl/shift/alt,
1024 is whether configuration for this processor is visible |
Parameters:
integer #ctx |
-1, mouse is above video-processor; 1-40, mouse is changing knob 1-40; 0, mouse is outside the video-window |
optional integer #mouse_x |
ui_get_state puts into this variable the current x-mouse-position(0-1)/knob-control area-xposition, when ctc>-1 |
optional integer #mouse_y |
ui_get_state puts into this variable the current y-mouse-position(0-1)/knob-control area-yposition, when ctc>-1 |
optional number force_frame_in |
positive, update getting the ui-state even if no video is available; in seconds |
optional integer #mouse_wheel_state |
ui_get_state puts into this variable the current mouse-wheel-state |
optional integer #mouse_hwheel_state |
ui_get_state puts into this variable the current horizontal-mouse-wheel-state |
| | Automatically generated by Ultraschall-API 5 - 67 elements available
|