Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revisionBoth sides next revision | ||
mozaic_tips_and_tricks [2020/08/13 07:54] – Added Long & Short Pad and Shift deteciotn by wim _ki | mozaic_tips_and_tricks [2020/11/17 02:08] – Added Output Fixed Point Values in Labels _ki | ||
---|---|---|---|
Line 9: | Line 9: | ||
* [[#Store two positive Values into a single Variable]] | * [[#Store two positive Values into a single Variable]] | ||
* [[#Store three unsigned Bytes into a single Variable]] | * [[#Store three unsigned Bytes into a single Variable]] | ||
+ | * [[#Output Fixed Point Values in Labels]] | ||
* [[#Some Best Practice Tips]] | * [[#Some Best Practice Tips]] | ||
* [[#Detect Long or Short Pad Taps]] | * [[#Detect Long or Short Pad Taps]] | ||
Line 119: | Line 120: | ||
</ | </ | ||
+ | |||
+ | \\ | ||
+ | ===== Output Fixed Point Values in Labels ===== | ||
+ | < | ||
+ | When outputting floating point values into labels (knobs, pads, titles) Moazic generates either a 4 digit fraction string | ||
+ | like 42.5000 (if a remainder present) or an integer value without fraction. | ||
+ | |||
+ | |||
+ | To always output a positive float with two digits (even when integer), one needs to split the input value and output the computed integer parts individually: | ||
+ | < | ||
+ | n = Round value * 100 | ||
+ | f = Div n, 100 | ||
+ | d = n-f*100 | ||
+ | r1 = Div d, 10 | ||
+ | r2 = d % 10 | ||
+ | LabelKnob 0, {B: | ||
+ | </ | ||
+ | |||
+ | To always output a negative and positive float with a single digit, the split needs to work on the absolute value | ||
+ | and a conditional statement is used to output both variants: | ||
+ | < | ||
+ | n = Round Abs(value * 10) | ||
+ | f = Div n, 10 | ||
+ | r = (n-f*10) % 10 | ||
+ | if number> | ||
+ | LabelKnob 1, {N: +},f,{.},r | ||
+ | else | ||
+ | LabelKnob 1, {N: +},f,{.},r | ||
+ | endif | ||
+ | </ | ||
\\ | \\ |