I just noticed this today, and am wondering if there’s a bug in the latest update? Anytime I play an audio file, it works the 1st time, but not the 2nd time, and sometimes not the 3rd time. But then it works again after that.
For example, at the start of my game I have a countdown for 3 seconds. It plays a sound each second, and it used to work fine. Now it only plays the first time (3) and last time (when countdown reaches 0). Then the game starts. It will play the jump sound the first time my character jumps, but not the 2nd (or 3rd if I jump twice quickly), but after that it’s fine. This also affects music. The music starts on song A, switches to song B, back to song A, but won’t play song A the 2nd time.
This is happening now to any other project file I open, not just the most recent game. It all worked fine two days ago.
The same issue is happening even when I load Gdevelop’s Platformer starter game.
The samething happening here. I checked with my project and with platform example.
I can’t reproduce this on my game or Not-a-vania.
Looking at the platformer example, it was built before the audio system update early in this year/late last year, so it doesn’t have any of its audio files set to be preloaded.
You will want to ensure you go to your resources panel and select ‘Preload as sound’ on all of your audio files.
You can see here in the Platformer example that they don’t have this selected.
You shouldn’t use “preload as music” (nor use any of the “Play music” events) since those are designed for a legacy sound system. You can read more about why here: Audio [GDevelop wiki]
I changed all my audio files to “Preload as sound”, and changed all “play music” files to “play audio” instead but it didn’t change anything.
However, I fixed it by changing the sounds to “play a sound on a channel” instead of “play a sound.” Not sure why that made a difference, but it all works again like it used to.
One thing that is still strange is if I make my preview full screen, when I quit the preview I can’t see G-Develop window anymore. The menus are all still active at the top of the screen, but the window won’t show up unless I try to quit and then it asks if I’m sure. This also just started after the update today. But that’s for a different thread…
It seems that we are having the exact same problem with audio, because everything you described occurs equally with me! Here “play sound on a channel” works fine too!
I reinstalled the previous version and the action “play a sound” returned to work perfectly. I downloaded (not updated as before) the current version and the problem came back.
I can’t reproduce this even in the platformer example after I change the toggle I mentioned above.
Can either of you record and upload a short video of this happening, and share an example project where it is occurring? If I can reproduce it then I can more easily write up a bug report for you on the github.
Here’s the machine I’m using
Still waiting on a project to be uploaded as requested.
Thanks! I’ll try to take a look at this today, if I can reproduce it locally I’ll get a github issue opened.
Please note: If “Play sound on a channel” works for you as mentioned above, you should already be using this event in general (sound channels are important for handling sounds in games with numerous sound effects, so the “Play sound” event isn’t going to be optimized for repeated use anyway, and the sound events should almost always be used instead of music events since those are for a legacy sound system.)
I’ll still get a github issue open anyway if it’s reproduceable, but definitely build a habit of using sound channels for sounds. (Ensure you’re using a channel only for 1 sound/type of sound. So Channel 0 could be for music, channels 1-10 are for each sound your player makes (Jump/hurt/shoot/etc each get dedicated to a channel), then do similar things for your enemies or other sound effects.). Sound channels are decided by you, and they’re infinite.
Good to know. Thanks.
Yeah, up until now, I’ve just been using the generic “Play Music” or “Play Sound” for everything, so I will have to change my bad habits!
Thanks I will change my Bad habits.
Thanks to @Rasterisko 's test project I was able to confirm this.
I’ve created an issue on the github at "Play sound" action skips if used repeatedly in 5.0.122 · Issue #3315 · 4ian/GDevelop · GitHub
In the interim, I was also able to confirm “Play sound file on a channel” works as it should in every test I could think of, even spamming the sound every 0.01 seconds. As mentioned above I’d recommend using this action going forward for any audio needs, even though you could think of it as a “workaround” for now.
A new GD5 version has been released that should fix this issue, I can’t test today, but you should download it and give it a try.
If you can confirm it’s resolved, I’ll close out this thread. I’ll give it a test sometime over this weekend if I don’t hear from either of you in this thread.
I tested here and the issue is fixed to me. I tested in my old project and did a new. Both perfectly.
Fantastic. Thanks for confirming. Closing this thread out.
Edit: Actually, one more check. @GlennGorgoth can you confirm your issue is fixed
Yep, fixed for me as well. Thanks!