A SERVICE OF

logo

86
Chapter 7: Traversing the Scene Graph
Playing Sound Files
csSoundAction plays sound les. The csSound node indirectly speciesthrough
csAudioClip and csAudioSamples nodesthe sound le to play. The csSoundAction
places the listener (referred to as the microphone in Cosmo 3D) relative to the sound
source for spatial effects, such as volume based on the proximity of the listener to the
sound source.
void setMicrophone(Microphone mic);
Microphone getMicrophone();
When the csSoundAction traverses a scene graph, it creates a list of active sounds in the
scene graph and supplies that information to csContext internally. If any sounds are
active, csContext sends instructions to play the associated sound les for a specic
duration.
For more information about sounds, see Chapter 15, Adding Sounds To Virtual
Worlds.
The Order In Which Actions Are Passed Between Nodes
In a scene graph, group nodes are acted upon in a top-to-bottom sequence. Leaf nodes
under any one group node are acted upon in an unspecied order. While not every child
node may be visited, for example, under a csSwitch node, it is guaranteed that all parent
nodes are visited before their children nodes.
Top-Down Traversals
In diagrams of scene graphs, this order of node evaluation, called an in-order traversal,
is represented by the layout of the nodes so that actions traverse from the top to bottom
of the scene graph. For example, the numbers in Figure 7-1 show one order in which an
action might traverse the nodes in a scene graph.