Using Frames

   Print  Previous  Next

Introduction

The MADRIX user interface provides several possibilities to change the speed of effects, such as Speed Master Left/Right, Speed Pitch, and BPM.
In MADRIX Script, additional functions are provided that allow for much more control.

 

Functions

Function

Description

MAS Script

Macros for Effects

Storage Place Macro

Main Output Macro

void SetAsync(int value)

Sets the asynchronous rendering mode.

This function is only available for some effects.

+

+

 

 

int GetAsync()

Returns if asynchronous rendering is used.

This function is only available for some effects.

+

+

 

 

void ToggleAsync()

Toggles the asynchronous rendering mode.

This function is only available for some effects.

+

+

 

 

void SetFrameId(float id)

Sets a new Frame ID. If the given id is lower than 0, it is set to 0.

+

+

 

 

float GetFrameId()

Returns the ID of the current frame.

+

+

 

 

float GetFrameSteps()

Returns the number of frames between this and the last call.

+

+

 

 

float GetFrameCount()

Retrieves the number of frames the effect produces before it gets repeated. This is the same value which was set by SetFrameCount for MAS Script. The initial value is 1000.0.

+

+

 

 

void SetFrameCount(float fc)

Set the number of frames the effect produces before it gets repeated.

+

 

 

 

void SetStep(int value)

Sets the stepped rendering mode.

This function is only available for some effects.

+

+

 

 

int GetStep()

Returns if stepped rendering is used.

This function is only available for some effects.

+

+

 

 

void ToggleStep()

Toggles the stepped rendering mode.

This function is only available for some effects.

+

+

 

 

 

MADRIX 2.X To MADRIX 3.X Migration Hints

The following functions are not supported anymore. Please follow the hints to migrate your macros.

Function

Description

void SetFixedFrameRate(int bpm, int enable)

Use SetAsync(int value) instead.

Please note that the interpretation of value is inverted now (deactivated asynchonous rendering activates the usage of a fixed frame rate and vice versa). Furthermore, the usage of a fixed frame rate will always synchonize the effect to the frame rate of the Main Mixer of MADRIX which is 50 Hz by default. The render frequency (bpm) cannot be controlled by macro anymore.

void SetUseFloatFrames(int enable)

Use SetStep(int value) instead.

Please note that the interpretation of value is inverted now. (If stepped rendering is deactivated, floating-point frames are used. If stepped rendering is activated, integer frames are used.)

 

Applying Asynchronous Rendering

Overview

Normally, MADRIX Effects are synchronized to the Main Mixing Frame Rate, which is set to 50 Hz by default. But for the »MAS Script Effect there is the option to control the render frequency independently.

void SetAsync(int value)
int GetAsync()
void ToggleAsync()

 

Valid values for value are 0 (Off) or 1 (On). If asynchronous rendering is activated, the render frequency directly corresponds to the BPM value set by the slider or the macro. For example, a BPM value of 1200 causes a render frequency of 20 Hz. In other words, the effect renders 20 frames per second. Thus, you can decrease the render frequency in order to save performance by slowing down the effect. However, there is an upper limit for the render frequency, which is 50 Hz by default according to the Main Mixing.

There is another scenario to use asynchronous rendering in the MAS Script Effect: Imagine, you want to draw a line step by step, one pixel per frame. Straight forwardly, you can set one pixel after another with each call of »RenderEffect. In order to control the speed of drawing with the BPM slider, it would be smart to activate asynchronous rendering. That way, RenderEffect is called more or less often, depending on the BPM value. Yet another example would be to write a speed-sensitive counter which draws sequential numbers according to the BPM value.

 

Summary

During execution of an MAS Script Effect script, you can use the BPM slider.
If Async is deactivated (Sync is activated), the script runs with the Main Mixing frequency. The render frequency is fixed. The BPM slider controls the Frame ID / Frame Step.
(Go to Preferences > Options... > Performance to change the Main Mixing FPS if really necessary.)
If Async is activated, the MAS Script Effect calculates its render frequency according to the BPM slider (60 BPM = 1 FPS; 1200 BPM = 20 FPS; 3000 BPM = 50 FPS; etc.). The render frequency is variable. The maximum render frequency is still set up by the Main Mixing frequency.
(Go to Preferences > Options... > Performance to change the Main Mixing FPS if really necessary.)
When Async is activated, use the following formulas to calculate the speed or render frequency:

BPM = FPS * 60

FPS = BPM / 60

 

Applying Stepped Rendering

Normally, the effects use floating-point frames which is represented by the rational return values of the functions GetFrameId and GetFrameSteps. That way, the effects are able to render very precisely and smooth. However, sometimes it is desired to let the effects "step" pixel by pixel. This option is only available for some effects, for example »SCE Color Scroll and »MAS Script

void SetStep(int value)
int GetStep()
void ToggleStep()
 

Valid values for value are 0 (Off) or 1 (On). If stepped rendering is activated, effects like SCE Color Scroll look hard-stepping. In the MAS Script effect, stepped rendering causes GetFrameId() and GetFrameSteps() to return only integer values.
 

If stepped rendering is deactivated, Frame IDs will be returned as float values.
- For example, SCE Color Scroll will be rendered smoothly.
If stepped rendering is activated, Frame IDs will be returned as integer values.
- For example, SCE Color Scroll will not look as smooth.

 

GetFrameSteps

GetFrameSteps() - Defines the number of steps between Frames / Frame IDs.

Frame Steps * Main Mixer FPS * 60 = BPM

 

Using Frame Count And FrameID

Note: The script of the MAS Script effect itself is able to control the Frame ID and the Frame Count. Setting the Frame ID within both locations, a script and an additional macro, may result in undesired behavior.

 

MADRIX Version: 3.6j | Script Version: 2.22
[Ctrl & +/-] = Zoom In/Out | [Ctrl & 0] = 100%
Print   Previous   Next