audio_group_set_gain error

Fredrik

Member
Hey!
I'm trying to set the gain for the default audio group by using

audio_group_set_gain(audiogroup_default, 0, 5000);

However when I start the game I get an error code, saying that the variable is not set :C
 
I've just tried that exact code and it works fine. Can you post the actual error message? You haven't changed the name of the default audio group have you (through Tools>Audio Groups)?
 

Fredrik

Member
I've just tried that exact code and it works fine. Can you post the actual error message? You haven't changed the name of the default audio group have you (through Tools>Audio Groups)?
I'm making end credits in a project, and before the credits roll all volume will fade out, which I've done with audio_master_gain, but I wanted to switch it to audio_group_set_gain, so I could turn down the volume only on the default group, and then keep the volume for another group that has the credits theme (and a few other themes). but I get an error.

So when the game is set to end, I have a variable "global.endgame = 1;"
So if that one is set to 1, it will start to fade the audio group out like audio_group_set_gain(audiogroup_default,0,5000);

So when the game ends and the varaible is set to 1, I get this error:

############################################################################################
FATAL ERROR in
action number 5
of Step Event0
for object quit:

Variable quit.audiogroup_default(100922, -2147483648) not set before reading it.
at gml_Object_quit_StepNormalEvent_5 (line 12) - audio_group_set_gain(audiogroup_default,0,5000);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_quit_StepNormalEvent_5 (line 12)


Maybe it has to be set in game start / create event? as the gain here is set in a step event.
 
Last edited:

curato

Member
if you are using that global as a flag to call game_end make sure you are changing the audio_group before you execute game end it may be getting caught in the game ending clean up and giving an error.
 

Fredrik

Member
if you are using that global as a flag to call game_end make sure you are changing the audio_group before you execute game end it may be getting caught in the game ending clean up and giving an error.
The global variable is starting a custom eng game credits screen that I've made. screen fades to black, and all music fades out before rolling credits. It doesnt call end_game at all :/

I was thinking that I might have to set the audio_group_gain, before setting the global var I'm using
 
Last edited:

Fredrik

Member
I also want to mention that I tried to put audio_group_set_gain(audiogroup_default,0,5000);
in a create event to see if I got the same error, and I did :/
 
Top