Subversion Repositories svn.mios

Rev

Rev 1186 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1186 Rev 1200
Line 7... Line 7...
7
7
8
<P CLASS=INFO>MIDIbox NG provides a (primitive) script language which allows to change values of control elements, to send free definable MIDI events, to output special text strings on LCD and to send debug messages to the MIOS Terminal. It even supports (limited) flowcontrol with if/elsif/else statements.</P>
8
<P CLASS=INFO>MIDIbox NG provides a (primitive) script language which allows to change values of control elements, to send free definable MIDI events, to output special text strings on LCD and to send debug messages to the MIOS Terminal. It even supports (limited) flowcontrol with if/elsif/else statements.</P>
9
9
10
<P CLASS=DESC>The idea for this script feature came up with the request to run a sequence of value changes (with delays in between) during power-on, resp. after a <A HREF="midibox_ng_manual_ngc.html">.NGC file</A> has been loaded. Over the time it has been enhanced by additional commands to cover other usecases, and meanwhile we even have some kind of flow control!</P>
10
<P CLASS=DESC>The idea for this script feature came up with the request to run a sequence of value changes (with delays in between) during power-on, resp. after a <A HREF="midibox_ng_manual_ngc.html">.NGC file</A> has been loaded. Over the time it has been enhanced by additional commands to cover other usecases, and meanwhile we even have some kind of flow control!</P>
11
11
12
<P CLASS=DESC>However, the capabilities are still very limited, mainly caused by RAM size limitations of the <A HREF="mbhp_core_lpc17.html">MBHP_CORE_LPC17</A>. See also the "Limitations" chapter at the end of this page.<BR>
-
 
13
E.g. the script has to be directly parsed from SD Card whenever it is called, which means that the execution consumes some time (typically 5..50 mS). Call requests are not queued, therefore it can happen that requests get lost if they are triggered while the .NGR file is already processed.</P>
-
 
14
-
 
15
<P CLASS=DESC>Therefore this script language is <B>no replacement</B> for EVENT definitions defined in the <A HREF="midibox_ng_manual_ngc.html">.NGC file</A>! If MIDIbox NG should react on concurrent actions in realtime without the danger that an action gets lost, please define them as EVENTs!<BR>
12
<P CLASS=DESC>On a <A HREF="mbhp_core_stm32f4.html">MBHP_CORE_STM32F4</A>, the .NGR script will loaded from SD Card and then compiled into RAM to allow realtime execution of the commands within less than 1 mS! :-)<BR>
16
But it's viable solution for events which are processed very rarely, such as special button functions.
13
The <A HREF="mbhp_core_lpc17.html">MBHP_CORE_LPC17</A> module only allows direct execution from SD Card, which is much slower and therefore only allows sporadic interactive operations like special button functions (typically it will take 5..50 mS on this core!).</P>
17
14
18
<P CLASS=DESC>The .NGR file has the same name like the .NGC file. After power-on MIDIbox NG will load DEFAULT.NGC, and therefore also DEFAULT.NGR (if available).</P>
15
<P CLASS=DESC>The .NGR file has the same name like the .NGC file. After power-on MIDIbox NG will load DEFAULT.NGC, and therefore also DEFAULT.NGR (if available).</P>
19
16
20
17
21
<H2> <IMG SRC="images/bullet.gif" ALT=""> Usecases </H2>
18
<H2> <IMG SRC="images/bullet.gif" ALT=""> Usecases </H2>
Line 28... Line 25...
28
      E.g. to debug your .NGC setup (or the .NGR execution flow).
25
      E.g. to debug your .NGC setup (or the .NGR execution flow).
29
  <LI>set a control element value depending on conditions, which are derived from other control elements.<BR>
26
  <LI>set a control element value depending on conditions, which are derived from other control elements.<BR>
30
      E.g. to implement complex selections (if BUTTON:1 and BUTTON:2 is pressed the same time, do something special...)
27
      E.g. to implement complex selections (if BUTTON:1 and BUTTON:2 is pressed the same time, do something special...)
31
  <LI>send a fully customizable MIDI messages, even multiple ones triggered by the same event.<BR>
28
  <LI>send a fully customizable MIDI messages, even multiple ones triggered by the same event.<BR>
32
      E.g. to select different patches on synthesizers which are connected to different MIDI ports and listen to different MIDI channels.
29
      E.g. to select different patches on synthesizers which are connected to different MIDI ports and listen to different MIDI channels.
-
 
30
  <LI><B>MBHP_CORE_STM32F4 only (direct execution from RAM):</B> advanced event processing in realtime
33
</UL>
31
</UL>
34
32
35
<P CLASS=DESC>If you know other interesting usecases which are not listed here, please let me know! :-)
33
<P CLASS=DESC>If you know other interesting usecases which are not listed here, please let me know! :-)
36
34
37
35
Line 148... Line 146...
148
    <TD CLASS=TABCOLOR2>Executes a meta event with an optional value.<BR>
146
    <TD CLASS=TABCOLOR2>Executes a meta event with an optional value.<BR>
149
      A list of available meta events can be found in the <A HREF="midibox_ng_manual_ngc.html">.NGC chapter</A>.
147
      A list of available meta events can be found in the <A HREF="midibox_ng_manual_ngc.html">.NGC chapter</A>.
150
Examples:
148
Examples:
151
<TT><PRE style="margin-left:10px; font-size:8pt">
149
<TT><PRE style="margin-left:10px; font-size:8pt">
152
if ^section == 0
150
if ^section == 0
-
 
151
  # wait until all values have been scanned (consider 2 seconds startup delay + a little bit margin)
-
 
152
  delay_ms 2500
-
 
153
  
-
 
154
  # now capture the AINSER values
153
  exec_meta RetrieveAinserValues
155
  exec_meta RetrieveAinserValues
-
 
156
-
 
157
  # and dump out values
154
  exec_meta DumpSnapshot
158
  exec_meta DumpSnapshot
155
endif
159
endif
156
</PRE></TT>
160
</PRE></TT>
157
161
158
or
162
or
Line 255... Line 259...
255
set LED:1004 127
259
set LED:1004 127
256
set LED:1005 127
260
set LED:1005 127
257
set LED:1006 127
261
set LED:1006 127
258
set LED:1007 127
262
set LED:1007 127
259
set LED:1008 127
263
set LED:1008 127
-
 
264
</PRE></TT>
-
 
265
    </TD>
-
 
266
  </TR>
-
 
267
-
 
268
  <TR>
-
 
269
    <TD CLASS=TABCOLOR2><I>SET_HSV &lt;id&gt; &lt;h&gt;:&lt;s&gt;&lt;v&gt;</I></TD>
-
 
270
    <TD CLASS=TABCOLOR2>Sets the hue/saturation/value colour code of a WS2812 based RGBLED. H ranges from 0..359 (grad); saturation and value (brightness) range from 0..100 (percentage)<BR>
-
 
271
Example:
-
 
272
<TT><PRE style="margin-left:10px; font-size:8pt">
-
 
273
# red
-
 
274
set_hsv RGBLED:1 0:100:25
-
 
275
-
 
276
# green
-
 
277
set_hsv RGBLED:2 120:100:25
-
 
278
-
 
279
# blue
-
 
280
set_hsv RGBLED:3 240:100:25
260
</PRE></TT>
281
</PRE></TT>
261
    </TD>
282
    </TD>
262
  </TR>
283
  </TR>
263
284
264
  <TR>
285
  <TR>
Line 321... Line 342...
321
342
322
set LED:3 127
343
set LED:3 127
323
delay_ms 100
344
delay_ms 100
324
set LED:3 0
345
set LED:3 0
325
</PRE></TT>
346
</PRE></TT>
-
 
347
    </TD>
-
 
348
  </TR>
-
 
349
-
 
350
  <TR>
-
 
351
    <TD CLASS=TABCOLOR2><I>LOAD &lt;setup&gt;</I></TD>
-
 
352
    <TD CLASS=TABCOLOR2>Switch to another setup (.NGC, .NGS, .NGR, ... files)
326
    </TD>
353
    </TD>
327
  </TR>
354
  </TR>
328
355
329
  <TR>
356
  <TR>
330
    <TD CLASS=TABCOLOR2><I>IF</I><BR><I>ELSIF</I><BR><I>ELSE</I><BR><I>ENDIF</I></TD>
357
    <TD CLASS=TABCOLOR2><I>IF</I><BR><I>ELSIF</I><BR><I>ELSE</I><BR><I>ENDIF</I></TD>
Line 555... Line 582...
555
<H2> <IMG SRC="images/bullet.gif" ALT=""> Limitations </H2>
582
<H2> <IMG SRC="images/bullet.gif" ALT=""> Limitations </H2>
556
583
557
<P CLASS=DESC>The capabilities are still limited, mainly caused by RAM size limitations of the <A HREF="mbhp_core_lpc17.html">MBHP_CORE_LPC17</A>. Following limitations have to be considered:
584
<P CLASS=DESC>The capabilities are still limited, mainly caused by RAM size limitations of the <A HREF="mbhp_core_lpc17.html">MBHP_CORE_LPC17</A>. Following limitations have to be considered:
558
<UL CLASS=CL>
585
<UL CLASS=CL>
559
  <LI>please don't expect a script language which is so powerful like for example <A HREF="http://www.eluaproject.net" TARGET="_blank">eLua</A>! Although it would be possible to run eLua on a LPC1769, the available RAM isn't sufficient to satisfy the needs for MIDIbox NG in parallel!
586
  <LI>please don't expect a script language which is so powerful like for example <A HREF="http://www.eluaproject.net" TARGET="_blank">eLua</A>! Although it would be possible to run eLua on a LPC1769, the available RAM isn't sufficient to satisfy the needs for MIDIbox NG in parallel!
560
  <LI>the script has to be directly parsed from SD Card whenever it is called, which means that the execution consumes some time (typically 5..50 mS). Call requests are not queued, therefore it can happen that requests get lost if they are triggered while the .NGR file is already processed.
-
 
561
  <LI>It's currently not possible to declare and set customized variables. Limited capabilities could be available in future, but they will consume some RAM!
587
  <LI>It's currently not possible to declare and set customized variables. Limited capabilities could be available in future, but they will consume some RAM!
562
-
 
563
  <LI>It's not possible to combine conditions in an IF statement (e.g. with && or ||) because this would blow up the parser too much. If this is desired, use nested IF statements on an AND condition, or multiple IF statements on an OR condition.
588
  <LI>It's not possible to combine conditions in an IF statement (e.g. with && or ||) because this would blow up the parser too much. If this is desired, use nested IF statements on an AND condition, or multiple IF statements on an OR condition.
564
</UL>
589
</UL>
565
590
566
FOOTER
591
FOOTER