Templates Engine

You must activate the god mode in the setup/expert to test or create templates.

Usine includes a powerful Templates Engine. To manipulate and create you own templates you have to understand how work’s the Internal Messages Language (IML).

To have an idea of how it works, start to open the Usine console (Windows/Show Console).

Then open a patch and drag&drop a file.

You will see several lines added in the console, something like

SET_VAR patch SENDER_PATCH = noname
SET_VAR integer MOUSE_X = 150
SET_VAR integer MOUSE_Y = 189
SET_VAR integer CONTROL_PRESSED = 0
SET_VAR integer SHIFT_PRESSED = 0
SET_VAR integer ALT_PRESSED = 0
SET_VAR integer ON_WIRE = 0
SET_VAR integer SRC_TERM_IN_OUT = 0
SET_VAR String DROP_FILENAME = /Applications/Usine Hollyhock Pro MacOSX upd10 1.2.014.app/Usine Library/Audio FX/Delays/Delay.pat
SET_VAR String DROP_FILEEXT = pat
SET_VAR integer SRC_MODULE_ID = -1
SET_VAR String DROP_SHORT_FILENAME = Delay

If you now try to create a wire on the patch, you will see in the console :

SET_VAR integer CONTROL_PRESSED = 0
SET_VAR integer SHIFT_PRESSED = 0
SET_VAR integer ALT_PRESSED = 0
SET_VAR integer MOUSE_X = 233
SET_VAR integer MOUSE_Y = 432
SET_VAR patch SENDER_PATCH = /Applications/Usine Hollyhock Pro MacOSX upd10 1.2.014.app/Usine Library/Audio FX/Delays/Delay.pat
SET_VAR integer SRC_TERM_NUM = 1
SET_VAR integer SRC_MODULE_ID = 9
SET_VAR integer SRC_TERM_IN_OUT = 2
SET_VAR module SRC_MODULE =  
SET_VAR integer ON_WIRE = 0

Those values are interpreted by the template engine to offer several choices to user after a wire creation or what to do with a dropped file.

In the folder Templates you will find lots of examples (files *.txt) that you can easily adapt to you own purpose like

Horizontal Fader   // the name displayed
*     // extension of dropped files ('wav', 'usr', etc...)
1     // input or output? none=0,in=1,out=2
3     // terminal flowtype (see bellow)
1 5 6 // terminal display flowtype (see bellow)
*     // terminal name can be '*' or "any string"
1     // are dropping something on a wire? 0=no, 1=yes
xxx   // source module ID filter.  -1 or blank if no filter 

SET_TARGET_PATCH SENDER_PATCH  
CREATE_MODULE fader1 3 MOUSE_X MOUSE_Y
CREATE_LINK fader1 fader SRC_MODULE SRC_TERM_NAME
SET_VALUE fader1 fader SRC_VALUE
SET_VALUE fader1 min SRC_MIN
SET_VALUE fader1 max SRC_MAX
SET_STRING_VALUE fader1 symbol SRC_SYMBOL
SET_STRING_VALUE fader1 caption SRC_TERM_NAME
SET_VALUE fader1 prec  SRC_PRECISION_INDEX
SET_VALUE fader1 scale SRC_SCALE
RENAME_MODULE fader1

Flow Type

The terminal flowtype can have the following values:

  • None=0,
  • Audio=1,
  • InternText=2,
  • Data=3,
  • MIDI=4,
  • Array=5,
  • User=6,
  • EvtText=7,
  • PointerBitMap=8,
  • Byte=9,
  • Matrix=10,
  • Pointer=11,
  • Color=12

Display FlowType

The terminal display flowtype can have the following values:

  • Text=0,
  • gain fader=1,
  • select Dir=2,
  • switch=3,
  • Button=4,
  • Data Integer=5,
  • Data Float=6,
  • Color=7,
  • ListBox=8,
  • Array=8,
  • IpAddress=9,
  • Smpte position=10,
  • FileName=11,
  • MidiNote=12,
  • Hexadecimal=13,
  • Trigger=14

Example

In the Templates folder, you will find default patch files used in Usine. You can modify, adapt those files to your needs.