Playing Sound in Immediate Mode
177
Playing Sound in Immediate Mode
When a csSoundAction is invoked on a scene graph, the action traverses the scene graph
and gathers a list of active csSound nodes. The action notifies csContext internally of this
list of nodes. When the context is applied to the rendering pipeline, the sounds specified
in the associated csAudioSamples nodes are played.
You can also play a sound file immediately. Instead of using a csSoundAction to trigger
the playing of the sound file, you use a csSoundPlayer node.
All of the code used to play sounds, either using csSoundAction or csSoundPlayer, is
encapsulated in csSoundPlayer. Consequently, all of the field settings discussed
previously in this chapter also need to be specified in csSoundPlayer.
csSoundPlayer Methods
csSoundPlayer methods provide sophisticated control over the sound source and the
“microphone” recording the sound. Some of those controls include:
• Position of the sound source and microphone.
• Motion of the sound source and microphone; helpful in simulating a Doppler shift.
• Scaling of the sound source intensity and frequency.
• Number of recording channels.