Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Preload as" toggles for audio files in the Resources Panel do not behave the same as the "Preload as" event actions. #6508

Open
1 task done
Silver-Streak opened this issue Apr 6, 2024 · 1 comment

Comments

@Silver-Streak
Copy link
Collaborator

Silver-Streak commented Apr 6, 2024

Is there an existing issue for this?

Describe the bug

When setting up audio, using the "Preload as" events will load the audio files into memory so that they start playing instantly, using the "Preload as" toggles in the resources panel does not behave the same, or preloads slower, as the audio files do not load instantly when first played using just those toggles.

I've set up an example project to show this.

Interestingly, it seems that the "preload as" events are also still taken into consideration even if they're disabled, which was hiding this problem from me originally.

Example project:
PreloadAudioTests.zip

Steps to reproduce

In the example project, this can be replicated as follows:

  1. Load the example project, which has all of the audio resources set to "Preload as sound" in the resources panel.
  2. Preview the project.
  3. Click the B button, which is the largest audio file.
  4. Watch the timer that starts. For me, audio can be heard around 1.1 seconds.
  5. Close the preview and go to the resources tab.
  6. Disable "preload as sound" for the audio files.
  7. Preview the project.
  8. Click the B button, and watch the timer. For me, it is still 1.1 seconds
  9. Close the preview and go to the event sheet.
  10. Add a new event with the "At the beginning of the scene" condition.
  11. Add the "Preload as sound" action to the event, pointed at b.aac
  12. Preview the project.
  13. Click the B button, and watch the timer. For me, it now starts audio around 0.5 seconds

Separate from the above issue, but just as interesting:
After step 13 above

  1. Close the preview, go back into the event sheet.
  2. Disable the preload event.
  3. Preview the project.
  4. Click the B button, and watch the timer. For me, it is STILL starting audio around 0.5 seconds as if the preload is still occurring. If you delete the disabled event entirely and restart the preview, it goes back to 1.1 seconds.

GDevelop platform

Desktop

GDevelop version

Tested on both 5.3.198 and 5.3.195

Platform info

OS (e.g. Windows, Linux, macOS, Android, iOS)

Windows

OS Version (e.g. Windows 10, macOS 10.15)

10 Pro

Browser(For Web) (e.g. Chrome, Firefox, Safari)

N/A. testing on desktop build

Device(For Mobile) (e.g. iPhone 12, Samsung Galaxy S21)

N/A

Additional context

No response

@Silver-Streak
Copy link
Collaborator Author

Silver-Streak commented Apr 6, 2024

From some additional testing:

It seems like "Preload as X" toggles in the resources panel only apply if they see the sound file used within the scene event sheet already?

Basically, it's only preloading those audio files if it's used in an event that explicitly calls that resource (so my Sound by String extension, which calls it via JS expression rather than resource call, isn't detected).

This makes me think the "Preload" toggles in resources are getting ignored by the gradual loading changes that were made before, whereas they should probably be treated as loading at the start of the game rather than scene-specific.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant