Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
mozaic_tips_and_tricks [2021/04/12 17:43] – [Remove or add an entry inside an array] _ki | mozaic_tips_and_tricks [2021/07/01 21:41] (current) – Added „ About State-Saving“ section _ki | ||
---|---|---|---|
Line 4: | Line 4: | ||
This wiki page contains programming tips & tricks for [[mozaic_plugin_engine|Mozaic]] | This wiki page contains programming tips & tricks for [[mozaic_plugin_engine|Mozaic]] | ||
+ | * [[#NoteOn Velocity 0 Special Case]] | ||
* [[#Two dimensional Arrays]] | * [[#Two dimensional Arrays]] | ||
* [[#Multi dimensional Arrays]] | * [[#Multi dimensional Arrays]] | ||
Line 11: | Line 11: | ||
* [[#Output Fixed Point Values in Labels]] | * [[#Output Fixed Point Values in Labels]] | ||
* [[#Some Best Practice Tips]] | * [[#Some Best Practice Tips]] | ||
+ | * [[#About State-Saving]] | ||
* [[#Detect Long or Short Pad Taps]] | * [[#Detect Long or Short Pad Taps]] | ||
* [[#Detect Long or Short SHIFT Button Taps]] | * [[#Detect Long or Short SHIFT Button Taps]] | ||
Line 23: | Line 24: | ||
* [[# | * [[# | ||
* [[#Include Snippets]] | * [[#Include Snippets]] | ||
+ | |||
+ | ===== NoteOn Velocity 0 Special Case===== | ||
+ | < | ||
+ | The Midi Spec allows to use a NoteOn command with velocity zero instead of a NoteOff command. If this combination is received by Mozaic, this midi command is automatically converted to
NoteOff vel 0 - even for the @OnMidiInput event and when checking MidiByte1. | ||
+ | |||
+ | Therefore scripts don‘t need to check for this ‚NoteOn Vel 0‘ case, as that special case is handled by Mozaic. Even when using MidiThrough, | ||
+ | |||
===== Two dimensional Arrays ===== | ===== Two dimensional Arrays ===== | ||
Line 181: | Line 189: | ||
@End | @End | ||
</ | </ | ||
+ | |||
+ | \\ | ||
+ | ===== About State-Saving ===== | ||
+ | < | ||
+ | All assigned variables of a script are automatically included in a saved preset and restored when reloading. To not overwrite them, use the | ||
+ | < | ||
+ | if Unassigned channel | ||
+ | channel = 10 | ||
+ | bank = 1 | ||
+ | .... | ||
+ | endif | ||
+ | </ | ||
+ | construct in the scripts **OnLoad** that only set the default value if a script is freshly run using ‚Upload‘. If reloaded (and therefor some value is already assigned to ‚channel‘ ) the initialization block is skipped. | ||
+ | |||
+ | |||
+ | Mozaic stores some more more information in the presets/ | ||
+ | * Layout | ||
+ | * Pad labels, color, latch-state | ||
+ | * Knob labels and position | ||
+ | * XY position | ||
+ | * Title label above pads, knobs, XY | ||
+ | * Rootnote and scale | ||
+ | |||
+ | Things **not** restored during session reload: | ||
+ | * ShortName | ||
+ | * Timer state and settings | ||
+ | * LFO settings | ||