|
This function will attach in run-time an entity handle to the sound, thus changing the location
of the sound and accordingly the volume and balance.
If the sound is playing already, the change will take effect only after stopping and replaying the sound.
entity_handle can be a handle to one of the three: polygon handle, object handle or group handle.
if entity handle is NULL then the engine actually performs Detach meaning that the sound is treated
as a background sound that is not attached to any entity.
Important: Make sure that if the sound is attached to an entity and the entity is deleted then
this could cause a fatal error. Make sure to stop a sound or dettach it before deleteing
the object it is associated with.
Example:
DWORD sound_handle=STATE_sound_load("my_song",chair);
when playing this sound, it will be heard as coming from the chair.
STATE_sound_attach(sound_handle,table);
now, when playing the sound, it will be heard as coming from the table.
STATE_sound_attach(sound_handle,NULL);
now, the sound is a background sound.
|