Example 2
The next example is the SDF primitive MpyConstFloat, which multiplies its input by a constant and outputs the result.
-
defprimitive
-
{
-
name { MpyConstFloat }
-
-
-
desc
-
{
-
Multiplication of floating input by a floating constant.
-
}
-
-
input
-
{
-
name { Input }
-
type {float}
-
desc {"Floating multiplier."}
-
}
-
-
output
-
{
-
name { Output }
-
type {float}
-
desc {"Floating product."}
-
}
-
-
defparameter
-
{
-
name { Multiplier }
-
type {float}
-
default {"1.0"}
-
desc {"Constant floating multiplier."}
-
}
-
-
location
{ SDF main library
}
-
-
go
-
{
-
Output%0 << double(Multiplier) * double(Input%0);
-
}
-
}
-