Recherche Google
OpenMusic 6 – User ManualAdvanced Visual Programming > Instance Objects > Global Variables
previous pagenext page

Global Variables

Global variables are "globalized" types of instances. They are associated with the workspace where they have been created.

General Properties

Instances and Global Variables

When defining a chord, a metric sequence, manipulating an audio file, the user creates a specific instance1 from a class2.

  • This instance can be materialized in the current patch editor by instance boxes   . Instance boxes are grey.
  • It can also be exported as a global variable to a workspace where it will be stored in the Globals package . Global variable boxes are green. of the Library.

Using a Global Variable

Reference of a Global Variable

Every time a global variable is used in a patch, it is represented by a reference.

  • When evaluated, the box always returns the same reference
  • A single global variable can have several references in several different places.
Modifications : Effects

Any modification of a global variable will affect all of its representations as well as the master item.

  • Modifying a global variable affects each of its references.
  • Modifying one of its references equally affects the variable itself and all its references
Connections to Other Boxes

A global variable box can be connected to other boxes, just as an instance box.

Creating a Global Variable From an Instance

To create a global variable, an instance box must be dropped in the Globals package of the Library.

Adding a Global Variable in the Library

Open the Globals package in the Library window :

  • double click on its lower part to open it as a side frame,
  • double click on its upper part,
  • Ctrl / right click and choose Open in the contextual menu to open it as a window.

Select an instance and drop it in the Globals package window. The instance box in the patch is converted into a global variable box automatically.

Naming a Global Variable

The variable can be renamed in the Globals window : all related elements in the patch will be affected by this change immediately : they will have the same name and reference.

Creating Global Variables with Store Objects
Global Variables can also created from store objects.

Modifying a Global Variable

Modifying a Global Variable from its Editor.

A global variable can also be modified via their editor, like any instance box.

About instances Editors
  1. Instance

    An actual object created at runtime, out of a given class. In OM, more specifically, an object created when evaluating a factory box. An instance can be saved as a global variable.

    SHIFT click on an outlet – especially the first outlet representing the self, the whole object – of a factory box to materialize an instance.

  2. Class

    A category of objects sharing common properties – characteristics and behaviour. A class specifies the internal structure and behaviour of an object. In OM, it is represented in a patch by a factory box that can produce an instance of a class.

    See also : Object, Instance

previous pagenext page
About...(c) Ircam - Centre PompidouMade with Scenari