Effect Macros

   Print

Macros are used to manipulate the result of an effect. A macro is called before and after an effect has been rendered.

Functions called by MADRIX

The following functions are called from MADRIX for each effect and can be implemented by a macro in order to react on different events:

void InitEffect()
void MatrixSizeChanged()
void MapEffect()
void PostRenderEffect()

 

InitEffect

InitEffect is called by MADRIX whenever the script needs to be initialized. This is after compiling and starting a new script or when the user pressed the start - button of the Script editor. A script can assume that any global variable is initialized with 0 and that any global field is empty as long as it has not been initialized explicitly.

MatrixSizeChanged

MatrixSizeChanged is called after the size of the effect matrix has been changed. This may be due to a change to the matrix settings as well as due to a new map setting e.g. done by the call of a map-function.

PreRenderEffect

PreRenderEffect is called before the effect is going to render. Changes done here effect the current frame but may be overwritten by the effect itself. Mostly this function may be used to change the mapping of an effect for example to move it around the matrix.

PostRenderEffect

This function is called immediately after the effect has been rendered. Here the result of the effect can be manipulated for example to use a grey filter on it.

Note: The matrix which the script manipulates is the same one that the effect uses to calculate its own effect. The effect may rely on the output as input for the next frame with undefined behaviour.

Note: Mapping operations done in PostRenderEffect will effect the next frame but not the same one. To effect the same frame use PreRenderEffect.

Functions available for a macro

For macros the standard functions are available which are also available for the MAS Scripteffect.

Note, that the GetSpeed- and SetSpeed - functions are not available for each effect.

In addition to the standard functions of MADRIX Script there are other functions available which are special to each effect. They are described by the chapters below. There is one chapter for each effect explaining which functions are available and what they do.

Functions depending on the effect

There are a lot of different types of effects available within MADRIX where each one has its own settings. Therefore for each effect there are special commands available. Those commands may don't work in other effects and a macro which uses such commands is not compile able under another effect. An example for such a function is SetText for the SCE Ticker effect. This function lets a macro set the text of the Ticker. Since no other effect shows text the function is not available for other effects.

The functions which are available for the different effects and their meaning is described by the chapters below. There is one for each effect type.

Setting and getting the current speed of an effect

Several effects allows to set their speed using the BPM slider onto its GUI. Examples for such effects are the SCE Plasma or the S2L EQ effects. Until the version 2.5 of MADRIX those effects had a speed-slider whose meaning was in Hz and which was in the range of 1 to 50Hz. Since the version 2.5 of MADRIX those effects have a BPM slider where the speed of the effect can be set as beats per minute which is in the range of 0 to 9999.

The macros of those effects who supports setting the speed now have the additional functions void SetBpm(int bpm) and int GetBpm(). Furthermore the range of the SetSpeed function is now from 0 to 166 which represents a range of 0 to 9999 BPM.

Setting BPM to 0 means that the effect will be stopped immediately.

Frame ID

There are a lot of effects which uses an internal frame id to control its behaviour. For example the SCE ColorScroll uses the frame id to control the speed of scrolling. This does not make sense for all effects. However for each effect it is possible to set and get the current frame id and frame count. The frame count identifies the maximal frame id used by the effect. This may be used to speed up the effect. For example the following macro improves the speed of an effect which is controlled by the frame id.

void PreRenderEffect()

{

    SetFrameId(GetFrameId() + 2);

}

 

However, it is not possible to set the frame count by a macro except for a macro of the MAS Script Effect.