diff --git a/README.md b/README.md index 602b90e..6176033 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ A BSIPA compatible mod that can change following in-game sounds: Make sure that you have core mods installed with [ModAssistant](/~https://github.com/Assistant/ModAssistant) (BSIPA, Harmony, BSML). Go to the [releases page](/~https://github.com/SamuelTulach/SoundReplacer/releases) and download the latest build (or build compatible with your Beat Saber version). Extract the zip file and move the DLL file into plugins folder located in Beat Saber install directory. ## Usage -First, you will need to find sounds that you want to use. They have to be in OGG format. Please note that certain sounds should have offset, otherwise it might seem like the sound is played before the action happens. To download ready to use sounds, check out [BSMG discord's](https://discord.gg/beatsabermods) #game-sounds section. +First, you will need to find sounds that you want to use. They have to be in OGG/MPEG/WAV format. Please note that certain sounds should have offset, otherwise it might seem like the sound is played before the action happens. To download ready to use sounds, check out [BSMG discord's](https://discord.gg/beatsabermods) #game-sounds section. Once you have sounds that you want to use, simply move them to Beat Saber install directory -> UserData -> SoundReplacer (should be created automatically if you run the game with mod once, do not put them within subfolders). After you have done so, (re)start the game and choose which sounds you want to use in the in-game menu. If you are unsure how the folder structure should look, check out the screenshot bellow. diff --git a/SoundReplacer/SoundReplacer/Properties/AssemblyInfo.cs b/SoundReplacer/SoundReplacer/Properties/AssemblyInfo.cs index 1f10f59..4ad1aaf 100644 --- a/SoundReplacer/SoundReplacer/Properties/AssemblyInfo.cs +++ b/SoundReplacer/SoundReplacer/Properties/AssemblyInfo.cs @@ -14,5 +14,5 @@ [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("ca60fd0d-b67b-4fd6-8081-3d8349bdcc89")] -[assembly: AssemblyVersion("0.0.2")] -[assembly: AssemblyFileVersion("0.0.2")] +[assembly: AssemblyVersion("0.0.3")] +[assembly: AssemblyFileVersion("0.0.3")] diff --git a/SoundReplacer/SoundReplacer/SoundLoader.cs b/SoundReplacer/SoundReplacer/SoundLoader.cs index 060704d..42d2a13 100644 --- a/SoundReplacer/SoundReplacer/SoundLoader.cs +++ b/SoundReplacer/SoundReplacer/SoundLoader.cs @@ -28,10 +28,12 @@ public static void GetSoundLists() foreach (var file in files) { var fileInfo = new FileInfo(file); - if (fileInfo.Extension != ".ogg") - continue; - - GlobalSoundList.Add(fileInfo.Name); + if (fileInfo.Extension == ".ogg" || + fileInfo.Extension == ".mp3" || + fileInfo.Extension == ".wav") + { + GlobalSoundList.Add(fileInfo.Name); + } } } @@ -42,12 +44,29 @@ public static string GetFullPath(string name) return fileInfo.FullName; } + public static UnityWebRequest GetRequest(string fullPath) + { + var fileUrl = "file:///" + fullPath; + var fileInfo = new FileInfo(fullPath); + var extension = fileInfo.Extension; + switch (extension) + { + case ".ogg": + return UnityWebRequestMultimedia.GetAudioClip(fileUrl, AudioType.OGGVORBIS); + case ".mp3": + return UnityWebRequestMultimedia.GetAudioClip(fileUrl, AudioType.MPEG); + case ".wav": + return UnityWebRequestMultimedia.GetAudioClip(fileUrl, AudioType.WAV); + default: + return UnityWebRequestMultimedia.GetAudioClip(fileUrl, AudioType.UNKNOWN); + } + } + public static AudioClip LoadAudioClip(string name) { var fullPath = GetFullPath(name); - var fileUrl = "file:///" + fullPath; - var request = UnityWebRequestMultimedia.GetAudioClip(fileUrl, AudioType.OGGVORBIS); - + var request = GetRequest(fullPath); + AudioClip loadedAudio = null; var task = request.SendWebRequest(); diff --git a/SoundReplacer/SoundReplacer/manifest.json b/SoundReplacer/SoundReplacer/manifest.json index 54357a3..da845a1 100644 --- a/SoundReplacer/SoundReplacer/manifest.json +++ b/SoundReplacer/SoundReplacer/manifest.json @@ -3,7 +3,7 @@ "id": "SoundReplacer", "name": "SoundReplacer", "author": "Otiosum", - "version": "0.0.2", + "version": "0.0.3", "description": "Easily replace in-game sounds", "gameVersion": "1.18.1", "dependsOn": {