Decompiled source of EypoNoiseSuppression v1.0.0

BepInEx/plugins/EypoNoiseRemoval.dll

Decompiled 10 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using Dissonance.Config;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("EypoNoiseRemoval")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EypoNoiseRemoval")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e936bbd2-f177-4265-a11d-583d12f31d70")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace EypoSuits;

[BepInPlugin("EypoRage.EypoNoiseRemoval", "Eypo Noise Removal", "1.0.0")]
public class EypoNoiseRemoval : BaseUnityPlugin
{
	private const string modGUID = "EypoRage.EypoNoiseRemoval";

	private const string modName = "Eypo Noise Removal";

	private const string modVersion = "1.0.0";

	private readonly Harmony harmony = new Harmony("EypoRage.EypoNoiseRemoval");

	private static EypoNoiseRemoval Instance;

	public static bool ActivateSupression;

	public static float SuppressionAmount;

	public static List<Material> customMaterials = new List<Material>();

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		ActivateSupression = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Noise Suppression", true, "Activates Noise removal").Value;
		SuppressionAmount = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Suppression Amount", 1f, "Sets the amount of Noise Suppression from 0 to 1 floating point").Value;
		VoiceSettings.Instance.BackgroundSoundRemovalEnabled = ActivateSupression;
		VoiceSettings.Instance.BackgroundSoundRemovalAmount = SuppressionAmount;
		((BaseUnityPlugin)this).Logger.LogInfo((object)$"Eypo Noise suppression is {getSuppression()}");
		((BaseUnityPlugin)this).Logger.LogInfo((object)$"Eypo Noise suppression amount is {getSuppressionAmount()}");
		harmony.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Eypo Noise Removal is loaded!");
	}

	internal static bool getSuppression()
	{
		return VoiceSettings.Instance.BackgroundSoundRemovalEnabled;
	}

	internal static void setSuppression(bool state)
	{
		VoiceSettings.Instance.BackgroundSoundRemovalEnabled = state;
	}

	internal static float getSuppressionAmount()
	{
		return VoiceSettings.Instance.BackgroundSoundRemovalAmount;
	}

	internal static void setSuppressionAmount(float amount)
	{
		VoiceSettings.Instance.BackgroundSoundRemovalAmount = amount;
	}

	internal static void increaseSuppressionAmount()
	{
		VoiceSettings.Instance.BackgroundSoundRemovalAmount = VoiceSettings.Instance.BackgroundSoundRemovalAmount + 0.1f;
	}

	internal static void decreaseSuppressionAmount()
	{
		VoiceSettings.Instance.BackgroundSoundRemovalAmount = VoiceSettings.Instance.BackgroundSoundRemovalAmount - 0.1f;
	}
}