<?xml version='1.0' encoding='UTF-8'?> 
<?xml-stylesheet href="./_c74_ref.xsl" type="text/xsl"?> 
<c74object name='live.observer' category='M4L' module='m4l'>
  <digest> Monitor changes in Live objects </digest>
  <description>
    <o>live.observer</o>
    is used to listen to changes in the values of properties of Live
    objects. This object works in conjunction with the 
    <o>live.path</o>
     object, which sends 
    <m>
       id 
      <i>nn</i>
    </m>
     messages into the right inlet of 
    <o>live.observer</o>
     . 
    <br/>
    <br/>
     After an object id and property is specified, its value is sent out the
    left outlet. From this moment on, the value is sent on each change of the
    property ('notification') as well as in response to bang messages. 
    <br/>
    <br/>
     The left outlet is reserved for value messages, all other output is sent to
    the right outlet. 
    <br/>
    <br/>
     Not all properties can be observed, please consult the 
    <link name='live_object_model' module='core' type='vignette'> Live Object Model </link>
     to see which can. Also, it is not possible to modify the live set from a
    notification, i.e. while you are receiving a value message spontaneously
    sent by a 
    <o>live.observer</o>
     's outlet. 
    <br/>
    <br/>
     Besides properties, it is also possible to observer children of Live
    objects. Their values are object ids or lists of them.
    <br/>
    <br/>
	<i>Note: The Live API runs in the main thread in Live, and that all messages to and from the API are automatically deferred.</i>
  </description>
  <!--METADATA-->
  <metadatalist>
    <metadata name='author'> Cycling '74, Ableton </metadata>
    <metadata name='tag'> Live </metadata>
  </metadatalist>
  <inletlist/>
  <outletlist/>
  <!--INLETS-->
  <apiinletlist>
    <inlet name='Left inlet' id='0'>
      <description>
      	 Gets all command messages described below. </description>
    </inlet>
    <inlet name='Right inlet' id='1'>
      <description>      	
        Gets object id message 
        <m>
           id 
          <i>nn</i>
        </m>
         to select the object to operate upon. In response to the id message,
        the current value of the property, if a property was already selected,
        is sent out the left outlet. 
        <br/>
        <m>id 0</m>
         means no object, i.e. all messages to the left inlet are ignored, which
        is also the initial state. 
      </description>
    </inlet>
  </apiinletlist>
  <!--OUTLETS-->
  <apioutletlist>
    <outlet name='Left outlet' id='0'>
      <description>      	
        Sends the current value of the selected property of the selected
        object. The value type depends on the property, as described in the Live
        Object Model, and may be int, float, symbol, 
        <m>
           id 
          <i>nn</i>
        </m>
         or lists of ids. 
      </description>
    </outlet>
    <outlet name='Right outlet' id='1'>
      <description>      	
        Sends responses to 
        <m>getproperty</m>
         , 
        <m>gettype</m>
         , 
        <m>getid</m>
         . 
      </description>
    </outlet>
  </apioutletlist>
  <!--ARGUMENTS-->
  <objarglist>
    <objarg name='property' optional='1' type='symbol'>
      <digest> 
      	Initial Property
      </digest>
      <description>      	
        Specify a property or child name as argument to 
        <o>live.observer</o>
         . 
      </description>
    </objarg>
  </objarglist>
  <!--MESSAGES-->
  <methodlist>
    <method name='property'>
      <arglist>
        <arg name='property' optional='0' type='symbol'/>
      </arglist>
      <digest>
         Arguments: 
        <br/>
        <m>
          <i>property</i>
        </m>
         the name of a property of the current object 
        <br/>
        <br/>
         Operation: 
        <br/>
         Selects the property to be observed. 
      </digest>
      <description>      	
        Arguments: 
        <br/>
        <m>
          <i>property</i>
        </m>
         the name of a property of the current object 
        <br/>
        <br/>
         Operation: 
        <br/>
         Selects the property to be observed. Outputs the current value to the
        left outlet if a proper Live object is selected. 
        <br/>
        <br/>
         Remark: 
        <br/>
         Not all properties can be observed. 
        <br/>
         The types of the properties are given in the Live Object Model. 
        <br/>
        <br/>
        <table>
          <tr>
            <th>Outlet</th>
            <th>Output</th>
            <th>Example</th>
          </tr>
          <tr>
            <td>left</td>
            <td>
              <m>
                <i>value</i>
              </m>
            </td>
            <td>
              <m>3.1415926</m>
            </td>
          </tr>
        </table>
     
    	</description>
    </method>
    <method name='property'>
      <arglist>
        <arg name='child' optional='0' type='symbol'/>
      </arglist>
      <digest>
         Arguments: 
        <br/>
        <m>
          <i>child</i>
        </m>
         the name of a child of the current object 
        <br/>
        <br/>
         Operation: 
        <br/>
         Selects the child id to be observed. Outputs the id (or "id 0") 
      </digest>
      <description>      	
        Arguments: 
        <br/>
        <m>
          <i>child</i>
        </m>
         the name of a child of the current object 
        <br/>
        <br/>
         Operation: 
        <br/>
         Selects the child id to be observed. Outputs the id (or "id 0") to the
        left outlet if the selected Live object has such a child. 
        <br/>
        <br/>
         Remark: 
        <br/>
         Not all children can be observed. 
        <br/>
        <br/>
        <table>
          <tr>
            <th>Outlet</th>
            <th>Output</th>
            <th>Example</th>
          </tr>
          <tr>
            <td>left</td>
            <td>
              <m>
                 id 
                <i>nn</i>
              </m>
            </td>
            <td>
              <m>id 17</m>
            </td>
          </tr>
        </table>
     
    	</description>
    </method>
    <method name='property'>
      <arglist>
        <arg name='list-child' optional='0' type='symbol'/>
      </arglist>
      <digest>
         Arguments: 
        <br/>
        <m>
          <i>child</i>
        </m>
         the name of a child list of the current object 
        <br/>
        <br/>
         Operation: 
        <br/>
         Selects the child list to be observed. Outputs the id list (or nothing)
        
      </digest>
      <description>      	
        Arguments: 
        <br/>
        <m>
          <i>child</i>
        </m>
         the name of a child list of the current object 
        <br/>
        <br/>
         Operation: 
        <br/>
         Selects the child list to be observed. Outputs the id list (or nothing)
        to the left outlet if the selected Live object has such a list child. 
        <br/>
        <br/>
         Remark: 
        <br/>
         Not all child lists can be observed. 
        <br/>
        <br/>
        <table>
          <tr>
            <th>Outlet</th>
            <th>Output</th>
            <th>Example</th>
          </tr>
          <tr>
            <td>left</td>
            <td>
              <m>
                 id 
                <i>nn</i>
                 ... id 
                <i>mm</i>
              </m>
            </td>
            <td>
              <m>id 4 id 5</m>
            </td>
          </tr>
        </table>
     
    	</description>
    </method>
    <method name='getproperty'>
      <digest>
         Operation: 
        <br/>
         Sends the name of the selected property (or child resp. list-child) 
      </digest>
      <description>      	
        Operation: 
        <br/>
         Sends the name of the selected property (or child resp. list-child) out
        the right outlet. 
        <br/>
        <br/>
        <table>
          <tr>
            <th>Outlet</th>
            <th>Output</th>
            <th>Example</th>
          </tr>
          <tr>
            <td>right</td>
            <td>
              <m>
                 property 
                <i>property</i>
              </m>
               or 
              <m>
                <br/>
                 property 
                <i>child</i>
              </m>
            </td>
            <td>
              <m>
                 property name or 
                <br/>
                 property selected_track 
              </m>
            </td>
          </tr>
        </table>
     
    	</description>
    </method>
    <method name='gettype'>
      <digest>
         Operation: 
        <br/>
         Sends the type of currently observed property or child to the right
        outlet. 
      </digest>
      <description>      	
        Operation: 
        <br/>
         Sends the type of currently observed property or child to the right
        outlet. The types of the properties and children are given in the Live
        Object Model. 
        <br/>
        <br/>
         For list-children it just sends 
        <m>type tuple</m>
         , w/o further type information. 
        <table>
          <tr>
            <th>Outlet</th>
            <th>Output</th>
            <th>Example</th>
          </tr>
          <tr>
            <td>right</td>
            <td>
              <m>
                 type 
                <i>property-type</i>
                 or 
                <br/>
                 type 
                <i>object-type</i>
              </m>
            </td>
            <td>
              <m>type int</m>
               or 
              <br/>
              <m>type Track</m>
            </td>
          </tr>
        </table>
     
    	</description>
    </method>
    <method name='getid'>
      <digest>
         Operation: 
        <br/>
         Sends the id of the currently observed Live object to the right outlet.
        
      </digest>
      <description>      	
        Operation: 
        <br/>
         Sends the id of the currently observed Live object to the right outlet.
        
        <br/>
        <br/>
        <table>
          <tr>
            <th>Outlet</th>
            <th>Output</th>
            <th>Example</th>
          </tr>
          <tr>
            <td>right</td>
            <td>
              <m>
                 id 
                <i>nn</i>
              </m>
            </td>
            <td>
              <m>id 20</m>
            </td>
          </tr>
        </table>
     
    	</description>
    </method>
    <method name='bang'>
      <digest>
         Operation: 
        <br/>
         Sends current value of selected property of current object to the left
        outlet. 
      </digest>
      <description>      	
        Operation: 
        <br/>
         Sends current value of selected property of current object to the left
        outlet. Does nothing if no property or no Live object is selected or if
        they don't match. 
        <br/>
        <br/>
        <table>
          <tr>
            <th>Outlet</th>
            <th>Output</th>
            <th>Example</th>
          </tr>
          <tr>
            <td>left</td>
            <td>
              <m>
                <i>value</i>
              </m>
            </td>
            <td>
              <m>Drums</m>
            </td>
          </tr>
        </table>
     
    	</description>
    </method>
    <method name='id nn'>
      <digest>
         Operation: 
        <br/>
         Sets the current object. 
      </digest>
      <description>      	
        Operation: 
        <br/>
         Sets the current object. The message has the same effect if sent to
        both the right or the left inlet. For clarity it is suggested to always
        use the right inlet to supply the object id. 
        <br/>
        <br/>
         - no output - 
     
    	</description>
    </method>
  </methodlist>
  <attributelist/>
  <!--ATTRIBUTES-->
  <!--MISC-->
  <misc name='Inspector'>
    <entry name='Persistence'>
      <description>      	
        The 
        <o>live.observer</o>
         object has a special entry in its inspector labelled "Use Persistent
        Mapping". This setting, when enabled, causes the 
        <m>id</m>
         associated with the object to persist when the Live document is saved
        and restored, and when the Max Device is moved between the Live
        application and the Max editor, or within the Live Set. Beginning in
        Live 8.2.2, Live API ids remain persistent between launches of Live,
        which in conjunction with the 
        <m>Persistence</m>
         feature of 
        <o>live.object</o>
         , 
        <o>live.observer</o>
         and 
        <o>live.remote~</o>
         , makes it possible to create simpler devices which retain their
        association with elements in the Live user interface. 
      </description>
    </entry>
  </misc>
  <!--EXAMPLE-->
  <examplelist>
    <example img='live.observer.png' />
  </examplelist>
  <!--SEEALSO-->
  <seealsolist>
    <seealso name='live_api_overview' module='core' type='vignette' display='Live API Overview'/>
    <seealso name='live_object_model' module='core' type='vignette' display='Live Object Model'/>
    <seealso name='live.path'/>
    <seealso name='live.object'/>
    <seealso name='live.remote~'/>
    <seealso name='live_api' module='core' type='vignette' display='Using the Live API'/>
    <seealso name='jsliveapi' module='js' type='vignette' display='The LiveAPI JavaScript Object (jsliveapi)'/>
  </seealsolist>
</c74object>