Difference between revisions of "Component: Scale (DSP Operators)"
(Created page with "{| style="width:50%" |- | width="20%" style="color:gray;" | Author | Matrix Ltd |- | width="20%" style="color:gray;" | Version | 1.1 |- | width="20%" style="color:gray...") |
|||
Line 20: | Line 20: | ||
==Detailed description== | ==Detailed description== | ||
+ | |||
+ | |||
Line 36: | Line 38: | ||
==Examples== | ==Examples== | ||
+ | |||
+ | |||
Line 72: | Line 76: | ||
LeftShift(4) = Multiply by 16 / RightShift(4) = Divide by 16 | LeftShift(4) = Multiply by 16 / RightShift(4) = Divide by 16 | ||
− | == | + | ==Macro reference== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
Revision as of 14:10, 20 January 2023
Author | Matrix Ltd |
Version | 1.1 |
Category | DSP Operators |
Contents
Scale component
Allows the values in a single buffer to be scaled uniformly. Functions include: Multiply, Divide, LeftShift, RightShift, Float Multiply, Float Divide
Component Source Code
Please click here for the component source code: FC_Comp_Source_DSP_Scale.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Here is an example which demonstrates variable scaling based on an analogue input.
Here are the traces as seen on the data recorder window.
The RightShift macro is a very efficient means of performing a division but only for values which are a power of 2.
The LeftShift macro is a very efficient means of performing a multiplication but only for values which are a power of 2.
LeftShift(1) = Multiply by 2 / RightShift(1) = Divide by 2
LeftShift(2) = Multiply by 4 / RightShift(2) = Divide by 4
LeftShift(3) = Multiply by 8 / RightShift(3) = Divide by 8
LeftShift(4) = Multiply by 16 / RightShift(4) = Divide by 16
Macro reference
![]() |
SetScalerFloat |
Sets the Float scaler to be used when calling the calculate function. | |
![]() |
Scaler |
![]() |
Return |
![]() |
SetScalerInteger |
Sets the Integer scaler to be used when calling the calculate function. | |
![]() |
Scaler |
![]() |
Return |
![]() |
Calculate |
Performs the selected scaling on a value from the input buffer and passes to the output buffer. | |
![]() |
Return |
![]() |
CalculateArray |
Performs the selected scaling on an entire buffer. | |
![]() |
Return |