audio_get_listener_info

Returns a ds_map with information about the listener.

Syntax:

audio_get_listener_info(num);


Argument Description
num The listener number to get the data for.


Returns: ds_map


Description

This function will create a ds_map and populate it with information for the given listener.

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. "name" - The name of the listener, as a string, with "default" being the standard listener name on most target platforms
  2. "mask" - The bit-mask for the listener
  3. "index" - The unique index value of the listener

The mask value can be used to set a sound or emitter to play from multiple listeners at once, simply using the bitwise or "|" to generate a mask for the sound (see the example code below), while the index is used to set the properties like position or velocity for a given listener using functions like audio_listener_set_position().




Example:

var num = audio_get_listener_count();
var mask = 0; for(var i = 0; i < num; ++i;)
   {
   var info = audio_get_listener_info(i);
   var m = audio_listener_get_data(info[? "mask"]);
   mask = mask | m;
   ds_map_destroy(info);
   }
audio_set_listener_mask(mask);

The above code checks the number of listeners available then loops through them gets their mask bits, which are then combined to create a single bit mask which is applied to the global listener.


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