Skip to content

Instantly share code, notes, and snippets.

Last active Aug 14, 2018
What would you like to do?
GML Script. This sets up all listeners available on a target platform. In the case of PS4, you can use this to play audio on a DS4 speaker. Run before running anything using audio_play_sound_on();. In addition, this fixes GMS games being too quiet or low volume on consoles. Best run in a Create event.
var lc = audio_get_listener_count();
var masks;
masks[0] = 0;
masks[1] = 0;
masks[2] = 0;
masks[3] = 0;
alert("Number of Audio Listeners: " + string(lc),0)
for (var i = 0; i < lc; i++)
var inf = audio_get_listener_info(i);
if (string_pos("controller", inf[? "name"]) == 1
and string_pos("speaker", inf[? "name"]) > 0)
var pad_index = real(string_ord_at(inf[? "name"], 11) - ord('1'));
masks[pad_index] = inf[? "mask"];
for (var i = 0; i < 4; i++)
emit[i] = audio_emitter_create()
audio_emitter_set_listener_mask(emit[i], masks[i])
///When gamemaker exports to console, it's really quiet!
///The way to fix this is here, with audio_master_gain();
///The docs say that it goes from 0 to 1, when in fact, it goes beyond 1! wow!!
if os_type == os_ps4 || os_type == os_xboxone || os_type == os_psvita
Copy link

PoppyWorks commented Jul 24, 2018

Recently discovered that audio_master_gain(); fixes the issue of games being too quiet on consoles, so this was added to the bottom of our script!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment