audio_listener_get_data

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:

 

Syntax:

audio_listener_get_data(index);

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

 

Returns:

ds_map

 

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.