Overview (Main Output Macro)

   Print  Previous  Next

Introduction

Main Output macros can be used to manipulate the final output of MADRIX. In this way, special functions can be used to change the outcome and settings. These macros are written in MADRIX Script.

Main Output macros are stored together with a MADRIX Setup file. Moreover, it is possible to save macros as separate files. The file extension of a macro is .mms. The extension of a compiled macro is .mcm.

Fade Area with Main Output Macro

Main Output Macro ButtonThe button to call up the Main Output Macro can be found between the 'Fade' button and the 'Freeze' button.

 

Functions Called By MADRIX

There are several functions called by MADRIX in order to let the macro react to different events.

void InitEffect() 
void PreRenderEffect()
void PostRenderEffect()
void MatrixSizeChanged() 

 

 

If a function is not needed by a script, it is not necessary to implement it. Regarding InitEffect, PreRenderEffect, and PostRenderEffect a message is printed out if one of them is missing. This is not an error, but only an information for the developer of the script.

InitEffect

(automatically included in a new script)

InitEffect is called by MADRIX whenever the macro needs to be initialized. This is the case after compiling and starting a new macro or when the user pressed the "Start" button of the Script Editor. A macro 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 with a value.

This function is the right place to initialize global variables, reset any fields, set the speed of an effect, or whatever is necessary to (re)start the macro.

PreRenderEffect

(automatically included in a new script)

This function is called directly before PostRenderEffect. It may be used if the macro has to initialize any settings before an effect is rendered.

void InitEffect()

{

    

}

void PreRenderEffect()

{

    color c = {random(0, 255), random(0, 255)}; Clear(c);

}

 

This example uses the function PreRenderEffect to fill the matrix once after initializing a random color for this task.

PostRenderEffect

(automatically included in a new script)

This function is called after an effect has been rendered completely. Certain functions might want to be called. That could be a filter, for example. The number of calls per second depends on the currently set speed of the effect. It can be received with the help of the function GetSpeed() and set with the function SetSpeed.

MartrixSizeChanged

(automatically included in a new script)

MatixSizeChanged is called after the size of the matrix has been changed. This may be due to a change to the matrix settings or because a new map setting was set, e.g. caused by the call of a map function.

 

Standard Outline

When you open the Main Output Macro Editor, the empty standard macro will look like this::

@scriptname="";

@author="";

@version="";

@description="";

 

void InitEffect()

{

 

}

 

void PreRenderEffect()

{

 

}

 

void PostRenderEffect()

{

 

}

 

void MatrixSizeChanged()

{

 InitEffect();

}