mozaic_tips_and_tricks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
mozaic_tips_and_tricks [2020/11/17 02:08] – Added Output Fixed Point Values in Labels _kimozaic_tips_and_tricks [2021/04/12 17:35] – Remove/add array entries (part I) _ki
Line 18: Line 18:
   * [[#Use a Knob to toggle 16 Pads View to HELP View]]   * [[#Use a Knob to toggle 16 Pads View to HELP View]]
   * [[#Knob double-tap Support]]   * [[#Knob double-tap Support]]
 +  * [[#Remove or add an entry inside an array]]
   * [[#Using Logic Operators in Expressions instead of IF cases]]   * [[#Using Logic Operators in Expressions instead of IF cases]]
   * [[#Using Inc and Dec in Expressions]]   * [[#Using Inc and Dec in Expressions]]
Line 84: Line 85:
   varB = 124   // allowed range 0 .. ~16000   varB = 124   // allowed range 0 .. ~16000
      
-  combinedValue = valA + valB * maxA +  combinedValue = valA + (valB * maxA
 </code>  </code> 
 +
 +For single-byte MIDI values, use 128 for maxA
  
 To later extract the values from their packed format use To later extract the values from their packed format use
Line 127: Line 130:
 like 42.5000 (if a remainder present) or an integer value without fraction. 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: 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:
 <code> <code>
Line 138: Line 141:
 </code> </code>
  
 +\\ 
 To always output a negative and positive float with a single digit, the split needs to work on the absolute value 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: and a conditional statement is used to output both variants:
Line 144: Line 148:
   f = Div n, 10   f = Div n, 10
   r = (n-f*10) % 10   r = (n-f*10) % 10
-  if number>=0+  if value >=0
     LabelKnob 1, {N: +},f,{.},r     LabelKnob 1, {N: +},f,{.},r
   else   else
-    LabelKnob 1, {N: +},f,{.},r+    LabelKnob 1, {N: },f,{.},r
   endif   endif
 </code> </code>
Line 381: Line 385:
  
  
 +\\ 
 +=====  Remove or add an entry inside an array ===== 
 +<html><p align = "right"><small><i>From -ki</i></small></p></html>
 +Instead of running through an array with a FOR loop to shift entries to either insert or remove an  intermedeate enry, it is way faster to use the CopyArray Mozaic function.
  
 +<code> CopyArray source, dest, size</code>
 \\  \\ 
 =====  Using Logic Operators in Expressions instead of IF cases =====  =====  Using Logic Operators in Expressions instead of IF cases ===== 
  • mozaic_tips_and_tricks.txt
  • Last modified: 2024/04/23 19:07
  • by _ki