audio_listener_get_data

Returns a ds_map with position, velocity and orientation data for the given listener.

Syntax:

audio_listener_get_data(index);


Argument Description
index The listener to get the data for (default 0).


Returns: ds_map


Description

This function will create a ds_map and populate it with the position, velocity and orientation values for the given listener. The default listener index is 0, but you can use the function audio_get_listener_info to get the different indices available for the target platform. If you provide an incorrect listener index then the function will return -1.

NOTE: You are responsible for the destruction of the returned ds_map using the appropriate function.

The ds_map will contain the following keys:

  1. "x" - The x position of the listener
  2. "y" - The y position of the listener
  3. "z" - The z position of the listener
  4. "vx" - The x axis velocity of the listener
  5. "vy" - The y axis velocity of the listener
  6. "vz" - The z axis velocity of the listener
  7. "lookat_x" - The x component of the look at vector of the listener
  8. "lookat_y" - The y component of the look at vector of the listener
  9. "lookat_z" - The z component of the look at vector of the listener
  10. "up_x" - The x component of the up vector of the listener
  11. "up_y" - The y component of the up vector of the listener
  12. "up_z" - The z component of the up vector of the listener




Example:

var num = audio_get_listener_count();
for(var i = 0; i < num; ++i;)
   {
   var info = audio_get_listener_info(i);
   var data = audio_listener_get_data(info[? "index"]);
   if data[? "x"] != 0
      {
      audio_listener_set_position(info[? "index"], 0, 0, 0);
      }
   ds_map_destroy(info);
   ds_map_destroy(data);
   }

The above code checks the number of listeners available then loops through them and if their x position is not 0, it sets their position to 0, 0, 0.


Back: Audio Listeners
Next: audio_listener_set_position
© Copyright YoYo Games Ltd. 2015 All Rights Reserved