/// <summary> /// Adds a track to the game /// can be used as an alternative to the LoadMusic/LoadMusicAsync methods if you want to load the file yourself or already have an AudioClip for other reasons /// </summary> /// /// <param name="trackName"> /// DisplayName of the track, has to be unique. (preferably prefixed with your mod's name or acronym, eg `myMod_trackName`) /// </param> /// /// <param name="music"> /// Non-Null AudioClip to play when loading the track /// </param> /// /// <returns> /// MusicLoadResult /// </returns> public static MusicLoadResult AddMusic(string trackName, AudioClip music) { return(CustomMusicManager.AddMusic(trackName, music)); }
/// <summary> /// Loads and adds a track synchronously /// </summary> /// /// <param name="trackName"> /// DisplayName of the track, has to be unique. (preferably prefixed with your mod's name or acronym, eg `myMod_trackName`) /// </param> /// /// <param name="formatType"> /// format of the file, e.g. MPEG for .mp3 or WAV for .wav files /// </param> /// /// <param name="filePath"> /// The path to the music-file, either absolute or relative to `[...]/BepInEx/config/blazingtwist.sor.musicloader/` /// You can use either `/` or System.IO.Path.DirectorySeparatorChar for the path. /// </param> /// /// <returns> /// A Tuple of MusicLoadResult and the final AudioClip (when MusicLoadResult == Success) or null otherwise /// </returns> public static (MusicLoadResult, AudioClip) LoadMusic(string trackName, AudioType formatType, string filePath) { return(CustomMusicManager.AddMusic(trackName, formatType, filePath)); }