MonoGame/MonoGame

[Help Wanted] Introduce Content.Load<SoundEffect>() fallback to load from file when no .xnb exists

Open

#8,482 opened on Sep 11, 2024

View on GitHub
 (2 comments) (0 reactions) (0 assignees)C# (13,886 stars) (3,071 forks)batch import
Feature RequestHelp Wanted

Description

Intent

Content.Load should have the ability to "fall back" At Runtime and load sound files when no corresponding .xnb exists.

This will enable a single path for developers to load sounds whether they choose to use the content pipeline or not and greatly simplify the documented process for loading content.

This is not for the MGCB tool as that is used to build .xnbs already, this is about runtime!

The "Fallback" would need to handle:

  • Locating the specific file in question based on the file name (including handling for naming casing) - e.g. (Background.wav vs background.wav or BackGround.wav from "background" as a name.
  • Handling sub-paths / folders (e.g. "Audio/Menu/background.wav")
  • Determining the correct filetype being loaded (based on what MonoGame supports at runtime), wav, etc
  • Handling the correct functionality to use to load the file and return the SoundEffect definition

Support is preferred by the community to help to make this happen and unify the path for all developers.

Motivation

In order to simplify the loading of manual content, rather than having separate code to identify, load, and manage files, the existing Content.Load methods should be enhanced with a fallback measure to engage with content of the specified time.

This ensures a simple path for all MonoGame developers regardless of which path they choose and also reduces the impact should the developer need to switch path and cut out unnecessary code changes.fallback

See ALso

Shaders and Models are excluded for the moment as they have additional dependencies

Contributor guide