audio_emitter_velocity(emitter, vx, vy, vz);
|emitter||The index of the emitter to change.|
|vx||The x vector value (default 0).|
|vy||The y vector value (default 0).|
|vz||The z vector value (default 0).|
This function can be used to give an emitter doppler
effects and simulate audio motion based on the vector that is
resolved from the given relative x, y and z positions (for more
information on vectors, please see Maths - Vectors).
If the emitter itself is not ever going to move you would normally
not need to set these values, but, for example, if you are making a
scrolling shooter game where the enemies come from the right and
scroll to the left, you would set this to have a velocity of
(hspeed, 0, 0) in the create event of the enemies (and update the
emitter of each instance in the step event using audio_emitter_position)
to give any sounds emitted by the enemy instances the correct
doppler as they pass the player instance (which in turn would be
using the function audio_listener_position
to set the listener to the correct position).
s_emit = audio_emitter_create();
audio_emitter_position(s_emit, room_width, 0, 0);
audio_emitter_velocity(s_emit, -5, 0, 0);
The above code creates an audio emitter and assigns its index to the variable "s_emit". This emitter is then placed at a position within the room and given a velocity of 5 pixels per step along the x axis (it will doppler correctly in relation to the listener as if it had a horizontal speed of 5 pixels per step).