SoundpackLoader
Loads custom soundpacks
截圖 共 1 張
模組介紹 作者原文
SoundpackLoader
An early WIP mod for loading custom soundpacks into the game.
For users
Download SoundpackLoader from here
Upon launching the game, a CustomSoundpacks folder should appear in the BepInEx folder. If it didn't, make the folder yourself. Put your soundpacks there and relaunch.
The current interface is a bit rough -- on the "Choose Yer Tromboner" screen, the selected soundpack is written at the top of the screen. Cycle through soundpacks using PageUp and PageDown. You can also cycle through soundpacks while playing a song. The keys can be changed in the config text file in TromboneChamp\BepInEx\config\org.crispykevin.soundpackloader.cfg.
Changelog
v0.2.6
- Don't delete trombone sound if no CustomSoundpacks
- Actually create the CustomSoundpacks folder
v0.2.5
- Serialize json async
v0.2.4
- Load into the game faster
- Default trombone sound if you skip char select
v0.2.3
- Fix for mac
v0.2.2
- Fix so trombone sound can happen if you skip the character select screen
Soundpack structure
Making a soundpack is simple. It's just fifteen audio files of the notes of the C major scale, from C1 to C3. Additionally, some information about the pack is given in a special text format (JSON).
Currently, not much is in the.json file:
| Attribute | Description | Required? |
| ------------- | ------------- | ---------- |
| SoundpackFormatRevision | Indicates which version of the soundpack specification this soundpack was designed for. Right now, always set this to 1. | true |
| Name | Name of the soundpack | true |
| Namespace | Another name/identifier used in case there's two soundpacks with the same name. | true |
| VolumeModifier | Multiplier to adjust the trombone volume while using the soundpack (0.0-1.0) | false, default = 1.0 |
{
"SoundpackFormatRevision": 1,
"Name": "cello-lower",
"Namespace": "crispykevin",
"VolumeModifier": 1.0
}
Other notes:
- A soundpack must have fifteen audio files, each matching "{noteName}." (file glob, not regex) (e.g. "my_cool_C2.wav" is acceptable)
- Currently,.ogg and.wav audio files are supported.
For modders
API Overview
SoundpackLoader provides an API to conveniently control soundpacks in-game. Almost everything you need will be in the SoundpackManager class.
- Get a Soundpack instance using SoundpackManager.FindPack, GetAllPacks, GetVanillaPacks, and GetCustomPacks.
- Inside a song, use SoundpackManager.ChangePack(GameController, Soundpack) to change the currently-selected soundpack and update the sounds used by the GameController instance.
- To change the currently-selected soundpack without updating the sounds used by a GameController instance, use the SoundpackManager.CurrentPack setter property.
- To add/remove/load songs dynamically (besides the ones in CustomSoundpacks folder), use SoundpackManager.AddPack, RemovePack, and LoadPack.
- To do something whenever the soundpack changes, subscribe to SoundpackManager.SoundpackChanged. The event args provide the old and new packs.
Setup
Add a reference to SoundpackLoader's DLL in your project's DLL. To do this, add another `` in your.csproj file:
$(GameFolder)\BepInEx\plugins\SoundpackLoader.dll
Code examples
Change the soundpack before every note (see
[HarmonyPatch(typeof(GameController))]
class GameControllerPatch
{
[HarmonyPrefix]
[HarmonyPatch(nameof(GameController.playNote))]
static void BeforeNote(GameController __instance)
{
if (Plugin.Enabled.Value)
{
var packs = Plugin.IncludeVanilla.Value? SoundpackManager.GetAllPacks(): SoundpackManager.GetCustomPacks();
SoundpackManager.ChangePack(__instance, packs.GetRandom());
}
}
}
Shuffle the notes of each soundpack (see NoteShuffle (TODO upload to github)):
public class Plugin: BaseUnityPlugin {...
private void Awake() {...
SoundpackManager.SoundpackChanged += OnSoundpackChanged;
}
private void OnSoundpackChanged(object sender, SoundpackChangedEventArgs e)
{
if (backup!= null)
{
for (int i = 0; i
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。
下面這些內容需要先安裝,否則該模組不會生效: