audio_play_sound just not working?


Really strange error here, it's been happening the last few days with this prototype and it's never happened to me before, really confused here.

When trying to play a sound with audio_play_sound, sometimes it just...doesn't work? I'll add a sound called snd_door for example, set it up with the new sound effect, and then when adding audio_play_sound(snd_door,1,false) to a line of code it will just play another completely random sound from the game. I've tried double checking to make sure it's the right sound, I've tried making multiple versions of the same sound under different names, but even when swapping it out with the new sounds under new names it still plays the other sound effect. Sometimes it does this, sometimes it doesn't. Sometimes I'll add a new sound and when I reference it by name, it will just give me a windows error beep, however another previous working sound effect in the game will suddenly be replaced by the new sound, despite not being told to play the new sound in code. It will just replace the sound effect of whatever was previously saved, and trying to reload the old sound from a file will do nothing and it will continue to be bugged and play the new sound but under a different name.

I'm extremely confused and frustrated. Is there anything in options to look out for that I may have selected accidentally that's causing this, or any other solution at all?
Have you tried clearing the project cache (use the broom icon) before you run your game? Do the sounds play correctly when you preview them in the IDE?


šŸ§ *penguin noises*
GMC Elder
Sounds like cache corruption. But some other steps worth checking out...
  • Make sure you have the arguments in the right order so you don't accidentally use another argument for the asset reference, that could cause random sounds to play.
  • audio_set_channel_num (or something along those lines) can be used to set how many sounds can play at once, having it too low will cut off low-prio sounds and having it too high can make sounds very loud if a lot happens at once
  • Check the compile log, if a sound file is missing (e.g. import failed, corruption, unsupported format) there will be a message like "can't find sound <name>, using default (windows ding)"