Compensate for loudness level -14 LUFS of audio files
This commit is contained in:
		
							parent
							
								
									8223425b19
								
							
						
					
					
						commit
						cd9e0a7a10
					
				|  | @ -2084,7 +2084,10 @@ 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 | ||||
|         public static ConfigEntry<float> Volume { get; private set; } = null!; | ||||
|         // Latest set track, used for loading palette and timings. | ||||
|         private static IAudioTrack? CurrentTrack = null; | ||||
|         // All per-track values that can be overridden | ||||
|  | @ -2153,6 +2156,7 @@ namespace MuzikaGromche | |||
|             SetupEntriesForScreenFilters(configFile); | ||||
|             SetupEntriesForExtrapolation(configFile); | ||||
|             SetupEntriesToSkipWinding(configFile); | ||||
|             SetupEntriesForVolume(configFile); | ||||
|             SetupEntriesForPaletteOverride(configFile); | ||||
|             SetupEntriesForTimingsOverride(configFile); | ||||
| #endif | ||||
|  | @ -2274,6 +2278,13 @@ 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"; | ||||
|  | @ -2658,16 +2669,26 @@ namespace MuzikaGromche | |||
|                 IntroAudioSource.maxDistance = Plugin.AudioMaxDistance; | ||||
|                 IntroAudioSource.dopplerLevel = 0; | ||||
|                 IntroAudioSource.loop = false; | ||||
|                 IntroAudioSource.volume = Config.DefaultVolume; | ||||
| 
 | ||||
|                 LoopAudioSource = loopAudioGameObject.GetComponent<AudioSource>(); | ||||
|                 LoopAudioSource.maxDistance = Plugin.AudioMaxDistance; | ||||
|                 LoopAudioSource.dopplerLevel = 0; | ||||
|                 LoopAudioSource.loop = true; | ||||
|                 LoopAudioSource.volume = Config.DefaultVolume; | ||||
| 
 | ||||
|                 Debug.Log($"{nameof(MuzikaGromche)} {nameof(MuzikaGromcheJesterNetworkBehaviour)} Patched JesterEnemy"); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
| #if DEBUG | ||||
|         void Update() | ||||
|         { | ||||
|             IntroAudioSource.volume = Config.Volume.Value; | ||||
|             LoopAudioSource.volume = Config.Volume.Value; | ||||
|         } | ||||
| #endif | ||||
| 
 | ||||
|         public override void OnNetworkSpawn() | ||||
|         { | ||||
|             ChooseTrackDeferred(); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue