forked from nikita/muzika-gromche
Raise the default audio volume, add a configuration slider
This commit is contained in:
parent
c62535841a
commit
825355dd54
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
## MuzikaGromche 1337.9001.1
|
||||
|
||||
- Raised the default audio volume, and added a configuration slider.
|
||||
|
||||
## MuzikaGromche 1337.9001.0 - v73 Music quieter Edition
|
||||
|
||||
|
|
|
|||
|
|
@ -2177,10 +2177,13 @@ namespace MuzikaGromche
|
|||
public static bool ExtrapolateTime { get; private set; } = true;
|
||||
public static bool ShouldSkipWindingPhase { get; private set; } = false;
|
||||
|
||||
// Audio files are normalized to target -14 LUFS, which is too loud to communicate. Reduce by another -12 dB down to about -26 LUFS.
|
||||
public static float DefaultVolume = 0.25f;
|
||||
#if DEBUG
|
||||
// Audio files are normalized to target -14 LUFS, which is too loud to communicate. Reduce by another -9 dB down to about -23 LUFS.
|
||||
private const float VolumeDefault = 0.35f;
|
||||
private const float VolumeMin = 0.2f;
|
||||
private const float VolumeMax = 0.5f;
|
||||
// Ranges from quiet 0.20 (-14 dB) to loud 0.5 (-6 dB)
|
||||
public static ConfigEntry<float> Volume { get; private set; } = null!;
|
||||
#if DEBUG
|
||||
// Latest set track, used for loading palette and timings.
|
||||
private static IAudioTrack? CurrentTrack = null;
|
||||
// All per-track values that can be overridden
|
||||
|
|
@ -2231,6 +2234,10 @@ namespace MuzikaGromche
|
|||
new ConfigDescription("Display lyrics in the HUD tooltip when you hear the music."));
|
||||
LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(DisplayLyrics, requiresRestart: false));
|
||||
|
||||
Volume = configFile.Bind("General", "Volume", VolumeDefault,
|
||||
new ConfigDescription("Volume of music played by this mod.", new AcceptableValueRange<float>(VolumeMin, VolumeMax)));
|
||||
LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(Volume, requiresRestart: false));
|
||||
|
||||
AudioOffset = configFile.Bind("General", "Audio Offset", 0f, new ConfigDescription(
|
||||
"Adjust audio offset (in seconds).\n\nIf you are playing with Bluetooth headphones and experiencing a visual desync, try setting this to about negative 0.2.\n\nIf your video output has high latency (like a long HDMI cable etc.), try positive values instead.",
|
||||
new AcceptableValueRange<float>(-0.5f, 0.5f)));
|
||||
|
|
@ -2249,7 +2256,6 @@ namespace MuzikaGromche
|
|||
SetupEntriesForScreenFilters(configFile);
|
||||
SetupEntriesForExtrapolation(configFile);
|
||||
SetupEntriesToSkipWinding(configFile);
|
||||
SetupEntriesForVolume(configFile);
|
||||
SetupEntriesForPaletteOverride(configFile);
|
||||
SetupEntriesForTimingsOverride(configFile);
|
||||
#endif
|
||||
|
|
@ -2333,13 +2339,6 @@ namespace MuzikaGromche
|
|||
}
|
||||
}
|
||||
|
||||
private void SetupEntriesForVolume(ConfigFile configFile)
|
||||
{
|
||||
Volume = configFile.Bind("General", "Volume", DefaultVolume,
|
||||
new ConfigDescription("Volume of the music played by this mod.", new AcceptableValueRange<float>(0f, 1f)));
|
||||
LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(Volume, requiresRestart: false));
|
||||
}
|
||||
|
||||
private void SetupEntriesForPaletteOverride(ConfigFile configFile)
|
||||
{
|
||||
const string section = "Palette";
|
||||
|
|
@ -2714,25 +2713,33 @@ namespace MuzikaGromche
|
|||
IntroAudioSource.maxDistance = Plugin.AudioMaxDistance;
|
||||
IntroAudioSource.dopplerLevel = 0;
|
||||
IntroAudioSource.loop = false;
|
||||
IntroAudioSource.volume = Config.DefaultVolume;
|
||||
IntroAudioSource.volume = Config.Volume.Value;
|
||||
|
||||
LoopAudioSource = loopAudioGameObject.GetComponent<AudioSource>();
|
||||
LoopAudioSource.maxDistance = Plugin.AudioMaxDistance;
|
||||
LoopAudioSource.dopplerLevel = 0;
|
||||
LoopAudioSource.loop = true;
|
||||
LoopAudioSource.volume = Config.DefaultVolume;
|
||||
LoopAudioSource.volume = Config.Volume.Value;
|
||||
|
||||
Config.Volume.SettingChanged += UpdateVolume;
|
||||
|
||||
Debug.Log($"{nameof(MuzikaGromche)} {nameof(MuzikaGromcheJesterNetworkBehaviour)} Patched JesterEnemy");
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
void Update()
|
||||
public override void OnDestroy()
|
||||
{
|
||||
Config.Volume.SettingChanged -= UpdateVolume;
|
||||
}
|
||||
|
||||
private void UpdateVolume(object sender, EventArgs e)
|
||||
{
|
||||
if (IntroAudioSource != null && LoopAudioSource != null)
|
||||
{
|
||||
IntroAudioSource.volume = Config.Volume.Value;
|
||||
LoopAudioSource.volume = Config.Volume.Value;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public override void OnNetworkSpawn()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue