Using BPM Control

   Print  Previous  Next

Functions Provided For Setting The Speed

The following table provides an overview of all functions to modify the speed:

Function

Description

void SetBpm(float value)

Sets the BPM value, which is the speed of the effect. Valid values for value range from 0 to 9999. Setting BPM to 0 means that the effect will be stopped immediately.

float GetBpm()

Returns the current BPM.

void SetSpeedPitch(float value)

Sets the Pitch value, which defines an additional multiplicative factor for the speed of the effect. Valid values for value range from -10 to 10. Setting the BPM pitch lower than 0 lets most effects run backwards.

float GetSpeedPitch()

Returns the current Pitch.

 

Remarks

Each effect which uses the BPM Control will interpret the speed in its own way.
- For example, 60 BPM in the »SCE Color Change effect will change the color 60 times per minute (once per second).
- 60 BPM in the »SCE Pulse / Stroboscope effect will flash the matrix 60 times per minute, too.
- For the »SCE Shapes and the »SCE Tubes effect, a BPM value of 60 means that 60 shapes/tubes will be created every minute by default.

However, other effects apply the range of BPM values differently. Just try the BPM slider to get a feeling for how the effects interpret the speed.
- For example, 3000 BPM in the »M2L Drops effect cause each drop to move over the whole matrix in one second.
- 3000 BPM in the »SCE Graph effect mean that the function will oscillate once per second.

Please note that both the BPM and the BPM pitch are floating-point values. Thus, you can create very slow effects, if you use values between 0 and 1.

 

Deprecated Functions

Deprecated functions are outdated functions and should not be used anymore.

Function/Constant

Description

void SetBpmPitch(float value)

Use SetSpeedPitch() instead.

float GetBpmPitch()

Use GetSpeedPitch() instead.

 

Example

This sample macro causes the BPM slider to stick to multiples of 60 BPM. It works with the »SCE Color Change effect, for example.

@scriptname="";

@author="";

@version="";

@description="";

 

const float step = 60.0; // use multiples of 60 BPM

float internalBpm = 0.0;

float previousBpm = 0.0;

 

void InitEffect()

{

 internalBpm = GetBpm();

 previousBpm = internalBpm;

}

 

void PreRenderEffect()

{

 internalBpm += (GetBpm() - previousBpm);

//        WriteText("internalBpm: " + (string)internalBpm);

 

 int times = (int)round(internalBpm / step);

 SetBpm((float)times * step);

 

 previousBpm = GetBpm();

}

 

void PostRenderEffect()

{

 

}

 

void MatrixSizeChanged()

{

 InitEffect();

}

 

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