Define is not a statement per se, since no code gets generated by it. It is often called a compiler directive. It can be likened to straight text substitution that a word processor uses. The form is this

define name text – that – replaces – name      //comments may follow and are ignored

Examples:

define hi 89%
define lo 11.5%

             chn1 = hi
@+190ms      chn1 = lo
@+190ms      chn2 = hi
@+190ms      chn2 = lo
@+190ms

The advantage is the hi brightness can be easily read and adjusted in one place, instead of many.

Here we bit off more:

define eqhi = 89%
define eqlo = 11.5%

        chn1 eqhi
@+190ms chn1 eqlo
@+190ms chn2 eqhi
@+190ms chn2 eqlo
@+190ms

Works the same but perhaps less readable.  We can always solve that by biting off more:

define set1Hi chn1 = 89%
define set1Lo chn1 = 11.5%
define set2Hi chn2 = 89%
define set2Lo chn2 = 11.5%

        set1Hi
@+190ms set1Lo
@+190ms set2Hi
@+190ms set2Lo
@+190ms

And biting off more:

define set1HiFor190        chn1 = 89%
define set1LoFor190 @+190ms chn1 = 11.5%  @+190ms
define set2HiFor190        chn2 = 89% 
define set2LoFor190 @+190ms chn2 = 11.5%  @+190ms

       set1HiFor190
       set1LoFor190
       set2HiFor190
       set2LoFor190

This one was interesting, we tacked another time stamp on the end to match the original code. In fact, all statement types are allowed on the same line. A line can be any length.

Let’s try a multi statement define:

define set1and2  chn1=89%  @+190ms  chn1=11.5%  @+190ms  chn2=89%  @+190ms  chn2=11.5%  @+190ms

       set1and2

This definition was hard to read but a breeze to use. It’s best to debug the multi statement version before collapsing it. Multi statement defines are particularly useful if we want to repeat an effect many times:

      //repeat 5 times
               set1and2
               set1and2
               set1and2
               set1and2
               set1and2

Notice we cannot go inside the name and see what the underlying code is. We have to refer back to the define.

Collapsing multiple statements into a single define has a couple of restrictions that multi line statements do not:

  • Absolute times stamps usually don’t work
    • use relative time stamps as we did
  • No comments are allowed until after the last statement
    • Comments extend to the end of the line
  • No labels are allowed if it will be used multiple times
    • Causes duplicate label errors
    • Don’t define. Copy and paste all lines, then manually change the labels and Go label statements

Other Restrictions

  • Nested defines are not allowed
//nested define (not allowed)
define Hi 89%
define Hi1 chn1 = Hi  //"Hi", a define, can't be used in another define
  • Redefinitions do not work
//redefinition (doesn't work)
define Hi 89%         //definition
   chn1 = Hi
define Hi 69%         //redefinition (no error message but doesn't work)
   chn1 = Hi          //still at 89%
  • Typos are not always caught
define set1and2  chn1=89%  @+30ms  chn1=11.5%  @+30ms  chn2=89%  @+30ms  chn2=11.5%  @+30ms 

//repeat 5 times? Won't happen.
       set1an2        //typo! Interpreted as a valid label. Won't cause an error.
       set1and2
       set1an2        //same typo! Ah, now we have a duplicate label error
       set1and        //typo! Another valid label. Won't cause an error. 
       set1and2

Defines are constant. They stay the same always. We can only change them while editing.

We compared it to a word processor’s find and replace. One difference is we cannot define part of a name in this version of Sequence Composer. Only entire words and numbers can be changed.

Limits:
The name defined can be any length.

The size of a line of defined statements can be any length.

 

Defines are extremely convenient in making statements look “high level”, more conversational, and which can easily be edited when changes are needed. They are especially valuable as sequences get longer. We love ’em.

 

Back to Menu

 

Scroll down