Decompiled source of Peak Suppression v1.0.0

PeakSuppression.dll

Decompiled 14 hours ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Photon.Voice.Unity;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("NoiseSuppression")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoiseSuppression")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c99807f0-dbec-4945-968a-6be06a6d91f2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace VoiceNoiseSuppressionMod;

[BepInPlugin("com.hiccup.voicesuppression", "Voice Noise Suppression Mod", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private Harmony _harmony;

	private void Awake()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Voice Noise Suppression Mod initializing...");
		_harmony = new Harmony("com.hiccup.voicesuppression");
		_harmony.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Voice Noise Suppression Mod initialized.");
	}

	private void OnDestroy()
	{
		_harmony.UnpatchSelf();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Voice Noise Suppression Mod unloaded.");
	}
}
[HarmonyPatch(typeof(Recorder), "RestartRecording")]
public static class Recorder_RestartRecording_Patch
{
	[HarmonyPrefix]
	public static void Prefix(Recorder __instance)
	{
		if (!((Object)(object)__instance == (Object)null))
		{
			WebRtcAudioDsp val = ((Component)__instance).GetComponent<WebRtcAudioDsp>();
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)__instance).gameObject.AddComponent<WebRtcAudioDsp>();
				Debug.Log((object)"[VoiceNoiseSuppressionMod] Added WebRtcAudioDsp component.");
			}
			val.AGC = true;
			val.NoiseSuppression = true;
			val.AEC = true;
			Debug.Log((object)"[VoiceNoiseSuppressionMod] Enabled Noise Suppression, Echo Cancellation, and AGC.");
		}
	}
}