Decompiled source of BigDJ v1.2.1

BepInEx/plugins/BigDJ/BigDJ.dll

Decompiled 4 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Dissonance;
using Dissonance.Audio.Capture;
using Dissonance.Config;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using Mirror;
using ModSettingsMenu.Api;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BigDJ")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0+7436894b85521f233e0a351cbda6a1a3c5abb883")]
[assembly: AssemblyProduct("Studio-grade music mode for voice chat")]
[assembly: AssemblyTitle("BigDJ")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BigDJ
{
	public class Dj : MonoBehaviour
	{
		internal static ConfigEntry<bool> Enabled;

		internal static ConfigEntry<bool> MusicMode;

		internal static ConfigEntry<BroadcastMode> Mode;

		internal static ConfigEntry<DspPreset> Preset;

		internal static ConfigEntry<NoiseSuppressionLevels> Denoise;

		internal static ConfigEntry<bool> BgRemoval;

		internal static ConfigEntry<float> BgAmount;

		internal static ConfigEntry<bool> DryAcoustics;

		internal static ConfigEntry<bool> Diagnostics;

		internal static ConfigEntry<KeyCode> ToggleKey;

		internal static ConfigEntry<bool> Overlay;

		private PlayerCharacter _player;

		private VoiceBroadcastTrigger[] _roomTriggers = Array.Empty<VoiceBroadcastTrigger>();

		private VoiceProximityBroadcastTrigger[] _proxTriggers = Array.Empty<VoiceProximityBroadcastTrigger>();

		private bool _scopedToPlayer;

		private bool _loggedTriggers;

		private CommActivationMode _prevMode;

		private bool _havePrevMode;

		private VoiceSettings _settings;

		private NoiseSuppressionLevels _origDenoise;

		private bool _origBgEnabled;

		private float _origBgAmount;

		private bool _haveOrigSettings;

		private bool _orig2DVoice;

		private bool _haveOrig2DVoice;

		private DissonanceComms _comms;

		private float _origEchoAmount;

		private bool _haveOrigEchoAmount;

		private bool _origSelfEchoOn;

		private bool _haveOrigSelfEcho;

		private LocalVoiceProvider _voiceProvider;

		private float _livePeak;

		private float _liveRms;

		private float _liveDb = -99f;

		private float _nextVuSample;

		private bool _applied;

		private float _retry;

		private float _probeNext;

		private float _revalidateNext;

		private bool _wasTransmitting;

		private bool _haveTransmitState;

		internal static void Bind(ConfigEntry<bool> enabled, ConfigEntry<bool> musicMode, ConfigEntry<BroadcastMode> mode, ConfigEntry<DspPreset> preset, ConfigEntry<NoiseSuppressionLevels> denoise, ConfigEntry<bool> bgRemoval, ConfigEntry<float> bgAmount, ConfigEntry<bool> dryAcoustics, ConfigEntry<bool> diagnostics, ConfigEntry<KeyCode> toggleKey, ConfigEntry<bool> overlay)
		{
			Enabled = enabled;
			MusicMode = musicMode;
			Mode = mode;
			Preset = preset;
			Denoise = denoise;
			BgRemoval = bgRemoval;
			BgAmount = bgAmount;
			DryAcoustics = dryAcoustics;
			Diagnostics = diagnostics;
			ToggleKey = toggleKey;
			Overlay = overlay;
		}

		private void Update()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			if (Enabled.Value && Input.GetKeyDown(ToggleKey.Value))
			{
				MusicMode.Value = !MusicMode.Value;
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(11, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Music mode ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(MusicMode.Value ? "on" : "off");
				}
				log.LogInfo(val);
			}
		}

		private void LateUpdate()
		{
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Expected O, but got Unknown
			try
			{
				if (!Enabled.Value || !MusicMode.Value)
				{
					if (_applied)
					{
						Restore();
					}
					return;
				}
				if ((Object)(object)_player == (Object)null)
				{
					if (Time.time < _retry)
					{
						return;
					}
					_retry = Time.time + 2f;
					if (!FindPlayer())
					{
						return;
					}
				}
				if ((Object)(object)_settings == (Object)null)
				{
					if (Time.time < _retry)
					{
						return;
					}
					_retry = Time.time + 2f;
					FindSettings();
				}
				if ((Object)(object)_comms == (Object)null || (Object)(object)_voiceProvider == (Object)null)
				{
					FindComms();
				}
				if (_roomTriggers.Length + _proxTriggers.Length == 0)
				{
					if (Time.time < _retry)
					{
						return;
					}
					_retry = Time.time + 2f;
					CollectTriggers();
				}
				Revalidate();
				if (!((Object)(object)_player == (Object)null))
				{
					Apply();
					SampleVuMeter();
					CheckTransmitEdge();
					if (Diagnostics.Value)
					{
						Probe();
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(11, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("DJ failed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log.LogError(val);
				_player = null;
				_settings = null;
				_comms = null;
				_voiceProvider = null;
				_roomTriggers = Array.Empty<VoiceBroadcastTrigger>();
				_proxTriggers = Array.Empty<VoiceProximityBroadcastTrigger>();
				_retry = Time.time + 2f;
			}
		}

		private bool FindPlayer()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				PlayerCharacter localPlayerCharacter = WorldManager.localPlayerCharacter;
				if ((Object)(object)localPlayerCharacter != (Object)null && (Object)(object)localPlayerCharacter.playerNetworking != (Object)null && ((NetworkBehaviour)localPlayerCharacter.playerNetworking).isLocalPlayer)
				{
					_player = localPlayerCharacter;
					_loggedTriggers = false;
					ManualLogSource log = Plugin.Log;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(29, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("DJ bound to '");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)_player).name);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' (WorldManager)");
					}
					log.LogInfo(val);
					return true;
				}
			}
			catch
			{
			}
			try
			{
				List<PlayerCharacter> allPlayerCharacters = PlayerCharacter.allPlayerCharacters;
				if (allPlayerCharacters != null && allPlayerCharacters.Count > 0)
				{
					for (int i = 0; i < allPlayerCharacters.Count; i++)
					{
						PlayerCharacter val2 = allPlayerCharacters[i];
						if ((Object)(object)val2 == (Object)null)
						{
							continue;
						}
						PlayerNetworking playerNetworking = val2.playerNetworking;
						if ((Object)(object)playerNetworking != (Object)null && ((NetworkBehaviour)playerNetworking).isLocalPlayer)
						{
							_player = val2;
							_loggedTriggers = false;
							ManualLogSource log2 = Plugin.Log;
							BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(36, 1, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral("DJ bound to '");
								((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)_player).name);
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' (allPlayerCharacters)");
							}
							log2.LogInfo(val);
							return true;
						}
					}
				}
			}
			catch
			{
			}
			return false;
		}

		private void Revalidate()
		{
			if (Time.time < _revalidateNext)
			{
				return;
			}
			_revalidateNext = Time.time + 5f;
			try
			{
				if ((Object)(object)_player == (Object)null || (Object)(object)((Component)_player).gameObject == (Object)null || _roomTriggers.Length + _proxTriggers.Length == 0)
				{
					if ((Object)(object)_player != (Object)null || _roomTriggers.Length + _proxTriggers.Length > 0)
					{
						Plugin.Log.LogInfo((object)"DJ: scene changed, re-acquiring player and triggers");
					}
					_player = null;
					_roomTriggers = Array.Empty<VoiceBroadcastTrigger>();
					_proxTriggers = Array.Empty<VoiceProximityBroadcastTrigger>();
					_havePrevMode = false;
					_loggedTriggers = false;
				}
			}
			catch
			{
				_player = null;
			}
		}

		private void FindSettings()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			bool flag = default(bool);
			foreach (VoiceSettings item in Resources.FindObjectsOfTypeAll<VoiceSettings>())
			{
				if ((Object)(object)item == (Object)null)
				{
					continue;
				}
				_settings = item;
				ManualLogSource log = Plugin.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(25, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("DJ using VoiceSettings '");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)item).name);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'");
				}
				log.LogInfo(val);
				break;
			}
		}

		private void FindComms()
		{
			try
			{
				WorldManager instance = WorldManager.instance;
				if ((Object)(object)instance != (Object)null)
				{
					if ((Object)(object)instance.dissonanceComms != (Object)null)
					{
						_comms = instance.dissonanceComms;
					}
					if ((Object)(object)instance.localVoiceProvider != (Object)null)
					{
						_voiceProvider = instance.localVoiceProvider;
					}
				}
			}
			catch
			{
			}
			if ((Object)(object)_comms == (Object)null)
			{
				try
				{
					_comms = Object.FindObjectOfType<DissonanceComms>();
				}
				catch
				{
				}
			}
			if ((Object)(object)_voiceProvider == (Object)null)
			{
				try
				{
					_voiceProvider = Object.FindObjectOfType<LocalVoiceProvider>();
				}
				catch
				{
				}
			}
		}

		private bool Mine(Component c)
		{
			if ((Object)(object)_player == (Object)null || (Object)(object)c == (Object)null)
			{
				return false;
			}
			if ((Object)(object)c.gameObject == (Object)(object)((Component)_player).gameObject)
			{
				return true;
			}
			Transform transform = c.transform;
			return (Object)(object)transform != (Object)null && transform.IsChildOf(((Component)_player).transform);
		}

		private bool OwnedByRemote(Component c)
		{
			try
			{
				Transform val = ((c != null) ? c.transform : null);
				while ((Object)(object)val != (Object)null)
				{
					PlayerCharacter component = ((Component)val).gameObject.GetComponent<PlayerCharacter>();
					if ((Object)(object)component != (Object)null)
					{
						PlayerNetworking playerNetworking = component.playerNetworking;
						return (Object)(object)playerNetworking == (Object)null || !((NetworkBehaviour)playerNetworking).isLocalPlayer;
					}
					val = val.parent;
				}
			}
			catch
			{
			}
			return false;
		}

		private void CollectTriggers()
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Expected O, but got Unknown
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Expected O, but got Unknown
			bool flag = default(bool);
			if ((Object)(object)_player != (Object)null)
			{
				try
				{
					Il2CppArrayBase<VoiceBroadcastTrigger> componentsInChildren = ((Component)_player).GetComponentsInChildren<VoiceBroadcastTrigger>(true);
					Il2CppArrayBase<VoiceProximityBroadcastTrigger> componentsInChildren2 = ((Component)_player).GetComponentsInChildren<VoiceProximityBroadcastTrigger>(true);
					if (componentsInChildren != null && componentsInChildren2 != null && componentsInChildren.Length + componentsInChildren2.Length > 0)
					{
						_roomTriggers = Il2CppArrayBase<VoiceBroadcastTrigger>.op_Implicit(componentsInChildren);
						_proxTriggers = Il2CppArrayBase<VoiceProximityBroadcastTrigger>.op_Implicit(componentsInChildren2);
						_scopedToPlayer = true;
						if (!_loggedTriggers)
						{
							_loggedTriggers = true;
							ManualLogSource log = Plugin.Log;
							BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(62, 2, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral("DJ triggers: room=");
								((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_roomTriggers.Length);
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" prox=");
								((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_proxTriggers.Length);
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" scopedToPlayer=true (local hierarchy)");
							}
							log.LogInfo(val);
						}
						return;
					}
				}
				catch
				{
				}
			}
			Il2CppArrayBase<VoiceBroadcastTrigger> val2 = Object.FindObjectsOfType<VoiceBroadcastTrigger>();
			Il2CppArrayBase<VoiceProximityBroadcastTrigger> val3 = Object.FindObjectsOfType<VoiceProximityBroadcastTrigger>();
			List<VoiceBroadcastTrigger> list = new List<VoiceBroadcastTrigger>();
			List<VoiceProximityBroadcastTrigger> list2 = new List<VoiceProximityBroadcastTrigger>();
			foreach (VoiceBroadcastTrigger item in val2)
			{
				if (!OwnedByRemote((Component)(object)item))
				{
					list.Add(item);
				}
			}
			foreach (VoiceProximityBroadcastTrigger item2 in val3)
			{
				if (!OwnedByRemote((Component)(object)item2))
				{
					list2.Add(item2);
				}
			}
			_roomTriggers = list.ToArray();
			_proxTriggers = list2.ToArray();
			_scopedToPlayer = false;
			ManualLogSource log2 = Plugin.Log;
			BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(103, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("DJ: no triggers under local player, using ");
				((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(_roomTriggers.Length);
				((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" room + ");
				((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(_proxTriggers.Length);
				((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" proximity triggers scene-wide (remote-owned skipped)");
			}
			log2.LogWarning(val4);
			if (!_loggedTriggers)
			{
				_loggedTriggers = true;
				ManualLogSource log3 = Plugin.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(40, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("DJ triggers: room=");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_roomTriggers.Length);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" prox=");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_proxTriggers.Length);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" scopedToPlayer=");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(_scopedToPlayer);
				}
				log3.LogInfo(val);
			}
		}

		private void ResolveDsp(out NoiseSuppressionLevels denoise, out bool bgRemoval, out float bgAmount)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected I4, but got Unknown
			switch ((Preset != null) ? Preset.Value : DspPreset.Custom)
			{
			case DspPreset.LightCleanup:
				denoise = (NoiseSuppressionLevels)(-1);
				bgRemoval = true;
				bgAmount = 0.3f;
				break;
			case DspPreset.Untouched:
				denoise = (NoiseSuppressionLevels)(-1);
				bgRemoval = false;
				bgAmount = 0f;
				break;
			default:
				denoise = (NoiseSuppressionLevels)(int)Denoise.Value;
				bgRemoval = BgRemoval.Value;
				bgAmount = BgAmount.Value;
				break;
			}
		}

		private void Apply()
		{
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Invalid comparison between Unknown and I4
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Invalid comparison between Unknown and I4
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Expected O, but got Unknown
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Expected O, but got Unknown
			bool flag = default(bool);
			if (!_havePrevMode)
			{
				if (_roomTriggers.Length != 0)
				{
					_prevMode = _roomTriggers[0].Mode;
				}
				else if (_proxTriggers.Length != 0)
				{
					_prevMode = _proxTriggers[0].Mode;
				}
				_havePrevMode = true;
				ManualLogSource log = Plugin.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(26, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("DJ previous trigger mode: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<CommActivationMode>(_prevMode);
				}
				log.LogInfo(val);
			}
			VoiceBroadcastTrigger[] roomTriggers = _roomTriggers;
			foreach (VoiceBroadcastTrigger val2 in roomTriggers)
			{
				try
				{
					if ((int)val2.Mode != 3)
					{
						val2.Mode = (CommActivationMode)3;
					}
				}
				catch
				{
				}
			}
			VoiceProximityBroadcastTrigger[] proxTriggers = _proxTriggers;
			foreach (VoiceProximityBroadcastTrigger val3 in proxTriggers)
			{
				try
				{
					if ((int)val3.Mode != 3)
					{
						val3.Mode = (CommActivationMode)3;
					}
				}
				catch
				{
				}
			}
			if ((Object)(object)_settings != (Object)null)
			{
				if (!_haveOrigSettings)
				{
					_origDenoise = _settings.DenoiseAmount;
					_origBgEnabled = _settings.BackgroundSoundRemovalEnabled;
					_origBgAmount = _settings.BackgroundSoundRemovalAmount;
					_haveOrigSettings = true;
					ManualLogSource log2 = Plugin.Log;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(37, 3, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("DJ previous DSP: denoise=");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<NoiseSuppressionLevels>(_origDenoise);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" bgRemoval=");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(_origBgEnabled);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(_origBgAmount);
					}
					log2.LogInfo(val);
				}
				ResolveDsp(out var denoise, out var bgRemoval, out var bgAmount);
				if (_settings.DenoiseAmount != denoise)
				{
					_settings.DenoiseAmount = denoise;
				}
				if (_settings.BackgroundSoundRemovalEnabled != bgRemoval)
				{
					_settings.BackgroundSoundRemovalEnabled = bgRemoval;
				}
				if (_settings.BackgroundSoundRemovalAmount != bgAmount)
				{
					_settings.BackgroundSoundRemovalAmount = bgAmount;
				}
			}
			if ((Object)(object)_player != (Object)null && (Object)(object)_player.playerNetworking != (Object)null)
			{
				PlayerNetworking playerNetworking = _player.playerNetworking;
				if (!_haveOrig2DVoice)
				{
					_orig2DVoice = playerNetworking.Networkis2DVoice;
					_haveOrig2DVoice = true;
					ManualLogSource log3 = Plugin.Log;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("DJ previous 2D voice mode: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(_orig2DVoice);
					}
					log3.LogInfo(val);
				}
				bool flag2 = Mode != null && Mode.Value == BroadcastMode.IslandRadio2D;
				if (playerNetworking.Networkis2DVoice != flag2)
				{
					if (NetworkServer.active)
					{
						playerNetworking.Networkis2DVoice = flag2;
					}
					try
					{
						playerNetworking.CmdSet2DVoice(flag2);
					}
					catch
					{
					}
					ManualLogSource log4 = Plugin.Log;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(28, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("DJ switched broadcast mode: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(flag2 ? "IslandRadio2D" : "Proximity3D");
					}
					log4.LogInfo(val);
				}
			}
			if (DryAcoustics != null && DryAcoustics.Value)
			{
				if ((Object)(object)_player != (Object)null && (Object)(object)_player.playerNetworking != (Object)null)
				{
					PlayerNetworking playerNetworking2 = _player.playerNetworking;
					if (!_haveOrigEchoAmount)
					{
						_origEchoAmount = playerNetworking2.NetworkechoAmount;
						_haveOrigEchoAmount = true;
					}
					if (playerNetworking2.NetworkechoAmount > 0.001f)
					{
						if (NetworkServer.active)
						{
							playerNetworking2.NetworkechoAmount = 0f;
						}
						try
						{
							playerNetworking2.CmdSetEchoAmount(0f);
						}
						catch
						{
						}
					}
				}
				try
				{
					SelfEcho instance = SelfEcho.Instance;
					if ((Object)(object)instance != (Object)null)
					{
						if (!_haveOrigSelfEcho)
						{
							_origSelfEchoOn = instance.EchoOn;
							_haveOrigSelfEcho = true;
						}
						if (instance.EchoOn)
						{
							instance.EchoOn = false;
						}
					}
				}
				catch
				{
				}
			}
			_applied = true;
		}

		private void SampleVuMeter()
		{
			if (Time.time < _nextVuSample)
			{
				return;
			}
			_nextVuSample = Time.time + 0.05f;
			if ((Object)(object)_voiceProvider == (Object)null)
			{
				try
				{
					WorldManager instance = WorldManager.instance;
					_voiceProvider = ((instance != null) ? instance.localVoiceProvider : null);
				}
				catch
				{
				}
			}
			if ((Object)(object)_voiceProvider == (Object)null)
			{
				return;
			}
			try
			{
				Il2CppStructArray<float> cachedVoiceData = _voiceProvider.CachedVoiceData;
				if (cachedVoiceData == null || ((Il2CppArrayBase<float>)(object)cachedVoiceData).Length == 0)
				{
					return;
				}
				int cachedVoiceWriteHead = _voiceProvider.CachedVoiceWriteHead;
				int num = Math.Min(256, ((Il2CppArrayBase<float>)(object)cachedVoiceData).Length);
				float num2 = 0f;
				float num3 = 0f;
				for (int i = 0; i < num; i++)
				{
					int num4 = (cachedVoiceWriteHead - 1 - i + ((Il2CppArrayBase<float>)(object)cachedVoiceData).Length) % ((Il2CppArrayBase<float>)(object)cachedVoiceData).Length;
					float num5 = ((Il2CppArrayBase<float>)(object)cachedVoiceData)[num4];
					float num6 = ((num5 < 0f) ? (0f - num5) : num5);
					if (num6 > num3)
					{
						num3 = num6;
					}
					num2 += num5 * num5;
				}
				_livePeak = num3;
				_liveRms = Mathf.Sqrt(num2 / (float)num);
				_liveDb = ((_liveRms > 0.0001f) ? (20f * Mathf.Log10(_liveRms)) : (-99f));
			}
			catch
			{
			}
		}

		private static string FormatVuBar(float peak, float db, out string status)
		{
			if (db < -55f)
			{
				status = "SILENT";
				return "[................]";
			}
			float num = Mathf.Clamp01((db + 45f) / 45f);
			int num2 = Mathf.RoundToInt(num * 16f);
			char[] array = new char[18]
			{
				'[', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
				'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'
			};
			for (int i = 0; i < 16; i++)
			{
				array[i + 1] = ((i < num2) ? '|' : '.');
			}
			array[17] = ']';
			if (peak >= 0.95f)
			{
				status = "PEAKING!";
			}
			else if (db >= -24f)
			{
				status = "OPTIMAL";
			}
			else
			{
				status = "ACTIVE";
			}
			return new string(array);
		}

		private void CheckTransmitEdge()
		{
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			try
			{
				bool flag = false;
				VoiceBroadcastTrigger[] roomTriggers = _roomTriggers;
				foreach (VoiceBroadcastTrigger val in roomTriggers)
				{
					if ((Object)(object)val != (Object)null && val.IsTransmitting)
					{
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					VoiceProximityBroadcastTrigger[] proxTriggers = _proxTriggers;
					foreach (VoiceProximityBroadcastTrigger val2 in proxTriggers)
					{
						if ((Object)(object)val2 != (Object)null && val2.IsTransmitting)
						{
							flag = true;
							break;
						}
					}
				}
				if (!_haveTransmitState || flag != _wasTransmitting)
				{
					_haveTransmitState = true;
					_wasTransmitting = flag;
					Plugin.Log.LogInfo((object)(flag ? "DJ transmitting started" : "DJ transmitting stopped"));
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				bool flag2 = default(bool);
				BepInExDebugLogInterpolatedStringHandler val3 = new BepInExDebugLogInterpolatedStringHandler(22, 1, ref flag2);
				if (flag2)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("DJ edge check failed: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message);
				}
				log.LogDebug(val3);
			}
		}

		private void OnGUI()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (Overlay != null && Overlay.Value && Enabled.Value)
				{
					GUI.Box(new Rect(10f, 10f, 320f, 135f), "BigDJ v1.2.1");
					string text = ((Mode != null && Mode.Value == BroadcastMode.IslandRadio2D) ? "Island Radio 2D" : "Proximity 3D");
					GUI.Label(new Rect(20f, 30f, 300f, 20f), "mode: " + text + "  (" + (MusicMode.Value ? "ON" : "OFF") + ")");
					string text2 = ((_haveTransmitState && _wasTransmitting) ? "YES" : "NO");
					GUI.Label(new Rect(20f, 50f, 300f, 20f), "transmitting: " + text2);
					string status;
					string text3 = FormatVuBar(_livePeak, _liveDb, out status);
					string text4 = ((_liveDb > -90f) ? (_liveDb.ToString("F1") + " dB") : "-inf dB");
					GUI.Label(new Rect(20f, 70f, 300f, 20f), "VU: " + text3 + " " + text4 + " (" + status + ")");
					string text5 = ((DryAcoustics != null && DryAcoustics.Value) ? "DRY" : "NATURAL");
					GUI.Label(new Rect(20f, 90f, 300f, 20f), "triggers: room=" + _roomTriggers.Length + " prox=" + _proxTriggers.Length + "  |  echo: " + text5);
					GUI.Label(new Rect(20f, 110f, 300f, 20f), ((Object)(object)_settings != (Object)null) ? ("dsp: " + ((object)_settings.DenoiseAmount/*cast due to .constrained prefix*/).ToString() + " | bg=" + _settings.BackgroundSoundRemovalEnabled + "/" + _settings.BackgroundSoundRemovalAmount.ToString("F2")) : "dsp: n/a");
				}
			}
			catch
			{
			}
		}

		private void Probe()
		{
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Expected O, but got Unknown
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Expected O, but got Unknown
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			if (Time.time < _probeNext)
			{
				return;
			}
			_probeNext = Time.time + 1f;
			bool flag = default(bool);
			try
			{
				VoiceBroadcastTrigger[] roomTriggers = _roomTriggers;
				BepInExInfoLogInterpolatedStringHandler val2;
				foreach (VoiceBroadcastTrigger val in roomTriggers)
				{
					ManualLogSource log = Plugin.Log;
					val2 = new BepInExInfoLogInterpolatedStringHandler(30, 3, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("DJ room '");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)((Component)val).gameObject).name);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' mode=");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<CommActivationMode>(val.Mode);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" transmitting=");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<bool>(val.IsTransmitting);
					}
					log.LogInfo(val2);
				}
				VoiceProximityBroadcastTrigger[] proxTriggers = _proxTriggers;
				foreach (VoiceProximityBroadcastTrigger val3 in proxTriggers)
				{
					ManualLogSource log2 = Plugin.Log;
					val2 = new BepInExInfoLogInterpolatedStringHandler(30, 3, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("DJ prox '");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)((Component)val3).gameObject).name);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' mode=");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<CommActivationMode>(val3.Mode);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" transmitting=");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<bool>(val3.IsTransmitting);
					}
					log2.LogInfo(val2);
				}
				if ((Object)(object)_settings != (Object)null)
				{
					ManualLogSource log3 = Plugin.Log;
					val2 = new BepInExInfoLogInterpolatedStringHandler(26, 4, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("DJ dsp denoise=");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<NoiseSuppressionLevels>(_settings.DenoiseAmount);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" bg=");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<bool>(_settings.BackgroundSoundRemovalEnabled);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("/");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(_settings.BackgroundSoundRemovalAmount);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" mode=");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<BroadcastMode?>(Mode?.Value);
					}
					log3.LogInfo(val2);
				}
				ManualLogSource log4 = Plugin.Log;
				val2 = new BepInExInfoLogInterpolatedStringHandler(24, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("DJ audio: peak=");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(_livePeak, "F2");
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" rms=");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(_liveRms, "F3");
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" db=");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(_liveDb, "F1");
				}
				log4.LogInfo(val2);
			}
			catch (Exception ex)
			{
				ManualLogSource log5 = Plugin.Log;
				BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(17, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("DJ probe failed: ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex.Message);
				}
				log5.LogWarning(val4);
			}
		}

		private void Restore()
		{
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Expected O, but got Unknown
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Expected O, but got Unknown
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			_applied = false;
			bool flag = default(bool);
			try
			{
				if (_havePrevMode)
				{
					VoiceBroadcastTrigger[] roomTriggers = _roomTriggers;
					foreach (VoiceBroadcastTrigger val in roomTriggers)
					{
						try
						{
							val.Mode = _prevMode;
						}
						catch
						{
						}
					}
					VoiceProximityBroadcastTrigger[] proxTriggers = _proxTriggers;
					foreach (VoiceProximityBroadcastTrigger val2 in proxTriggers)
					{
						try
						{
							val2.Mode = _prevMode;
						}
						catch
						{
						}
					}
					_havePrevMode = false;
					ManualLogSource log = Plugin.Log;
					BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(29, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("DJ restored trigger mode to: ");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<CommActivationMode>(_prevMode);
					}
					log.LogInfo(val3);
				}
				if ((Object)(object)_settings != (Object)null && _haveOrigSettings)
				{
					_settings.DenoiseAmount = _origDenoise;
					_settings.BackgroundSoundRemovalEnabled = _origBgEnabled;
					_settings.BackgroundSoundRemovalAmount = _origBgAmount;
					_haveOrigSettings = false;
					ManualLogSource log2 = Plugin.Log;
					BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(36, 3, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("DJ restored dsp denoise=");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<NoiseSuppressionLevels>(_origDenoise);
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" bgRemoval=");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<bool>(_origBgEnabled);
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("/");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(_origBgAmount);
					}
					log2.LogInfo(val3);
				}
				if (_haveOrig2DVoice && (Object)(object)_player != (Object)null && (Object)(object)_player.playerNetworking != (Object)null)
				{
					PlayerNetworking playerNetworking = _player.playerNetworking;
					if (NetworkServer.active)
					{
						playerNetworking.Networkis2DVoice = _orig2DVoice;
					}
					try
					{
						playerNetworking.CmdSet2DVoice(_orig2DVoice);
					}
					catch
					{
					}
					ManualLogSource log3 = Plugin.Log;
					BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(27, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("DJ restored 2D voice mode: ");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<bool>(_orig2DVoice);
					}
					log3.LogInfo(val3);
					_haveOrig2DVoice = false;
				}
				if (_haveOrigEchoAmount && (Object)(object)_player != (Object)null && (Object)(object)_player.playerNetworking != (Object)null)
				{
					PlayerNetworking playerNetworking2 = _player.playerNetworking;
					if (NetworkServer.active)
					{
						playerNetworking2.NetworkechoAmount = _origEchoAmount;
					}
					try
					{
						playerNetworking2.CmdSetEchoAmount(_origEchoAmount);
					}
					catch
					{
					}
					_haveOrigEchoAmount = false;
				}
				if (_haveOrigSelfEcho)
				{
					try
					{
						if ((Object)(object)SelfEcho.Instance != (Object)null)
						{
							SelfEcho.Instance.EchoOn = _origSelfEchoOn;
						}
					}
					catch
					{
					}
					_haveOrigSelfEcho = false;
				}
				_haveTransmitState = false;
				_livePeak = 0f;
				_liveRms = 0f;
				_liveDb = -99f;
				Plugin.Log.LogInfo((object)"DJ: voice pipeline fully restored");
			}
			catch (Exception ex)
			{
				ManualLogSource log4 = Plugin.Log;
				BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(19, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("DJ restore failed: ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex.Message);
				}
				log4.LogWarning(val4);
			}
		}

		private void OnDisable()
		{
			try
			{
				if (_applied)
				{
					Restore();
				}
			}
			catch
			{
			}
		}

		private void OnDestroy()
		{
			try
			{
				if (_applied)
				{
					Restore();
				}
			}
			catch
			{
			}
		}
	}
	internal enum BroadcastMode
	{
		Proximity3D,
		IslandRadio2D
	}
	internal enum DspPreset
	{
		Custom,
		Untouched,
		LightCleanup
	}
	[BepInPlugin("walker.bigdj", "BigDJ", "1.2.1")]
	[BepInDependency("IceBoxStudio.BigWalk.ModSettingsMenu", ">=1.1.0")]
	public class Plugin : BasePlugin
	{
		public const string PLUGIN_GUID = "walker.bigdj";

		public const string PLUGIN_NAME = "BigDJ";

		public const string PLUGIN_VERSION = "1.2.1";

		internal static ManualLogSource Log;

		public override void Load()
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Expected O, but got Unknown
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Expected O, but got Unknown
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Expected O, but got Unknown
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Expected O, but got Unknown
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Expected O, but got Unknown
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Expected O, but got Unknown
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Expected O, but got Unknown
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Expected O, but got Unknown
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Expected O, but got Unknown
			Log = ((BasePlugin)this).Log;
			ConfigEntry<bool> enabled = ((BasePlugin)this).Config.Bind<bool>("General", "Enabled", true, new ConfigDescription("Master switch for BigDJ. Turn this off to fully disable the mod and return to normal voice chat.", (AcceptableValueBase)null, new object[2]
			{
				ModSettingsTags.Section("General", (int?)10),
				ModSettingsTags.Entry((int?)10, (double?)null)
			}));
			ConfigEntry<bool> musicMode = ((BasePlugin)this).Config.Bind<bool>("Music", "MusicMode", false, new ConfigDescription("When on, your voice transmits continuously and speech cleanup is turned down, so music plays as a steady stream instead of cutting in and out. Turn off to go back to normal voice chat.", (AcceptableValueBase)null, new object[2]
			{
				ModSettingsTags.Section("Music", (int?)20),
				ModSettingsTags.Entry((int?)10, (double?)null)
			}));
			ConfigEntry<BroadcastMode> mode = ((BasePlugin)this).Config.Bind<BroadcastMode>("Music", "BroadcastMode", BroadcastMode.Proximity3D, new ConfigDescription("Audio spatialization mode. Proximity3D = normal local 3D positional audio. IslandRadio2D = direct 2D broadcast to all players via native 2D voice (no distance falloff, no directional muffling).", (AcceptableValueBase)null, new object[1] { ModSettingsTags.Entry((int?)12, (double?)null) }));
			ConfigEntry<DspPreset> preset = ((BasePlugin)this).Config.Bind<DspPreset>("Music", "DspPreset", DspPreset.Untouched, new ConfigDescription("One-switch sound cleanup combo for music mode. Untouched = no cleanup at all; Light Cleanup = mild background-sound removal; Custom = use the three knobs below instead.", (AcceptableValueBase)null, new object[1] { ModSettingsTags.Entry((int?)15, (double?)null) }));
			ConfigEntry<bool> dryAcoustics = ((BasePlugin)this).Config.Bind<bool>("Music", "DryAcoustics", true, new ConfigDescription("Suppresses environmental cave reverb and island echo while music mode is active for clean studio audio.", (AcceptableValueBase)null, new object[1] { ModSettingsTags.Entry((int?)19, (double?)null) }));
			ConfigEntry<NoiseSuppressionLevels> denoise = ((BasePlugin)this).Config.Bind<NoiseSuppressionLevels>("Music", "Denoise", (NoiseSuppressionLevels)(-1), new ConfigDescription("How much background hiss to remove while music mode is on. Keep it on Disabled for music — higher settings can dull the sound.", (AcceptableValueBase)null, new object[1] { ModSettingsTags.Entry((int?)20, (double?)null) }));
			ConfigEntry<bool> bgRemoval = ((BasePlugin)this).Config.Bind<bool>("Music", "BackgroundRemoval", false, new ConfigDescription("Removes background sounds while music mode is on. Keep this off for music, or the music itself may fade in and out.", (AcceptableValueBase)null, new object[1] { ModSettingsTags.Entry((int?)30, (double?)null) }));
			ConfigEntry<float> bgAmount = ((BasePlugin)this).Config.Bind<float>("Music", "BackgroundRemovalAmount", 0f, new ConfigDescription("How strongly background sounds are removed. Only does anything if Background Removal (above) is on.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), new object[1] { ModSettingsTags.Entry((int?)40, (double?)0.05) }));
			ConfigEntry<bool> overlay = ((BasePlugin)this).Config.Bind<bool>("Music", "Overlay", false, new ConfigDescription("On-screen HUD with live VU meter readout: music state, transmitting state, audio level in dB, and DSP values.", (AcceptableValueBase)null, new object[1] { ModSettingsTags.Entry((int?)80, (double?)null) }));
			ConfigEntry<bool> diagnostics = ((BasePlugin)this).Config.Bind<bool>("Music", "Diagnostics", false, new ConfigDescription("Writes a status line to the game log once per second while music mode is on, so you can confirm it stays in always-transmit mode.", (AcceptableValueBase)null, new object[1] { ModSettingsTags.Entry((int?)50, (double?)null) }));
			ConfigEntry<KeyCode> toggleKey = ((BasePlugin)this).Config.Bind<KeyCode>("Input", "ToggleKey", (KeyCode)290, new ConfigDescription("Keyboard shortcut that turns Music Mode on and off. (It does not change the master Enabled switch.)", (AcceptableValueBase)null, new object[2]
			{
				ModSettingsTags.Section("Input", (int?)30),
				ModSettingsTags.Entry((int?)10, (double?)null)
			}));
			ModSettingsRegistry.Register("walker.bigdj", new ModSettingsModOptions
			{
				Name = "Big DJ",
				Description = "Music mode for voice chat: steady transmission with Island Radio 2D, dry acoustics, and live VU monitoring.",
				Version = "1.2.1"
			});
			Dj.Bind(enabled, musicMode, mode, preset, denoise, bgRemoval, bgAmount, dryAcoustics, diagnostics, toggleKey, overlay);
			((BasePlugin)this).AddComponent<Dj>();
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(15, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("BigDJ v");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.2.1");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded.");
			}
			log.LogInfo(val);
		}
	}
}