Synchronization between components is in charge of the static sync node, automatically embedded in each object. Its address is /ITL/.../object/sync and it supports messages to add or remove a master / slave relation between components or to query the synchronizations state.
Note: A master can naturally have several slaves, but a slave can have several masters as well. In this case, it will be drawn several times, corresponding to each master's space.
-  the slave master form is followed by an optional synchronization mode (see below). It adds a slave / master relation between the first and the second component.
-  the slave master del form removes the specified slave/master relation.
-  the slave form without master removes all synchronizations with the slave.
-  the get message is intended to query the synchronization state. The optional parameter is the identifier of a component. The get message without parameter is equivalent to a get message addressed to each object declared in the sync node.
Synchronization identifiers indicates 1) the name of an object or 2) the name of an object associated to a mapping name. Using the first form (i.e. without explicit mapping name), the system uses the default unnamed mapping (see section mapMsg mappings and named mappings).
Synchronization between components has no effect if any of the required mapping is missing (see table maptable).
Example Synchronizing an object on several masters:
/ITL/scene/myParent/sync mySlave myMaster1; /ITL/scene/myParent/sync mySlave myMaster2;
Synchronizing two objects using a specific mapping (the second object is assumed to be a symbolic score (gmn, gmnstream or gmnf) which system mapping has been previously requested):
/ITL/scene/myParent/sync mySlave myMaster:system;
Synchronizing a slave component A to a master component B has the following effect:
- A position (x) is modified to match the B time position corresponding to A date.
- depending on the optional syncStretch option, A width and/or height is modified to match the corresponding B dimension (see below).
- depending on the optional syncPos option, A vertical position (y) is modified. Note that the y position remains free and could always be modified using a dy message.
- if A date has no graphic correspondence in B mapping (the date is not mapped, or out of B mapping bounds ), A won't be visible.
Using the master date
The synchronization mode makes use of the master time to graphic mapping to compute the slave position. It may also use the master current date, depending on the following options:
- relative: the time position where the slave appears is relative to the mapping and to the master current date (actually, it shifts the mapping from the master current date). The relative mode is used by default.
- absolute: the time position where the slave appears corresponds to the mapping date only.
Note: Use of the absolute mode may take sense with nested synchronizations: let's consider an object A, slave of B, which is slave of C. In relative mode and if A and B receive the same clock messages, A will remain at a fixed position on B although it is moving in time.
Example Describing nested synchronizations, the first one using the absolute mode:
/ITL/scene/sync slave masterSlave absolute ; /ITL/scene/sync masterSlave master ;
Synchronizing an object duration
The synchronization stretch mode has the following effect on the slave dimensions:
- h: the slave is horizontally stretched to align its begin and end dates to the corresponding master locations.
- v: the slave is vertically stretched to the master map vertical dimension.
- hv: combines the above parameters.
By default, no stretching is applied.
Example Synchronizing two objects, aligning the slave duration to the corresponding master space and stretching the slave to the master map vertical dimension:
/ITL/scene/sync mySlave myMaster hv ;
Controlling the slave position
The synchronization position mode has the following effects on the slave y position:
- syncOver: the center of the slave is aligned to the master center.
- syncTop: the bottom of the slave is aligned to the top of the master.
- syncBottom: the top of the slave is aligned to the bottom of the master.
- syncFrame: used to browse the master frame (see the next section).
The default position mode is syncOver. The y attribute of the slave remains available to displacement (dy).
Note: The y position of a synchronized object remains a free attribute. To control this position, you should send dy messages.
Example Synchronizing two objects, aligning the slave duration to the corresponding master space, the slave being below the master map:
/ITL/scene/sync mySlave myMaster h syncBottom;
The syncFrame mode
When the syncFrame mode is used, the slave is placed on the frame of the master. Typically, this frame corresponds to the object bounding box that is also the object default mapping. For ellipses, arcs, lines, polygons, the frame corresponds to the border of the object. The frame duration is the object duration.
Mappings and stretch options are ignored in syncFrame mode.