using System; using System.Buffers; using System.Collections; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using System.Threading; using System.Threading.Channels; using System.Threading.Tasks; using .$Mirage.Core.Audio.Microphone; using Collections.Pooled; using Concentus; using Concentus.Enums; using Concentus.Oggfile; using Concentus.Structs; using FSharpPlus; using FSharpPlus.Control; using IcedTasks; using Microsoft.FSharp.Core; using Microsoft.FSharp.Core.CompilerServices; using Mirage.Core.Audio; using Mirage.Core.Audio.Opus; using Mirage.Core.Task; using NAudio.Dsp; using OpusDotNet; [assembly: FSharpInterfaceDataVersion(2, 0, 0)] [assembly: IgnoresAccessChecksTo("NAudio.Core")] [assembly: IgnoresAccessChecksTo("NAudio")] [assembly: IgnoresAccessChecksTo("OpusDotNet")] [assembly: AssemblyCompany("Mirage.Core")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+b678040b73b05cff93508fa92e44b83f62cc77c0")] [assembly: AssemblyProduct("Mirage.Core")] [assembly: AssemblyTitle("Mirage.Core")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [CompilationMapping(/*Could not decode attribute arguments.*/)] public static class AssemblyInfo { } namespace { internal static class $AssemblyInfo { } } namespace Mirage.Core.Audio.Microphone { [CompilationMapping(/*Could not decode attribute arguments.*/)] public static class Recognition { } } namespace .$Mirage.Core.Audio.Microphone { internal static class Recognition { } } namespace Mirage.Core.Audio.Microphone { [CompilationMapping(/*Could not decode attribute arguments.*/)] public static class Recorder { [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public sealed class Recorder : IEquatable>, IStructuralEquatable { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal Mirage.Core.Task.Channel.Channel<(State, Detection.DetectAction)> channel@; [CompilationMapping(/*Could not decode attribute arguments.*/)] public Mirage.Core.Task.Channel.Channel<(State, Detection.DetectAction)> channel { [CompilerGenerated] [DebuggerNonUserCode] get { return channel@; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(Recorder<>))] public Recorder(Mirage.Core.Task.Channel.Channel<(State, Detection.DetectAction)> channel) { channel@ = channel; } [CompilerGenerated] public override string ToString() { return ((FSharpFunc>, string>)(object)ExtraTopLevelOperators.PrintFormatToString, string>>((PrintfFormat, string>, Unit, string, string>)(object)new PrintfFormat, string>>, string>, Unit, string, string, Recorder, string>>>("%+A"))).Invoke((Recorder>)(object)this); } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { if (this != null) { int num = 0; return -1640531527 + (channel@.GetHashCode(comp) + ((num << 6) + (num >> 2))); } return 0; } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(Recorder obj, IEqualityComparer comp) { if (this != null) { if (obj != null) { Mirage.Core.Task.Channel.Channel<(State, Detection.DetectAction)> channel = channel@; Mirage.Core.Task.Channel.Channel<(State, Detection.DetectAction)> obj2 = obj.channel@; return channel.Equals(obj2, comp); } return false; } return obj == null; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is Recorder obj2) { return Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(Recorder obj) { if (this != null) { if (obj != null) { return channel@.Equals(obj.channel@); } return false; } return obj == null; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is Recorder obj2) { return Equals(obj2); } return false; } } [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public sealed class RecorderArgs { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal int minAudioDurationMs@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal string directory@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal FSharpFunc allowRecordVoice@; [CompilationMapping(/*Could not decode attribute arguments.*/)] public int minAudioDurationMs { [CompilerGenerated] [DebuggerNonUserCode] get { return minAudioDurationMs@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public string directory { [CompilerGenerated] [DebuggerNonUserCode] get { return directory@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public FSharpFunc allowRecordVoice { [CompilerGenerated] [DebuggerNonUserCode] get { return allowRecordVoice@; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(RecorderArgs<>))] public RecorderArgs(int minAudioDurationMs, string directory, FSharpFunc allowRecordVoice) { minAudioDurationMs@ = minAudioDurationMs; directory@ = directory; allowRecordVoice@ = allowRecordVoice; } [CompilerGenerated] public override string ToString() { return ((FSharpFunc>, string>)(object)ExtraTopLevelOperators.PrintFormatToString, string>>((PrintfFormat, string>, Unit, string, string>)(object)new PrintfFormat, string>>, string>, Unit, string, string, RecorderArgs, string>>>("%+A"))).Invoke((RecorderArgs>)(object)this); } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct consumer@31-7 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public RecorderArgs args; public Mirage.Core.Task.Channel.Channel<(a, Detection.DetectAction)> channel; public ValueTaskAwaiter<(a, Detection.DetectAction)> awaiter; public override void MoveNext() { int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex2 = default(Exception); Exception ex; try { bool flag; int num; bool flag2; switch (resumptionPoint) { default: awaiter = channel.reader@.ReadAsync(channel.cancellationToken@).GetAwaiter(); flag = true; if (awaiter.IsCompleted) { break; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_0076; case 1: { num = 1; goto IL_0076; } IL_0076: flag2 = (byte)num != 0; flag = flag2; break; } int num2; if (!flag) { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; goto IL_01f9; } var (val, detectAction) = awaiter.GetResult(); if (detectAction.Tag == 1) { Detection.DetectEnd detectEnd = detectAction.detectEnd; if (detectEnd.audioDurationMs@ >= args.minAudioDurationMs@ && args.allowRecordVoice@.Invoke(val)) { Guid guid = Guid.NewGuid(); Writer.OpusWriter opusWriter = Writer.OpusWriter(new Writer.OpusWriterArgs(Path.Join((ReadOnlySpan)args.directory@, (ReadOnlySpan)(string?)PrintfModule.PrintFormatToStringThen((PrintfFormat)(object)new PrintfFormat("%P().opus", new object[1] { guid }, (Type[])null))), detectEnd.fullAudio@.original@.format@)); flag2 = false; flag2 = flag2 || flag2; try { Writer.writeOpusSamples(opusWriter, detectEnd.fullAudio@.original@.samples@); Writer.closeOpusWriter(opusWriter); bool flag3 = true; flag2 = flag3; } catch (object obj) { ex = (Exception)obj; compensation@1-1(detectEnd, opusWriter, null); bool flag3 = true; throw; } if (flag2) { compensation@1-1(detectEnd, opusWriter, null); bool flag3 = true; } num2 = (flag2 ? 1 : 0); goto IL_01f9; } } goto IL_01fb; IL_01f9: if (num2 != 0) { goto IL_01fb; } goto end_IL_0019; IL_01fb: ValueTaskAwaiter<(a, Detection.DetectAction)> valueTaskAwaiter = default(ValueTaskAwaiter<(a, Detection.DetectAction)>); awaiter = valueTaskAwaiter; if (true) { Data.MethodBuilder.SetResult(Data.Result); } end_IL_0019:; } catch (object obj2) { ex = (Exception)obj2; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct consumer@31-8 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public RecorderArgs args; public Mirage.Core.Task.Channel.Channel<(a, Detection.DetectAction)> channel; public ValueTaskAwaiter awaiter; public override void MoveNext() { int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex2 = default(Exception); Exception ex; try { bool flag; int num; bool flag2; bool flag3; int num2; int num3; bool flag4; switch (resumptionPoint) { default: flag = true; goto IL_00db; case 1: { num = 1; goto IL_0075; } IL_00db: if (flag) { awaiter = program@7-3(args, channel, null).GetAwaiter(); flag2 = true; if (awaiter.IsCompleted) { goto IL_007f; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_0075; } if (flag) { Data.MethodBuilder.SetResult(Data.Result); } break; IL_0075: flag3 = (byte)num != 0; flag2 = flag3; goto IL_007f; IL_007f: if (flag2) { awaiter.GetResult(); _ = null; num2 = 1; } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } if (num2 != 0) { awaiter = default(ValueTaskAwaiter); num3 = 1; } else { num3 = 0; } flag4 = (byte)num3 != 0; flag = flag4; resumptionPoint = 0; goto IL_00db; } } catch (object obj) { ex = (Exception)obj; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] internal sealed class consumer@31-6 : FSharpFunc> { public RecorderArgs args; public Mirage.Core.Task.Channel.Channel<(a, Detection.DetectAction)> channel; [CompilerGenerated] [DebuggerNonUserCode] internal consumer@31-6(RecorderArgs args, Mirage.Core.Task.Channel.Channel<(a, Detection.DetectAction)> channel) { this.args = args; this.channel = channel; } public override ValueTask Invoke(Unit unitVar0) { consumer@31-8 stateMachine = default(consumer@31-8); stateMachine.args = args; stateMachine.channel = channel; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct Recorder@51-2 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public FSharpFunc> program; public Mirage.Core.Task.Channel.Channel> channel; public ValueTaskAwaiter awaiter; public override void MoveNext() { //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex3 = default(Exception); Exception ex = default(Exception); try { bool flag2 = default(bool); bool flag = default(bool); switch (resumptionPoint) { default: flag = false; flag2 = false; ex = null; flag = flag || flag; break; case 1: break; } try { bool flag3; int num; bool flag4; switch (resumptionPoint) { default: awaiter = program.Invoke((Unit)null).GetAwaiter(); flag3 = true; if (awaiter.IsCompleted) { break; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_008c; case 1: { num = 1; goto IL_008c; } IL_008c: flag4 = (byte)num != 0; flag3 = flag4; break; } int num2; if (flag3) { awaiter.GetResult(); _ = null; FSharpResult item = FSharpResult.NewOk((Unit)null); ValueTask valueTask = channel.writer@.WriteAsync(item, channel.cancellationToken@); num2 = 1; } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } int num3; if (num2 != 0) { ValueTaskAwaiter valueTaskAwaiter = default(ValueTaskAwaiter); awaiter = valueTaskAwaiter; num3 = 1; } else { num3 = 0; } bool flag5 = (byte)num3 != 0; flag = flag5; } catch (object obj) { Exception ex2 = (Exception)obj; flag2 = true; ex = ex2; } int num4; if (flag2) { Exception ex2 = ex; FSharpResult item = FSharpResult.NewError(ex2); ValueTask valueTask = channel.writer@.WriteAsync(item, channel.cancellationToken@); num4 = 1; } else { num4 = (flag ? 1 : 0); } if (num4 != 0) { Data.MethodBuilder.SetResult(Data.Result); } } catch (object obj2) { ex = (Exception)obj2; ex3 = ex; } ex = ex3; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal sealed class Recorder@51-3 { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public FSharpFunc> program; [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public Mirage.Core.Task.Channel.Channel> channel; public Recorder@51-3(FSharpFunc> program, Mirage.Core.Task.Channel.Channel> channel) { this.program = program; this.channel = channel; base..ctor(); } internal ValueTask Invoke() { return thread@12-5(program, channel, null); } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct Recorder@51-1 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public CancellationToken cancellationToken; public FSharpFunc> program; public ValueTaskAwaiter> awaiter; public override void MoveNext() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex2 = default(Exception); Exception ex; try { bool flag; int num; bool flag2; switch (resumptionPoint) { default: { Mirage.Core.Task.Channel.Channel> channel = Mirage.Core.Task.Channel.Channel>(cancellationToken); Task> task = System.Threading.Tasks.Task.Run((Func>)new Recorder@51-3(program, channel).Invoke, cancellationToken); awaiter = channel.reader@.ReadAsync(channel.cancellationToken@).GetAwaiter(); flag = true; if (awaiter.IsCompleted) { break; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_009d; } case 1: { num = 1; goto IL_009d; } IL_009d: flag2 = (byte)num != 0; flag = flag2; break; } int num2; if (flag) { FSharpResult result = awaiter.GetResult(); FSharpResult val = result; if (val.Tag != 0) { throw val.ErrorValue; } _ = val.ResultValue; Data.Result = null; num2 = 1; } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } if (num2 != 0) { ValueTaskAwaiter> valueTaskAwaiter = default(ValueTaskAwaiter>); awaiter = valueTaskAwaiter; if (true) { Data.MethodBuilder.SetResult(Data.Result); } } } catch (object obj) { ex = (Exception)obj; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] internal sealed class Recorder@51-4 : FSharpFunc>, Unit> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public CancellationToken cancellationToken; [CompilerGenerated] [DebuggerNonUserCode] internal Recorder@51-4(CancellationToken cancellationToken) { this.cancellationToken = cancellationToken; } public override Unit Invoke(FSharpFunc> x) { ValueTask valueTask = func1@1-2(cancellationToken, x); return null; } } [Serializable] internal sealed class Recorder@51 : FSharpFunc>, Unit>> { internal static readonly Recorder@51 @_instance = new Recorder@51(); [CompilerGenerated] [DebuggerNonUserCode] internal Recorder@51() { } public override FSharpFunc>, Unit> Invoke(CancellationToken cancellationToken) { return new Recorder@51-4(cancellationToken); } } [Serializable] internal sealed class writeRecorder@54 : FSharpFunc<(a, Detection.DetectAction), Unit> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public Mirage.Core.Task.Channel.Channel<(a, Detection.DetectAction)> channel; [CompilerGenerated] [DebuggerNonUserCode] internal writeRecorder@54(Mirage.Core.Task.Channel.Channel<(a, Detection.DetectAction)> channel) { ((FSharpFunc<((a, Detection.DetectAction), Detection.DetectAction), Unit>)(object)this)..ctor(); this.channel = channel; } public override Unit Invoke((a, Detection.DetectAction) element) { ValueTask valueTask = channel.writer@.WriteAsync(element, channel.cancellationToken@); return null; } } [CompilerGenerated] internal static void compensation@1-1(Detection.DetectEnd payload, Writer.OpusWriter opusWriter, Unit unitVar) { ArrayPool.Shared.Return(payload.fullAudio@.original@.samples@.data@); ArrayPool.Shared.Return(payload.fullAudio@.resampled@.samples@.data@); Operators.dispose((IDisposable)opusWriter); } [CompilerGenerated] internal static ValueTask program@7-3(RecorderArgs args, Mirage.Core.Task.Channel.Channel<(a, Detection.DetectAction)> channel, Unit unitVar0) { consumer@31-7 stateMachine = default(consumer@31-7); stateMachine.args = args; stateMachine.channel = channel; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } [CompilerGenerated] internal static ValueTask thread@12-5(FSharpFunc> program, Mirage.Core.Task.Channel.Channel> channel, Unit unitVar0) { Recorder@51-2 stateMachine = default(Recorder@51-2); stateMachine.program = program; stateMachine.channel = channel; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } [CompilerGenerated] internal static ValueTask func1@1-2(CancellationToken cancellationToken, FSharpFunc> program) { Recorder@51-1 stateMachine = default(Recorder@51-1); stateMachine.cancellationToken = cancellationToken; stateMachine.program = program; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } public static Recorder Recorder(RecorderArgs args) { Mirage.Core.Task.Channel.Channel<(a, Detection.DetectAction)> channel = Mirage.Core.Task.Channel.Channel<(a, Detection.DetectAction)>(CancellationToken.None); FSharpFunc> val = new consumer@31-6(args, channel); FSharpFunc>>.InvokeFast((FSharpFunc>, Unit>>)Recorder@51.@_instance, CancellationToken.None, val); return new Recorder(channel); } public static FSharpFunc<(a, Detection.DetectAction), Unit> writeRecorder(Recorder recorder) { Mirage.Core.Task.Channel.Channel<(a, Detection.DetectAction)> channel@ = recorder.channel@; return new writeRecorder@54(channel@); } } } namespace .$Mirage.Core.Audio.Microphone { internal static class Recorder { } } namespace Mirage.Core.Audio.Microphone { [CompilationMapping(/*Could not decode attribute arguments.*/)] public static class Detection { [Serializable] [Struct] [CompilationMapping(/*Could not decode attribute arguments.*/)] public struct VADFrame : IEquatable, IStructuralEquatable, IComparable, IComparable, IStructuralComparable { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal int elapsedTime@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal float probability@; [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly int elapsedTime { [CompilerGenerated] [DebuggerNonUserCode] get { return elapsedTime@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly float probability { [CompilerGenerated] [DebuggerNonUserCode] get { return probability@; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(VADFrame))] public VADFrame(int elapsedTime, float probability) { elapsedTime@ = elapsedTime; probability@ = probability; } [CompilerGenerated] public override string ToString() { return ExtraTopLevelOperators.PrintFormatToString>((PrintfFormat, Unit, string, string>)(object)new PrintfFormat, Unit, string, string, VADFrame>("%+A")).Invoke(this); } [CompilerGenerated] public sealed int CompareTo(VADFrame obj) { IComparer genericComparer = LanguagePrimitives.GenericComparer; int num = elapsedTime@; int num2 = obj.elapsedTime@; int num3 = ((num > num2) ? 1 : 0) - ((num < num2) ? 1 : 0); if (num3 < 0) { return num3; } if (num3 > 0) { return num3; } genericComparer = LanguagePrimitives.GenericComparer; float num4 = probability@; float num5 = obj.probability@; if (num4 < num5) { return -1; } if (num4 > num5) { return 1; } if (num4 == num5) { return 0; } return HashCompare.GenericComparisonWithComparerIntrinsic(genericComparer, num4, num5); } [CompilerGenerated] public sealed int CompareTo(object obj) { return CompareTo((VADFrame)obj); } [CompilerGenerated] public sealed int CompareTo(object obj, IComparer comp) { VADFrame vADFrame = (VADFrame)obj; int num = elapsedTime@; int num2 = vADFrame.elapsedTime@; int num3 = ((num > num2) ? 1 : 0) - ((num < num2) ? 1 : 0); if (num3 < 0) { return num3; } if (num3 > 0) { return num3; } float num4 = probability@; float num5 = vADFrame.probability@; if (num4 < num5) { return -1; } if (num4 > num5) { return 1; } if (num4 == num5) { return 0; } return HashCompare.GenericComparisonWithComparerIntrinsic(comp, num4, num5); } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { int num = 0; num = -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic(comp, probability@) + ((num << 6) + (num >> 2))); return -1640531527 + (elapsedTime@ + ((num << 6) + (num >> 2))); } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(VADFrame obj, IEqualityComparer comp) { if (elapsedTime@ == obj.elapsedTime@) { return probability@ == obj.probability@; } return false; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is VADFrame obj2) { return Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(VADFrame obj) { if (elapsedTime@ == obj.elapsedTime@) { float num = probability@; float num2 = obj.probability@; if (num == num2) { return true; } if (num != num) { return num2 != num2; } return false; } return false; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is VADFrame) { return Equals((VADFrame)obj); } return false; } } [Serializable] [Struct] [CompilationMapping(/*Could not decode attribute arguments.*/)] public struct DetectStart : IEquatable, IStructuralEquatable, IComparable, IComparable, IStructuralComparable { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal PCM.WaveFormat originalFormat@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal PCM.WaveFormat resampledFormat@; [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly PCM.WaveFormat originalFormat { [CompilerGenerated] [DebuggerNonUserCode] get { return originalFormat@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly PCM.WaveFormat resampledFormat { [CompilerGenerated] [DebuggerNonUserCode] get { return resampledFormat@; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(DetectStart))] public DetectStart(PCM.WaveFormat originalFormat, PCM.WaveFormat resampledFormat) { originalFormat@ = originalFormat; resampledFormat@ = resampledFormat; } [CompilerGenerated] public override string ToString() { return ExtraTopLevelOperators.PrintFormatToString>((PrintfFormat, Unit, string, string>)(object)new PrintfFormat, Unit, string, string, DetectStart>("%+A")).Invoke(this); } [CompilerGenerated] public sealed int CompareTo(DetectStart obj) { IComparer genericComparer = LanguagePrimitives.GenericComparer; PCM.WaveFormat waveFormat = originalFormat@; PCM.WaveFormat waveFormat2 = obj.originalFormat@; int num = waveFormat.CompareTo(waveFormat2, genericComparer); if (num < 0) { return num; } if (num > 0) { return num; } genericComparer = LanguagePrimitives.GenericComparer; waveFormat = resampledFormat@; waveFormat2 = obj.resampledFormat@; return waveFormat.CompareTo(waveFormat2, genericComparer); } [CompilerGenerated] public sealed int CompareTo(object obj) { return CompareTo((DetectStart)obj); } [CompilerGenerated] public sealed int CompareTo(object obj, IComparer comp) { DetectStart detectStart = (DetectStart)obj; PCM.WaveFormat waveFormat = originalFormat@; PCM.WaveFormat waveFormat2 = detectStart.originalFormat@; int num = waveFormat.CompareTo(waveFormat2, comp); if (num < 0) { return num; } if (num > 0) { return num; } waveFormat = resampledFormat@; waveFormat2 = detectStart.resampledFormat@; return waveFormat.CompareTo(waveFormat2, comp); } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { int num = 0; PCM.WaveFormat waveFormat = resampledFormat@; num = -1640531527 + (waveFormat.GetHashCode(comp) + ((num << 6) + (num >> 2))); waveFormat = originalFormat@; return -1640531527 + (waveFormat.GetHashCode(comp) + ((num << 6) + (num >> 2))); } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(DetectStart obj, IEqualityComparer comp) { PCM.WaveFormat waveFormat = originalFormat@; PCM.WaveFormat obj2 = obj.originalFormat@; if (waveFormat.Equals(obj2, comp)) { waveFormat = resampledFormat@; obj2 = obj.resampledFormat@; return waveFormat.Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is DetectStart obj2) { return Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(DetectStart obj) { PCM.WaveFormat waveFormat = originalFormat@; if (waveFormat.Equals(obj.originalFormat@)) { waveFormat = resampledFormat@; return waveFormat.Equals(obj.resampledFormat@); } return false; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is DetectStart) { return Equals((DetectStart)obj); } return false; } } [Serializable] [Struct] [CompilationMapping(/*Could not decode attribute arguments.*/)] public struct DetectEnd : IEquatable, IStructuralEquatable, IComparable, IComparable, IStructuralComparable { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal int audioDurationMs@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal Resampler.ResampledAudio fullAudio@; [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly int audioDurationMs { [CompilerGenerated] [DebuggerNonUserCode] get { return audioDurationMs@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly Resampler.ResampledAudio fullAudio { [CompilerGenerated] [DebuggerNonUserCode] get { return fullAudio@; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(DetectEnd))] public DetectEnd(int audioDurationMs, Resampler.ResampledAudio fullAudio) { audioDurationMs@ = audioDurationMs; fullAudio@ = fullAudio; } [CompilerGenerated] public override string ToString() { return ExtraTopLevelOperators.PrintFormatToString>((PrintfFormat, Unit, string, string>)(object)new PrintfFormat, Unit, string, string, DetectEnd>("%+A")).Invoke(this); } [CompilerGenerated] public sealed int CompareTo(DetectEnd obj) { IComparer genericComparer = LanguagePrimitives.GenericComparer; int num = audioDurationMs@; int num2 = obj.audioDurationMs@; int num3 = ((num > num2) ? 1 : 0) - ((num < num2) ? 1 : 0); if (num3 < 0) { return num3; } if (num3 > 0) { return num3; } genericComparer = LanguagePrimitives.GenericComparer; Resampler.ResampledAudio resampledAudio = fullAudio@; Resampler.ResampledAudio resampledAudio2 = obj.fullAudio@; return resampledAudio.CompareTo(resampledAudio2, genericComparer); } [CompilerGenerated] public sealed int CompareTo(object obj) { return CompareTo((DetectEnd)obj); } [CompilerGenerated] public sealed int CompareTo(object obj, IComparer comp) { DetectEnd detectEnd = (DetectEnd)obj; int num = audioDurationMs@; int num2 = detectEnd.audioDurationMs@; int num3 = ((num > num2) ? 1 : 0) - ((num < num2) ? 1 : 0); if (num3 < 0) { return num3; } if (num3 > 0) { return num3; } Resampler.ResampledAudio resampledAudio = fullAudio@; Resampler.ResampledAudio resampledAudio2 = detectEnd.fullAudio@; return resampledAudio.CompareTo(resampledAudio2, comp); } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { int num = 0; Resampler.ResampledAudio resampledAudio = fullAudio@; num = -1640531527 + (resampledAudio.GetHashCode(comp) + ((num << 6) + (num >> 2))); return -1640531527 + (audioDurationMs@ + ((num << 6) + (num >> 2))); } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(DetectEnd obj, IEqualityComparer comp) { if (audioDurationMs@ == obj.audioDurationMs@) { Resampler.ResampledAudio resampledAudio = fullAudio@; Resampler.ResampledAudio obj2 = obj.fullAudio@; return resampledAudio.Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is DetectEnd obj2) { return Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(DetectEnd obj) { if (audioDurationMs@ == obj.audioDurationMs@) { Resampler.ResampledAudio resampledAudio = fullAudio@; return resampledAudio.Equals(obj.fullAudio@); } return false; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is DetectEnd) { return Equals((DetectEnd)obj); } return false; } } [Serializable] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] [Struct] [DebuggerDisplay("{__DebugDisplay(),nq}")] [CompilationMapping(/*Could not decode attribute arguments.*/)] public struct DetectAction : IEquatable, IStructuralEquatable, IComparable, IComparable, IStructuralComparable { public static class Tags { public const int DetectStart = 0; public const int DetectEnd = 1; } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] [field: DebuggerNonUserCode] public int Tag { [DebuggerNonUserCode] get; } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public bool IsDetectStart { [CompilerGenerated] [DebuggerNonUserCode] get { return Tag == 0; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public bool IsDetectEnd { [CompilerGenerated] [DebuggerNonUserCode] get { return Tag == 1; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] [field: DebuggerNonUserCode] public DetectStart detectStart { [DebuggerNonUserCode] get; } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] [field: DebuggerNonUserCode] public DetectEnd detectEnd { [DebuggerNonUserCode] get; } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public static DetectAction NewDetectStart(DetectStart _detectStart) { DetectAction result = default(DetectAction); result.detectStart = _detectStart; return result; } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public static DetectAction NewDetectEnd(DetectEnd _detectEnd) { DetectAction result = default(DetectAction); result._tag = 1; result.detectEnd = _detectEnd; return result; } [SpecialName] [CompilerGenerated] [DebuggerNonUserCode] internal object __DebugDisplay() { return ExtraTopLevelOperators.PrintFormatToString>((PrintfFormat, Unit, string, string>)(object)new PrintfFormat, Unit, string, string, string>("%+0.8A")).Invoke(this); } [CompilerGenerated] public override string ToString() { return ExtraTopLevelOperators.PrintFormatToString>((PrintfFormat, Unit, string, string>)(object)new PrintfFormat, Unit, string, string, DetectAction>("%+A")).Invoke(this); } [CompilerGenerated] public sealed int CompareTo(DetectAction obj) { int tag = _tag; int tag2 = obj._tag; if (tag == tag2) { IComparer genericComparer; if (Tag == 0) { genericComparer = LanguagePrimitives.GenericComparer; DetectStart detectStart = this.detectStart; DetectStart detectStart2 = obj.detectStart; return detectStart.CompareTo(detectStart2, genericComparer); } genericComparer = LanguagePrimitives.GenericComparer; DetectEnd detectEnd = this.detectEnd; DetectEnd detectEnd2 = obj.detectEnd; return detectEnd.CompareTo(detectEnd2, genericComparer); } return tag - tag2; } [CompilerGenerated] public sealed int CompareTo(object obj) { return CompareTo((DetectAction)obj); } [CompilerGenerated] public sealed int CompareTo(object obj, IComparer comp) { DetectAction detectAction = (DetectAction)obj; int tag = _tag; int tag2 = detectAction._tag; if (tag == tag2) { if (Tag == 0) { DetectStart detectStart = this.detectStart; DetectStart detectStart2 = detectAction.detectStart; return detectStart.CompareTo(detectStart2, comp); } DetectEnd detectEnd = this.detectEnd; DetectEnd detectEnd2 = detectAction.detectEnd; return detectEnd.CompareTo(detectEnd2, comp); } return tag - tag2; } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { int num = 0; if (Tag == 0) { num = 0; DetectStart detectStart = this.detectStart; return -1640531527 + (detectStart.GetHashCode(comp) + ((num << 6) + (num >> 2))); } num = 1; DetectEnd detectEnd = this.detectEnd; return -1640531527 + (detectEnd.GetHashCode(comp) + ((num << 6) + (num >> 2))); } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(DetectAction obj, IEqualityComparer comp) { int tag = _tag; int tag2 = obj._tag; if (tag == tag2) { if (Tag == 0) { DetectStart detectStart = this.detectStart; DetectStart obj2 = obj.detectStart; return detectStart.Equals(obj2, comp); } DetectEnd detectEnd = this.detectEnd; DetectEnd obj3 = obj.detectEnd; return detectEnd.Equals(obj3, comp); } return false; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is DetectAction obj2) { return Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(DetectAction obj) { int tag = _tag; int tag2 = obj._tag; if (tag == tag2) { if (Tag == 0) { DetectStart detectStart = this.detectStart; return detectStart.Equals(obj.detectStart); } DetectEnd detectEnd = this.detectEnd; return detectEnd.Equals(obj.detectEnd); } return false; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is DetectAction) { return Equals((DetectAction)obj); } return false; } } [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public sealed class VoiceDetector : IEquatable>, IStructuralEquatable { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal Mirage.Core.Task.Channel.Channel> channel@; [CompilationMapping(/*Could not decode attribute arguments.*/)] public Mirage.Core.Task.Channel.Channel> channel { [CompilerGenerated] [DebuggerNonUserCode] get { return channel@; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(VoiceDetector<>))] public VoiceDetector(Mirage.Core.Task.Channel.Channel> channel) { channel@ = channel; } [CompilerGenerated] public override string ToString() { return ((FSharpFunc>, string>)(object)ExtraTopLevelOperators.PrintFormatToString, string>>((PrintfFormat, string>, Unit, string, string>)(object)new PrintfFormat, string>>, string>, Unit, string, string, VoiceDetector, string>>>("%+A"))).Invoke((VoiceDetector>)(object)this); } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { if (this != null) { int num = 0; return -1640531527 + (channel@.GetHashCode(comp) + ((num << 6) + (num >> 2))); } return 0; } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(VoiceDetector obj, IEqualityComparer comp) { if (this != null) { if (obj != null) { Mirage.Core.Task.Channel.Channel> channel = channel@; Mirage.Core.Task.Channel.Channel> obj2 = obj.channel@; return channel.Equals(obj2, comp); } return false; } return obj == null; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is VoiceDetector obj2) { return Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(VoiceDetector obj) { if (this != null) { if (obj != null) { return channel@.Equals(obj.channel@); } return false; } return obj == null; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is VoiceDetector obj2) { return Equals(obj2); } return false; } } [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public sealed class VoiceDetectorArgs { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal int minSilenceDurationMs@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal FSharpFunc> forcedProbability@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal float startThreshold@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal float endThreshold@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal FSharpFunc> detectSpeech@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal FSharpFunc> onVoiceDetected@; [CompilationMapping(/*Could not decode attribute arguments.*/)] public int minSilenceDurationMs { [CompilerGenerated] [DebuggerNonUserCode] get { return minSilenceDurationMs@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public FSharpFunc> forcedProbability { [CompilerGenerated] [DebuggerNonUserCode] get { return forcedProbability@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public float startThreshold { [CompilerGenerated] [DebuggerNonUserCode] get { return startThreshold@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public float endThreshold { [CompilerGenerated] [DebuggerNonUserCode] get { return endThreshold@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public FSharpFunc> detectSpeech { [CompilerGenerated] [DebuggerNonUserCode] get { return detectSpeech@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public FSharpFunc> onVoiceDetected { [CompilerGenerated] [DebuggerNonUserCode] get { return onVoiceDetected@; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(VoiceDetectorArgs<>))] public VoiceDetectorArgs(int minSilenceDurationMs, FSharpFunc> forcedProbability, float startThreshold, float endThreshold, FSharpFunc> detectSpeech, FSharpFunc> onVoiceDetected) { minSilenceDurationMs@ = minSilenceDurationMs; forcedProbability@ = forcedProbability; startThreshold@ = startThreshold; endThreshold@ = endThreshold; detectSpeech@ = detectSpeech; onVoiceDetected@ = onVoiceDetected; } [CompilerGenerated] public override string ToString() { return ((FSharpFunc>, string>)(object)ExtraTopLevelOperators.PrintFormatToString, string>>((PrintfFormat, string>, Unit, string, string>)(object)new PrintfFormat, string>>, string>, Unit, string, string, VoiceDetectorArgs, string>>>("%+A"))).Invoke((VoiceDetectorArgs>)(object)this); } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct consumer@83-4 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public VoiceDetectorArgs args; public float minSilenceSamples; public Mirage.Core.Task.Channel.Channel> channel; public <>f__AnonymousType2762740774, PooledList> samples; public FSharpRef currentIndex; public FSharpRef endIndex; public FSharpRef voiceDetected; public ValueTaskAwaiter> awaiter; public override void MoveNext() { //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex2 = default(Exception); Exception ex; try { bool flag; int num; bool flag2; switch (resumptionPoint) { default: awaiter = channel.reader@.ReadAsync(channel.cancellationToken@).GetAwaiter(); flag = true; if (awaiter.IsCompleted) { break; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_0076; case 1: { num = 1; goto IL_0076; } IL_0076: flag2 = (byte)num != 0; flag = flag2; break; } int num2; if (flag) { Resampler.ResamplerOutput result = awaiter.GetResult(); Resampler.ResamplerOutput resamplerOutput = result; if (resamplerOutput.Tag != 0) { samples.original.Clear(); samples.resampled.Clear(); currentIndex.contents = 0; endIndex.contents = 0; voiceDetected.contents = false; num2 = 1; } else { a item = resamplerOutput.item.Item1; Resampler.ResampledAudio item2 = resamplerOutput.item.Item2; flag2 = false; flag2 = flag2 || flag2; try { ref int contents@ = ref currentIndex.contents@; int length@ = item2.original@.samples@.length@; contents@ += length@; PooledList original = samples.original; ArraySegment arraySegment = new ArraySegment(item2.original@.samples@.data@, 0, item2.original@.samples@.length@); int num3 = 0; length@ = arraySegment.Count - 1; if (length@ >= num3) { do { original.Add(arraySegment[num3]); resumptionPoint = 0; num3++; } while (num3 != length@ + 1); } original = samples.resampled; arraySegment = new ArraySegment(item2.resampled@.samples@.data@, 0, item2.resampled@.samples@.length@); num3 = 0; length@ = arraySegment.Count - 1; if (length@ >= num3) { do { original.Add(arraySegment[num3]); resumptionPoint = 0; num3++; } while (num3 != length@ + 1); } FSharpValueOption val = args.forcedProbability@.Invoke(item); float num4 = ((val.Tag == 0) ? FSharpFunc.InvokeFast(args.detectSpeech@, item2.resampled@.samples@, item2.resampled@.samples@.length@) : val.Item); int num5; if (num4 >= args.startThreshold@) { if (endIndex.contents != 0) { endIndex.contents = 0; if (1 == 0) { num5 = 0; goto IL_05c7; } } if (!voiceDetected.contents) { voiceDetected.contents = true; FSharpFunc val2 = args.onVoiceDetected@.Invoke(item); DetectStart detectStart = new DetectStart(item2.original@.format@, item2.resampled@.format@); val2.Invoke(DetectAction.NewDetectStart(detectStart)); num5 = 1; } else { num5 = 1; } } else if (num4 < args.endThreshold@ && voiceDetected.contents) { if (endIndex.contents == 0) { endIndex.contents = currentIndex.contents; if (1 == 0) { num5 = 0; goto IL_05c7; } } if ((float)(currentIndex.contents - endIndex.contents) >= minSilenceSamples) { float[] array = ArrayPool.Shared.Rent(samples.original.Count); original = samples.original; length@ = samples.original.Count; int num6 = 0; num3 = length@ - 1; if (num3 >= num6) { do { array[num6] = original[num6]; num6++; } while (num6 != num3 + 1); } float[] data = array; float[] array2 = ArrayPool.Shared.Rent(samples.resampled.Count); original = samples.resampled; length@ = samples.resampled.Count; num6 = 0; num3 = length@ - 1; if (num3 >= num6) { do { array2[num6] = original[num6]; num6++; } while (num6 != num3 + 1); } array = array2; PCM.WaveFormat format@ = item2.original@.format@; Resampler.ResampledAudio fullAudio = new Resampler.ResampledAudio(new Resampler.AudioFrame(new PCM.Samples(data, samples.original.Count), format@), new Resampler.AudioFrame(format: item2.resampled@.format@, samples: new PCM.Samples(array, samples.resampled.Count))); endIndex.contents = 0; voiceDetected.contents = false; FSharpFunc val2 = args.onVoiceDetected@.Invoke(item); format@ = fullAudio.original@.format@; length@ = samples.original.Count; DetectEnd detectEnd = new DetectEnd((int)((double)length@ / (double)format@.sampleRate@ / (double)format@.channels@ * 1000.0), fullAudio); val2.Invoke(DetectAction.NewDetectEnd(detectEnd)); samples.original.Clear(); samples.resampled.Clear(); num5 = 1; } else { num5 = 1; } } else if (!voiceDetected.contents) { samples.original.Clear(); samples.resampled.Clear(); num5 = 1; } else { num5 = 1; } goto IL_05c7; IL_05c7: bool flag3 = (byte)num5 != 0; flag2 = flag3; } catch (object obj) { ex = (Exception)obj; compensation@1(item2, null); bool flag3 = true; throw; } if (flag2) { compensation@1(item2, null); bool flag3 = true; } num2 = (flag2 ? 1 : 0); } } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } if (num2 != 0) { ValueTaskAwaiter> valueTaskAwaiter = default(ValueTaskAwaiter>); awaiter = valueTaskAwaiter; if (true) { Data.MethodBuilder.SetResult(Data.Result); } } } catch (object obj2) { ex = (Exception)obj2; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct consumer@83-5 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public VoiceDetectorArgs args; public float minSilenceSamples; public Mirage.Core.Task.Channel.Channel> channel; public <>f__AnonymousType2762740774, PooledList> samples; public FSharpRef currentIndex; public FSharpRef endIndex; public FSharpRef voiceDetected; public ValueTaskAwaiter awaiter; public override void MoveNext() { int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex2 = default(Exception); Exception ex; try { bool flag; int num; bool flag2; bool flag3; int num2; int num3; bool flag4; switch (resumptionPoint) { default: flag = true; goto IL_00f9; case 1: { num = 1; goto IL_0093; } IL_00f9: if (flag) { awaiter = program@7-2(args, minSilenceSamples, channel, samples, currentIndex, endIndex, voiceDetected, null).GetAwaiter(); flag2 = true; if (awaiter.IsCompleted) { goto IL_009d; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_0093; } if (flag) { Data.MethodBuilder.SetResult(Data.Result); } break; IL_0093: flag3 = (byte)num != 0; flag2 = flag3; goto IL_009d; IL_009d: if (flag2) { awaiter.GetResult(); _ = null; num2 = 1; } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } if (num2 != 0) { awaiter = default(ValueTaskAwaiter); num3 = 1; } else { num3 = 0; } flag4 = (byte)num3 != 0; flag = flag4; resumptionPoint = 0; goto IL_00f9; } } catch (object obj) { ex = (Exception)obj; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] internal sealed class consumer@83-3 : FSharpFunc> { public VoiceDetectorArgs args; public float minSilenceSamples; public Mirage.Core.Task.Channel.Channel> channel; public <>f__AnonymousType2762740774, PooledList> samples; public FSharpRef currentIndex; public FSharpRef endIndex; public FSharpRef voiceDetected; [CompilerGenerated] [DebuggerNonUserCode] internal consumer@83-3(VoiceDetectorArgs args, float minSilenceSamples, Mirage.Core.Task.Channel.Channel> channel, <>f__AnonymousType2762740774, PooledList> samples, FSharpRef currentIndex, FSharpRef endIndex, FSharpRef voiceDetected) { this.args = args; this.minSilenceSamples = minSilenceSamples; this.channel = channel; this.samples = samples; this.currentIndex = currentIndex; this.endIndex = endIndex; this.voiceDetected = voiceDetected; } public override ValueTask Invoke(Unit unitVar0) { consumer@83-5 stateMachine = default(consumer@83-5); stateMachine.args = args; stateMachine.minSilenceSamples = minSilenceSamples; stateMachine.channel = channel; stateMachine.samples = samples; stateMachine.currentIndex = currentIndex; stateMachine.endIndex = endIndex; stateMachine.voiceDetected = voiceDetected; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct VoiceDetector@147-2 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public FSharpFunc> program; public Mirage.Core.Task.Channel.Channel> channel; public ValueTaskAwaiter awaiter; public override void MoveNext() { //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex3 = default(Exception); Exception ex = default(Exception); try { bool flag2 = default(bool); bool flag = default(bool); switch (resumptionPoint) { default: flag = false; flag2 = false; ex = null; flag = flag || flag; break; case 1: break; } try { bool flag3; int num; bool flag4; switch (resumptionPoint) { default: awaiter = program.Invoke((Unit)null).GetAwaiter(); flag3 = true; if (awaiter.IsCompleted) { break; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_008c; case 1: { num = 1; goto IL_008c; } IL_008c: flag4 = (byte)num != 0; flag3 = flag4; break; } int num2; if (flag3) { awaiter.GetResult(); _ = null; FSharpResult item = FSharpResult.NewOk((Unit)null); ValueTask valueTask = channel.writer@.WriteAsync(item, channel.cancellationToken@); num2 = 1; } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } int num3; if (num2 != 0) { ValueTaskAwaiter valueTaskAwaiter = default(ValueTaskAwaiter); awaiter = valueTaskAwaiter; num3 = 1; } else { num3 = 0; } bool flag5 = (byte)num3 != 0; flag = flag5; } catch (object obj) { Exception ex2 = (Exception)obj; flag2 = true; ex = ex2; } int num4; if (flag2) { Exception ex2 = ex; FSharpResult item = FSharpResult.NewError(ex2); ValueTask valueTask = channel.writer@.WriteAsync(item, channel.cancellationToken@); num4 = 1; } else { num4 = (flag ? 1 : 0); } if (num4 != 0) { Data.MethodBuilder.SetResult(Data.Result); } } catch (object obj2) { ex = (Exception)obj2; ex3 = ex; } ex = ex3; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal sealed class VoiceDetector@147-3 { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public FSharpFunc> program; [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public Mirage.Core.Task.Channel.Channel> channel; public VoiceDetector@147-3(FSharpFunc> program, Mirage.Core.Task.Channel.Channel> channel) { this.program = program; this.channel = channel; base..ctor(); } internal ValueTask Invoke() { return thread@12-4(program, channel, null); } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct VoiceDetector@147-1 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public CancellationToken cancellationToken; public FSharpFunc> program; public ValueTaskAwaiter> awaiter; public override void MoveNext() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex2 = default(Exception); Exception ex; try { bool flag; int num; bool flag2; switch (resumptionPoint) { default: { Mirage.Core.Task.Channel.Channel> channel = Mirage.Core.Task.Channel.Channel>(cancellationToken); Task> task = System.Threading.Tasks.Task.Run((Func>)new VoiceDetector@147-3(program, channel).Invoke, cancellationToken); awaiter = channel.reader@.ReadAsync(channel.cancellationToken@).GetAwaiter(); flag = true; if (awaiter.IsCompleted) { break; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_009d; } case 1: { num = 1; goto IL_009d; } IL_009d: flag2 = (byte)num != 0; flag = flag2; break; } int num2; if (flag) { FSharpResult result = awaiter.GetResult(); FSharpResult val = result; if (val.Tag != 0) { throw val.ErrorValue; } _ = val.ResultValue; Data.Result = null; num2 = 1; } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } if (num2 != 0) { ValueTaskAwaiter> valueTaskAwaiter = default(ValueTaskAwaiter>); awaiter = valueTaskAwaiter; if (true) { Data.MethodBuilder.SetResult(Data.Result); } } } catch (object obj) { ex = (Exception)obj; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] internal sealed class VoiceDetector@147-4 : FSharpFunc>, Unit> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public CancellationToken cancellationToken; [CompilerGenerated] [DebuggerNonUserCode] internal VoiceDetector@147-4(CancellationToken cancellationToken) { this.cancellationToken = cancellationToken; } public override Unit Invoke(FSharpFunc> x) { ValueTask valueTask = func1@1-1(cancellationToken, x); return null; } } [Serializable] internal sealed class VoiceDetector@147 : FSharpFunc>, Unit>> { internal static readonly VoiceDetector@147 @_instance = new VoiceDetector@147(); [CompilerGenerated] [DebuggerNonUserCode] internal VoiceDetector@147() { } public override FSharpFunc>, Unit> Invoke(CancellationToken cancellationToken) { return new VoiceDetector@147-4(cancellationToken); } } [Serializable] internal sealed class writeDetector@151 : FSharpFunc, Unit> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public Mirage.Core.Task.Channel.Channel> channel; [CompilerGenerated] [DebuggerNonUserCode] internal writeDetector@151(Mirage.Core.Task.Channel.Channel> channel) { ((FSharpFunc>, Unit>)(object)this)..ctor(); this.channel = channel; } public override Unit Invoke(Resampler.ResamplerOutput element) { ValueTask valueTask = channel.writer@.WriteAsync(element, channel.cancellationToken@); return null; } } [Literal] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal const int SamplingRate = 16000; [CompilerGenerated] internal static void compensation@1(Resampler.ResampledAudio currentAudio, Unit unitVar) { ArrayPool.Shared.Return(currentAudio.original@.samples@.data@); ArrayPool.Shared.Return(currentAudio.resampled@.samples@.data@); } [CompilerGenerated] internal static ValueTask program@7-2(VoiceDetectorArgs args, float minSilenceSamples, Mirage.Core.Task.Channel.Channel> channel, <>f__AnonymousType2762740774, PooledList> samples, FSharpRef currentIndex, FSharpRef endIndex, FSharpRef voiceDetected, Unit unitVar0) { consumer@83-4 stateMachine = default(consumer@83-4); stateMachine.args = args; stateMachine.minSilenceSamples = minSilenceSamples; stateMachine.channel = channel; stateMachine.samples = samples; stateMachine.currentIndex = currentIndex; stateMachine.endIndex = endIndex; stateMachine.voiceDetected = voiceDetected; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } [CompilerGenerated] internal static ValueTask thread@12-4(FSharpFunc> program, Mirage.Core.Task.Channel.Channel> channel, Unit unitVar0) { VoiceDetector@147-2 stateMachine = default(VoiceDetector@147-2); stateMachine.program = program; stateMachine.channel = channel; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } [CompilerGenerated] internal static ValueTask func1@1-1(CancellationToken cancellationToken, FSharpFunc> program) { VoiceDetector@147-1 stateMachine = default(VoiceDetector@147-1); stateMachine.cancellationToken = cancellationToken; stateMachine.program = program; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } public static VoiceDetector VoiceDetector(VoiceDetectorArgs args) { float minSilenceSamples = 16000f * (float)args.minSilenceDurationMs@ / 1000f; Mirage.Core.Task.Channel.Channel> channel = Mirage.Core.Task.Channel.Channel>(CancellationToken.None); var samples = new { original = new PooledList((ClearMode)2), resampled = new PooledList((ClearMode)2) }; FSharpRef currentIndex = new FSharpRef(0); FSharpRef endIndex = new FSharpRef(0); FSharpRef voiceDetected = new FSharpRef(false); FSharpFunc> val = new consumer@83-3(args, minSilenceSamples, channel, samples, currentIndex, endIndex, voiceDetected); FSharpFunc>>.InvokeFast((FSharpFunc>, Unit>>)VoiceDetector@147.@_instance, CancellationToken.None, val); return new VoiceDetector(channel); } public static FSharpFunc, Unit> writeDetector(VoiceDetector detector) { Mirage.Core.Task.Channel.Channel> channel@ = detector.channel@; return new writeDetector@151(channel@); } } } namespace .$Mirage.Core.Audio.Microphone { internal static class Detection { } } namespace Mirage.Core.Audio.Microphone { [CompilationMapping(/*Could not decode attribute arguments.*/)] public static class Resampler { [Serializable] [Struct] [CompilationMapping(/*Could not decode attribute arguments.*/)] public struct AudioFrame : IEquatable, IStructuralEquatable, IComparable, IComparable, IStructuralComparable { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal PCM.Samples samples@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal PCM.WaveFormat format@; [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly PCM.Samples samples { [CompilerGenerated] [DebuggerNonUserCode] get { return samples@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly PCM.WaveFormat format { [CompilerGenerated] [DebuggerNonUserCode] get { return format@; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(AudioFrame))] public AudioFrame(PCM.Samples samples, PCM.WaveFormat format) { samples@ = samples; format@ = format; } [CompilerGenerated] public override string ToString() { return ExtraTopLevelOperators.PrintFormatToString>((PrintfFormat, Unit, string, string>)(object)new PrintfFormat, Unit, string, string, AudioFrame>("%+A")).Invoke(this); } [CompilerGenerated] public sealed int CompareTo(AudioFrame obj) { IComparer genericComparer = LanguagePrimitives.GenericComparer; PCM.Samples samples = samples@; PCM.Samples samples2 = obj.samples@; int num = samples.CompareTo(samples2, genericComparer); if (num < 0) { return num; } if (num > 0) { return num; } genericComparer = LanguagePrimitives.GenericComparer; PCM.WaveFormat waveFormat = format@; PCM.WaveFormat waveFormat2 = obj.format@; return waveFormat.CompareTo(waveFormat2, genericComparer); } [CompilerGenerated] public sealed int CompareTo(object obj) { return CompareTo((AudioFrame)obj); } [CompilerGenerated] public sealed int CompareTo(object obj, IComparer comp) { AudioFrame audioFrame = (AudioFrame)obj; PCM.Samples samples = samples@; PCM.Samples samples2 = audioFrame.samples@; int num = samples.CompareTo(samples2, comp); if (num < 0) { return num; } if (num > 0) { return num; } PCM.WaveFormat waveFormat = format@; PCM.WaveFormat waveFormat2 = audioFrame.format@; return waveFormat.CompareTo(waveFormat2, comp); } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { int num = 0; PCM.WaveFormat waveFormat = format@; num = -1640531527 + (waveFormat.GetHashCode(comp) + ((num << 6) + (num >> 2))); PCM.Samples samples = samples@; return -1640531527 + (samples.GetHashCode(comp) + ((num << 6) + (num >> 2))); } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(AudioFrame obj, IEqualityComparer comp) { PCM.Samples samples = samples@; PCM.Samples obj2 = obj.samples@; if (samples.Equals(obj2, comp)) { PCM.WaveFormat waveFormat = format@; PCM.WaveFormat obj3 = obj.format@; return waveFormat.Equals(obj3, comp); } return false; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is AudioFrame obj2) { return Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(AudioFrame obj) { PCM.Samples samples = samples@; if (samples.Equals(obj.samples@)) { PCM.WaveFormat waveFormat = format@; return waveFormat.Equals(obj.format@); } return false; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is AudioFrame) { return Equals((AudioFrame)obj); } return false; } } [Serializable] [Struct] [CompilationMapping(/*Could not decode attribute arguments.*/)] public struct ResampledAudio : IEquatable, IStructuralEquatable, IComparable, IComparable, IStructuralComparable { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal AudioFrame original@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal AudioFrame resampled@; [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly AudioFrame original { [CompilerGenerated] [DebuggerNonUserCode] get { return original@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly AudioFrame resampled { [CompilerGenerated] [DebuggerNonUserCode] get { return resampled@; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(ResampledAudio))] public ResampledAudio(AudioFrame original, AudioFrame resampled) { original@ = original; resampled@ = resampled; } [CompilerGenerated] public override string ToString() { return ExtraTopLevelOperators.PrintFormatToString>((PrintfFormat, Unit, string, string>)(object)new PrintfFormat, Unit, string, string, ResampledAudio>("%+A")).Invoke(this); } [CompilerGenerated] public sealed int CompareTo(ResampledAudio obj) { IComparer genericComparer = LanguagePrimitives.GenericComparer; AudioFrame audioFrame = original@; AudioFrame audioFrame2 = obj.original@; int num = audioFrame.CompareTo(audioFrame2, genericComparer); if (num < 0) { return num; } if (num > 0) { return num; } genericComparer = LanguagePrimitives.GenericComparer; audioFrame = resampled@; audioFrame2 = obj.resampled@; return audioFrame.CompareTo(audioFrame2, genericComparer); } [CompilerGenerated] public sealed int CompareTo(object obj) { return CompareTo((ResampledAudio)obj); } [CompilerGenerated] public sealed int CompareTo(object obj, IComparer comp) { ResampledAudio resampledAudio = (ResampledAudio)obj; AudioFrame audioFrame = original@; AudioFrame audioFrame2 = resampledAudio.original@; int num = audioFrame.CompareTo(audioFrame2, comp); if (num < 0) { return num; } if (num > 0) { return num; } audioFrame = resampled@; audioFrame2 = resampledAudio.resampled@; return audioFrame.CompareTo(audioFrame2, comp); } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { int num = 0; AudioFrame audioFrame = resampled@; num = -1640531527 + (audioFrame.GetHashCode(comp) + ((num << 6) + (num >> 2))); audioFrame = original@; return -1640531527 + (audioFrame.GetHashCode(comp) + ((num << 6) + (num >> 2))); } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(ResampledAudio obj, IEqualityComparer comp) { AudioFrame audioFrame = original@; AudioFrame obj2 = obj.original@; if (audioFrame.Equals(obj2, comp)) { audioFrame = resampled@; obj2 = obj.resampled@; return audioFrame.Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is ResampledAudio obj2) { return Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(ResampledAudio obj) { AudioFrame audioFrame = original@; if (audioFrame.Equals(obj.original@)) { audioFrame = resampled@; return audioFrame.Equals(obj.resampled@); } return false; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is ResampledAudio) { return Equals((ResampledAudio)obj); } return false; } } [Serializable] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] [Struct] [DebuggerDisplay("{__DebugDisplay(),nq}")] [CompilationMapping(/*Could not decode attribute arguments.*/)] public struct ResamplerInput : IEquatable>, IStructuralEquatable, IComparable>, IComparable, IStructuralComparable { public static class Tags { public const int ResamplerInput = 0; public const int Reset = 1; } [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal (State, AudioFrame) item; [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public int Tag { [DebuggerNonUserCode] get; } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public bool IsResamplerInput { [CompilerGenerated] [DebuggerNonUserCode] get { return Tag == 0; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public static ResamplerInput Reset { [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] get { return new ResamplerInput(1); } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public bool IsReset { [CompilerGenerated] [DebuggerNonUserCode] get { return Tag == 1; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public (State, AudioFrame) Item { [CompilerGenerated] [DebuggerNonUserCode] get { return item; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public static ResamplerInput NewResamplerInput((State, AudioFrame) item) { ResamplerInput result = default(ResamplerInput); result.item = item; return result; } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(ResamplerInput<>))] [CompilerGenerated] [DebuggerNonUserCode] internal ResamplerInput(int _tag) { this._tag = _tag; } [SpecialName] [CompilerGenerated] [DebuggerNonUserCode] internal object __DebugDisplay() { return ((FSharpFunc>, string>)(object)ExtraTopLevelOperators.PrintFormatToString, string>>((PrintfFormat, string>, Unit, string, string>)(object)new PrintfFormat, string>>, string>, Unit, string, string, string>("%+0.8A"))).Invoke((ResamplerInput>)this); } [CompilerGenerated] public override string ToString() { return ((FSharpFunc>, string>)(object)ExtraTopLevelOperators.PrintFormatToString, string>>((PrintfFormat, string>, Unit, string, string>)(object)new PrintfFormat, string>>, string>, Unit, string, string, ResamplerInput, string>>>("%+A"))).Invoke((ResamplerInput>)this); } [CompilerGenerated] public sealed int CompareTo(ResamplerInput obj) { int tag = _tag; int tag2 = obj._tag; if (tag == tag2) { if (Tag == 0) { IComparer genericComparer = LanguagePrimitives.GenericComparer; (State, AudioFrame) tuple = item; (State, AudioFrame) tuple2 = obj.item; return HashCompare.GenericComparisonWithComparerIntrinsic<(State, AudioFrame)>(genericComparer, tuple, tuple2); } return 0; } return tag - tag2; } [CompilerGenerated] public sealed int CompareTo(object obj) { return CompareTo((ResamplerInput)obj); } [CompilerGenerated] public sealed int CompareTo(object obj, IComparer comp) { ResamplerInput resamplerInput = (ResamplerInput)obj; int tag = _tag; int tag2 = resamplerInput._tag; if (tag == tag2) { if (Tag == 0) { (State, AudioFrame) tuple = item; (State, AudioFrame) tuple2 = resamplerInput.item; return HashCompare.GenericComparisonWithComparerIntrinsic<(State, AudioFrame)>(comp, tuple, tuple2); } return 0; } return tag - tag2; } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { int num = 0; if (Tag == 0) { num = 0; (State, AudioFrame) tuple = item; return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<(State, AudioFrame)>(comp, tuple) + ((num << 6) + (num >> 2))); } return _tag; } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(ResamplerInput obj, IEqualityComparer comp) { int tag = _tag; int tag2 = obj._tag; if (tag == tag2) { if (Tag == 0) { (State, AudioFrame) tuple = item; (State, AudioFrame) tuple2 = obj.item; return HashCompare.GenericEqualityWithComparerIntrinsic<(State, AudioFrame)>(comp, tuple, tuple2); } return true; } return false; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is ResamplerInput obj2) { return Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(ResamplerInput obj) { int tag = _tag; int tag2 = obj._tag; if (tag == tag2) { if (Tag == 0) { (State, AudioFrame) tuple = item; (State, AudioFrame) tuple2 = obj.item; return HashCompare.GenericEqualityERIntrinsic<(State, AudioFrame)>(tuple, tuple2); } return true; } return false; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is ResamplerInput) { return Equals((ResamplerInput)obj); } return false; } } [Serializable] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] [Struct] [DebuggerDisplay("{__DebugDisplay(),nq}")] [CompilationMapping(/*Could not decode attribute arguments.*/)] public struct ResamplerOutput : IEquatable>, IStructuralEquatable, IComparable>, IComparable, IStructuralComparable { public static class Tags { public const int ResamplerOutput = 0; public const int Reset = 1; } [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal (State, ResampledAudio) item; [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public int Tag { [DebuggerNonUserCode] get; } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public bool IsResamplerOutput { [CompilerGenerated] [DebuggerNonUserCode] get { return Tag == 0; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public static ResamplerOutput Reset { [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] get { return new ResamplerOutput(1); } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public bool IsReset { [CompilerGenerated] [DebuggerNonUserCode] get { return Tag == 1; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public (State, ResampledAudio) Item { [CompilerGenerated] [DebuggerNonUserCode] get { return item; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public static ResamplerOutput NewResamplerOutput((State, ResampledAudio) item) { ResamplerOutput result = default(ResamplerOutput); result.item = item; return result; } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(ResamplerOutput<>))] [CompilerGenerated] [DebuggerNonUserCode] internal ResamplerOutput(int _tag) { this._tag = _tag; } [SpecialName] [CompilerGenerated] [DebuggerNonUserCode] internal object __DebugDisplay() { return ((FSharpFunc>, string>)(object)ExtraTopLevelOperators.PrintFormatToString, string>>((PrintfFormat, string>, Unit, string, string>)(object)new PrintfFormat, string>>, string>, Unit, string, string, string>("%+0.8A"))).Invoke((ResamplerOutput>)this); } [CompilerGenerated] public override string ToString() { return ((FSharpFunc>, string>)(object)ExtraTopLevelOperators.PrintFormatToString, string>>((PrintfFormat, string>, Unit, string, string>)(object)new PrintfFormat, string>>, string>, Unit, string, string, ResamplerOutput, string>>>("%+A"))).Invoke((ResamplerOutput>)this); } [CompilerGenerated] public sealed int CompareTo(ResamplerOutput obj) { int tag = _tag; int tag2 = obj._tag; if (tag == tag2) { if (Tag == 0) { IComparer genericComparer = LanguagePrimitives.GenericComparer; (State, ResampledAudio) tuple = item; (State, ResampledAudio) tuple2 = obj.item; return HashCompare.GenericComparisonWithComparerIntrinsic<(State, ResampledAudio)>(genericComparer, tuple, tuple2); } return 0; } return tag - tag2; } [CompilerGenerated] public sealed int CompareTo(object obj) { return CompareTo((ResamplerOutput)obj); } [CompilerGenerated] public sealed int CompareTo(object obj, IComparer comp) { ResamplerOutput resamplerOutput = (ResamplerOutput)obj; int tag = _tag; int tag2 = resamplerOutput._tag; if (tag == tag2) { if (Tag == 0) { (State, ResampledAudio) tuple = item; (State, ResampledAudio) tuple2 = resamplerOutput.item; return HashCompare.GenericComparisonWithComparerIntrinsic<(State, ResampledAudio)>(comp, tuple, tuple2); } return 0; } return tag - tag2; } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { int num = 0; if (Tag == 0) { num = 0; (State, ResampledAudio) tuple = item; return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<(State, ResampledAudio)>(comp, tuple) + ((num << 6) + (num >> 2))); } return _tag; } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(ResamplerOutput obj, IEqualityComparer comp) { int tag = _tag; int tag2 = obj._tag; if (tag == tag2) { if (Tag == 0) { (State, ResampledAudio) tuple = item; (State, ResampledAudio) tuple2 = obj.item; return HashCompare.GenericEqualityWithComparerIntrinsic<(State, ResampledAudio)>(comp, tuple, tuple2); } return true; } return false; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is ResamplerOutput obj2) { return Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(ResamplerOutput obj) { int tag = _tag; int tag2 = obj._tag; if (tag == tag2) { if (Tag == 0) { (State, ResampledAudio) tuple = item; (State, ResampledAudio) tuple2 = obj.item; return HashCompare.GenericEqualityERIntrinsic<(State, ResampledAudio)>(tuple, tuple2); } return true; } return false; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is ResamplerOutput) { return Equals((ResamplerOutput)obj); } return false; } } [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public sealed class Resampler : IEquatable>, IStructuralEquatable { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal Mirage.Core.Task.Channel.Channel> channel@; [CompilationMapping(/*Could not decode attribute arguments.*/)] public Mirage.Core.Task.Channel.Channel> channel { [CompilerGenerated] [DebuggerNonUserCode] get { return channel@; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(Resampler<>))] public Resampler(Mirage.Core.Task.Channel.Channel> channel) { channel@ = channel; } [CompilerGenerated] public override string ToString() { return ((FSharpFunc>, string>)(object)ExtraTopLevelOperators.PrintFormatToString, string>>((PrintfFormat, string>, Unit, string, string>)(object)new PrintfFormat, string>>, string>, Unit, string, string, Resampler, string>>>("%+A"))).Invoke((Resampler>)(object)this); } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { if (this != null) { int num = 0; return -1640531527 + (channel@.GetHashCode(comp) + ((num << 6) + (num >> 2))); } return 0; } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(Resampler obj, IEqualityComparer comp) { if (this != null) { if (obj != null) { Mirage.Core.Task.Channel.Channel> channel = channel@; Mirage.Core.Task.Channel.Channel> obj2 = obj.channel@; return channel.Equals(obj2, comp); } return false; } return obj == null; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is Resampler obj2) { return Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(Resampler obj) { if (this != null) { if (obj != null) { return channel@.Equals(obj.channel@); } return false; } return obj == null; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is Resampler obj2) { return Equals(obj2); } return false; } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct consumer@72-1 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public int samplesPerWindow; public FSharpFunc, Unit> onResampled; public double windowDuration; public WdlResampler resampler; public Mirage.Core.Task.Channel.Channel> channel; public <>f__AnonymousType2762740774, PooledList> buffer; public ValueTaskAwaiter> awaiter; public unsafe override void MoveNext() { int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex2 = default(Exception); Exception ex; try { bool flag; int num; bool flag2; switch (resumptionPoint) { default: awaiter = channel.reader@.ReadAsync(channel.cancellationToken@).GetAwaiter(); flag = true; if (awaiter.IsCompleted) { break; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_0076; case 1: { num = 1; goto IL_0076; } IL_0076: flag2 = (byte)num != 0; flag = flag2; break; } int num2; if (flag) { ResamplerInput result = awaiter.GetResult(); ResamplerInput resamplerInput = result; if (resamplerInput.Tag != 0) { buffer.original.Clear(); buffer.resampled.Clear(); ((FSharpFunc>, Unit>)(object)onResampled).Invoke((ResamplerOutput>)ResamplerOutput.Reset); num2 = 1; } else { State item = resamplerInput.item.Item1; AudioFrame item2 = resamplerInput.item.Item2; flag2 = false; flag2 = flag2 || flag2; try { ArraySegment arraySegment = new ArraySegment(item2.samples@.data@, 0, item2.samples@.length@); PooledList original = buffer.original; int num3 = 0; int num4 = arraySegment.Count - 1; if (num4 >= num3) { do { original.Add(arraySegment[num3]); resumptionPoint = 0; num3++; } while (num3 != num4 + 1); } int num5; if (item2.format@.sampleRate@ == WriterFormat.sampleRate@) { original = buffer.resampled; num3 = 0; num4 = arraySegment.Count - 1; if (num4 >= num3) { do { original.Add(arraySegment[num3]); resumptionPoint = 0; num3++; } while (num3 != num4 + 1); } } else { resampler.SetRates((double)item2.format@.sampleRate@, (double)WriterFormat.sampleRate@); PCM.Samples samples@ = item2.samples@; num4 = 0; float[] dst = default(float[]); num3 = resampler.ResamplePrepare(samples@.length@, 1, ref dst, ref num4); Buffer.BlockCopy(samples@.data@, 0, dst, num4, num3 * sizeof(float)); float[] array = ArrayPool.Shared.Rent(2000); int item3 = resampler.ResampleOut(array, 0, num3, 2000, 1); (float[], int) tuple = (array, item3); dst = tuple.Item1; num4 = tuple.Item2; bool flag3 = false; flag3 = flag3 || flag3; try { original = buffer.resampled; ArraySegment arraySegment2 = new ArraySegment(dst, 0, num4); item3 = 0; num3 = arraySegment2.Count - 1; if (num3 >= item3) { do { original.Add(arraySegment2[item3]); resumptionPoint = 0; item3++; } while (item3 != num3 + 1); } bool flag4 = true; flag3 = flag4; } catch (object obj) { ex = (Exception)obj; ArrayPool.Shared.Return(dst); bool flag4 = true; throw; } if (flag3) { ArrayPool.Shared.Return(dst); bool flag4 = true; } if (!flag3) { num5 = 0; goto IL_0498; } } num4 = (int)(windowDuration * (double)item2.format@.sampleRate@); if (buffer.original.Count >= num4 && buffer.resampled.Count >= samplesPerWindow) { float[] dst = ArrayPool.Shared.Rent(num4); original = buffer.original; int item3 = 0; num3 = num4 - 1; if (num3 >= item3) { do { dst[item3] = original[item3]; resumptionPoint = 0; item3++; } while (item3 != num3 + 1); } buffer.original.RemoveRange(0, num4); float[] array = ArrayPool.Shared.Rent(samplesPerWindow); original = buffer.resampled; item3 = 0; num3 = samplesPerWindow - 1; if (num3 >= item3) { do { array[item3] = original[item3]; resumptionPoint = 0; item3++; } while (item3 != num3 + 1); } buffer.resampled.RemoveRange(0, samplesPerWindow); ResampledAudio item4 = new ResampledAudio(new AudioFrame(new PCM.Samples(dst, num4), item2.format@), new AudioFrame(new PCM.Samples(array, samplesPerWindow), WriterFormat)); (State, ResampledAudio) item5 = (item, item4); ((FSharpFunc>, Unit>)(object)onResampled).Invoke((ResamplerOutput>)ResamplerOutput.NewResamplerOutput(item5)); num5 = 1; } else { num5 = 1; } goto IL_0498; IL_0498: bool flag5 = (byte)num5 != 0; flag2 = flag5; } catch (object obj2) { ex = (Exception)obj2; ArrayPool.Shared.Return(item2.samples@.data@); bool flag5 = true; throw; } if (flag2) { ArrayPool.Shared.Return(item2.samples@.data@); bool flag5 = true; } num2 = (flag2 ? 1 : 0); } } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } if (num2 != 0) { ValueTaskAwaiter> valueTaskAwaiter = default(ValueTaskAwaiter>); awaiter = valueTaskAwaiter; if (true) { Data.MethodBuilder.SetResult(Data.Result); } } } catch (object obj3) { ex = (Exception)obj3; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct consumer@72-2 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public int samplesPerWindow; public FSharpFunc, Unit> onResampled; public double windowDuration; public WdlResampler resampler; public Mirage.Core.Task.Channel.Channel> channel; public <>f__AnonymousType2762740774, PooledList> buffer; public ValueTaskAwaiter awaiter; public override void MoveNext() { int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex2 = default(Exception); Exception ex; try { bool flag; int num; bool flag2; bool flag3; int num2; int num3; bool flag4; switch (resumptionPoint) { default: flag = true; goto IL_00f3; case 1: { num = 1; goto IL_008d; } IL_00f3: if (flag) { awaiter = program@7-1(samplesPerWindow, onResampled, windowDuration, resampler, channel, buffer, null).GetAwaiter(); flag2 = true; if (awaiter.IsCompleted) { goto IL_0097; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_008d; } if (flag) { Data.MethodBuilder.SetResult(Data.Result); } break; IL_008d: flag3 = (byte)num != 0; flag2 = flag3; goto IL_0097; IL_0097: if (flag2) { awaiter.GetResult(); _ = null; num2 = 1; } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } if (num2 != 0) { awaiter = default(ValueTaskAwaiter); num3 = 1; } else { num3 = 0; } flag4 = (byte)num3 != 0; flag = flag4; resumptionPoint = 0; goto IL_00f3; } } catch (object obj) { ex = (Exception)obj; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] internal sealed class consumer@72 : FSharpFunc> { public int samplesPerWindow; public FSharpFunc, Unit> onResampled; public double windowDuration; public WdlResampler resampler; public Mirage.Core.Task.Channel.Channel> channel; public <>f__AnonymousType2762740774, PooledList> buffer; [CompilerGenerated] [DebuggerNonUserCode] internal consumer@72(int samplesPerWindow, FSharpFunc, Unit> onResampled, double windowDuration, WdlResampler resampler, Mirage.Core.Task.Channel.Channel> channel, <>f__AnonymousType2762740774, PooledList> buffer) { this.samplesPerWindow = samplesPerWindow; this.onResampled = onResampled; this.windowDuration = windowDuration; this.resampler = resampler; this.channel = channel; this.buffer = buffer; } public override ValueTask Invoke(Unit unitVar0) { consumer@72-2 stateMachine = default(consumer@72-2); stateMachine.samplesPerWindow = samplesPerWindow; stateMachine.onResampled = onResampled; stateMachine.windowDuration = windowDuration; stateMachine.resampler = resampler; stateMachine.channel = channel; stateMachine.buffer = buffer; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct Resampler@112-2 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public FSharpFunc> program; public Mirage.Core.Task.Channel.Channel> channel; public ValueTaskAwaiter awaiter; public override void MoveNext() { //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex3 = default(Exception); Exception ex = default(Exception); try { bool flag2 = default(bool); bool flag = default(bool); switch (resumptionPoint) { default: flag = false; flag2 = false; ex = null; flag = flag || flag; break; case 1: break; } try { bool flag3; int num; bool flag4; switch (resumptionPoint) { default: awaiter = program.Invoke((Unit)null).GetAwaiter(); flag3 = true; if (awaiter.IsCompleted) { break; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_008c; case 1: { num = 1; goto IL_008c; } IL_008c: flag4 = (byte)num != 0; flag3 = flag4; break; } int num2; if (flag3) { awaiter.GetResult(); _ = null; FSharpResult item = FSharpResult.NewOk((Unit)null); ValueTask valueTask = channel.writer@.WriteAsync(item, channel.cancellationToken@); num2 = 1; } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } int num3; if (num2 != 0) { ValueTaskAwaiter valueTaskAwaiter = default(ValueTaskAwaiter); awaiter = valueTaskAwaiter; num3 = 1; } else { num3 = 0; } bool flag5 = (byte)num3 != 0; flag = flag5; } catch (object obj) { Exception ex2 = (Exception)obj; flag2 = true; ex = ex2; } int num4; if (flag2) { Exception ex2 = ex; FSharpResult item = FSharpResult.NewError(ex2); ValueTask valueTask = channel.writer@.WriteAsync(item, channel.cancellationToken@); num4 = 1; } else { num4 = (flag ? 1 : 0); } if (num4 != 0) { Data.MethodBuilder.SetResult(Data.Result); } } catch (object obj2) { ex = (Exception)obj2; ex3 = ex; } ex = ex3; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal sealed class Resampler@112-3 { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public FSharpFunc> program; [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public Mirage.Core.Task.Channel.Channel> channel; public Resampler@112-3(FSharpFunc> program, Mirage.Core.Task.Channel.Channel> channel) { this.program = program; this.channel = channel; base..ctor(); } internal ValueTask Invoke() { return thread@12-3(program, channel, null); } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct Resampler@112-1 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public CancellationToken cancellationToken; public FSharpFunc> program; public ValueTaskAwaiter> awaiter; public override void MoveNext() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex2 = default(Exception); Exception ex; try { bool flag; int num; bool flag2; switch (resumptionPoint) { default: { Mirage.Core.Task.Channel.Channel> channel = Mirage.Core.Task.Channel.Channel>(cancellationToken); Task> task = System.Threading.Tasks.Task.Run((Func>)new Resampler@112-3(program, channel).Invoke, cancellationToken); awaiter = channel.reader@.ReadAsync(channel.cancellationToken@).GetAwaiter(); flag = true; if (awaiter.IsCompleted) { break; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_009d; } case 1: { num = 1; goto IL_009d; } IL_009d: flag2 = (byte)num != 0; flag = flag2; break; } int num2; if (flag) { FSharpResult result = awaiter.GetResult(); FSharpResult val = result; if (val.Tag != 0) { throw val.ErrorValue; } _ = val.ResultValue; Data.Result = null; num2 = 1; } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } if (num2 != 0) { ValueTaskAwaiter> valueTaskAwaiter = default(ValueTaskAwaiter>); awaiter = valueTaskAwaiter; if (true) { Data.MethodBuilder.SetResult(Data.Result); } } } catch (object obj) { ex = (Exception)obj; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] internal sealed class Resampler@112-4 : FSharpFunc>, Unit> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public CancellationToken cancellationToken; [CompilerGenerated] [DebuggerNonUserCode] internal Resampler@112-4(CancellationToken cancellationToken) { this.cancellationToken = cancellationToken; } public override Unit Invoke(FSharpFunc> x) { ValueTask valueTask = func1@1(cancellationToken, x); return null; } } [Serializable] internal sealed class Resampler@112 : FSharpFunc>, Unit>> { internal static readonly Resampler@112 @_instance = new Resampler@112(); [CompilerGenerated] [DebuggerNonUserCode] internal Resampler@112() { } public override FSharpFunc>, Unit> Invoke(CancellationToken cancellationToken) { return new Resampler@112-4(cancellationToken); } } [Serializable] internal sealed class writeResampler@117 : FSharpFunc, Unit> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public Mirage.Core.Task.Channel.Channel> channel; [CompilerGenerated] [DebuggerNonUserCode] internal writeResampler@117(Mirage.Core.Task.Channel.Channel> channel) { ((FSharpFunc>, Unit>)(object)this)..ctor(); this.channel = channel; } public override Unit Invoke(ResamplerInput element) { ValueTask valueTask = channel.writer@.WriteAsync(element, channel.cancellationToken@); return null; } } [Literal] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal const int BufferSize = 2000; [CompilationMapping(/*Could not decode attribute arguments.*/)] internal static PCM.WaveFormat WriterFormat => .$Mirage.Core.Audio.Microphone.Resampler.WriterFormat@18; [CompilationArgumentCounts(new int[] { 1, 1 })] internal unsafe static (float[], int) resample(WdlResampler resampler, PCM.Samples samples) { int dstOffset = 0; float[] dst = default(float[]); int num = resampler.ResamplePrepare(samples.length@, 1, ref dst, ref dstOffset); Buffer.BlockCopy(samples.data@, 0, dst, dstOffset, num * sizeof(float)); float[] array = ArrayPool.Shared.Rent(2000); int item = resampler.ResampleOut(array, 0, num, 2000, 1); return (array, item); } [CompilerGenerated] internal static ValueTask program@7-1(int samplesPerWindow, FSharpFunc, Unit> onResampled, double windowDuration, WdlResampler resampler, Mirage.Core.Task.Channel.Channel> channel, <>f__AnonymousType2762740774, PooledList> buffer, Unit unitVar0) { consumer@72-1 stateMachine = default(consumer@72-1); stateMachine.samplesPerWindow = samplesPerWindow; stateMachine.onResampled = onResampled; stateMachine.windowDuration = windowDuration; stateMachine.resampler = resampler; stateMachine.channel = channel; stateMachine.buffer = buffer; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } [CompilerGenerated] internal static ValueTask thread@12-3(FSharpFunc> program, Mirage.Core.Task.Channel.Channel> channel, Unit unitVar0) { Resampler@112-2 stateMachine = default(Resampler@112-2); stateMachine.program = program; stateMachine.channel = channel; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } [CompilerGenerated] internal static ValueTask func1@1(CancellationToken cancellationToken, FSharpFunc> program) { Resampler@112-1 stateMachine = default(Resampler@112-1); stateMachine.cancellationToken = cancellationToken; stateMachine.program = program; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } [CompilationArgumentCounts(new int[] { 1, 1 })] public static Resampler Resampler(int samplesPerWindow, FSharpFunc, Unit> onResampled) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown double windowDuration = (double)samplesPerWindow / (double)WriterFormat.sampleRate@; WdlResampler val = new WdlResampler(); val.SetMode(true, 2, false, 64, 32); val.SetFilterParms(0.693f, 0.707f); val.SetFeedMode(true); Mirage.Core.Task.Channel.Channel> channel = Mirage.Core.Task.Channel.Channel>(CancellationToken.None); var buffer = new { original = new PooledList((ClearMode)2), resampled = new PooledList((ClearMode)2) }; FSharpFunc> val2 = new consumer@72(samplesPerWindow, onResampled, windowDuration, val, channel, buffer); FSharpFunc>>.InvokeFast((FSharpFunc>, Unit>>)Resampler@112.@_instance, CancellationToken.None, val2); return new Resampler(channel); } public static FSharpFunc, Unit> writeResampler(Resampler resampler) { Mirage.Core.Task.Channel.Channel> channel@ = resampler.channel@; return new writeResampler@117(channel@); } static Resampler() { .$Mirage.Core.Audio.Microphone.Resampler.init@ = 0; _ = .$Mirage.Core.Audio.Microphone.Resampler.init@; } } } namespace .$Mirage.Core.Audio.Microphone { internal static class Resampler { [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal static readonly Mirage.Core.Audio.PCM.WaveFormat WriterFormat@18; [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal static int init@; static Resampler() { WriterFormat@18 = new Mirage.Core.Audio.PCM.WaveFormat(16000, 1); } } } namespace Mirage.Core.Audio.Opus { [CompilationMapping(/*Could not decode attribute arguments.*/)] public static class Writer { [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public sealed class OpusWriter : IEquatable, IStructuralEquatable, IDisposable { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal PooledList samples@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal string filePath@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal PCM.WaveFormat format@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal bool closed@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal bool disposed@; [CompilationMapping(/*Could not decode attribute arguments.*/)] internal PooledList samples { [CompilerGenerated] [DebuggerNonUserCode] get { return samples@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] internal string filePath { [CompilerGenerated] [DebuggerNonUserCode] get { return filePath@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] internal PCM.WaveFormat format { [CompilerGenerated] [DebuggerNonUserCode] get { return format@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] internal bool closed { [CompilerGenerated] [DebuggerNonUserCode] get { return closed@; } [CompilerGenerated] [DebuggerNonUserCode] set { closed@ = value; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] internal bool disposed { [CompilerGenerated] [DebuggerNonUserCode] get { return disposed@; } [CompilerGenerated] [DebuggerNonUserCode] set { disposed@ = value; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(OpusWriter))] internal OpusWriter(PooledList samples, string filePath, PCM.WaveFormat format, bool closed, bool disposed) { samples@ = samples; filePath@ = filePath; format@ = format; closed@ = closed; disposed@ = disposed; } [CompilerGenerated] public override string ToString() { return ExtraTopLevelOperators.PrintFormatToString>((PrintfFormat, Unit, string, string>)(object)new PrintfFormat, Unit, string, string, OpusWriter>("%+A")).Invoke(this); } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { if (this != null) { int num = 0; num = -1640531527 + ((disposed@ ? 1 : 0) + ((num << 6) + (num >> 2))); num = -1640531527 + ((closed@ ? 1 : 0) + ((num << 6) + (num >> 2))); PCM.WaveFormat waveFormat = format@; num = -1640531527 + (waveFormat.GetHashCode(comp) + ((num << 6) + (num >> 2))); num = -1640531527 + ((filePath@?.GetHashCode() ?? 0) + ((num << 6) + (num >> 2))); return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic>(comp, samples@) + ((num << 6) + (num >> 2))); } return 0; } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(OpusWriter obj, IEqualityComparer comp) { if (this != null) { if (obj != null) { if (HashCompare.GenericEqualityWithComparerIntrinsic>(comp, samples@, obj.samples@)) { if (string.Equals(filePath@, obj.filePath@)) { PCM.WaveFormat waveFormat = format@; PCM.WaveFormat obj2 = obj.format@; if (waveFormat.Equals(obj2, comp)) { if (closed@ == obj.closed@) { return disposed@ == obj.disposed@; } return false; } return false; } return false; } return false; } return false; } return obj == null; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is OpusWriter obj2) { return Equals(obj2, comp); } return false; } virtual void IDisposable.Dispose() { if (!disposed@) { disposed = true; Operators.dispose((IDisposable)samples@); } } [CompilerGenerated] public sealed bool Equals(OpusWriter obj) { if (this != null) { if (obj != null) { if (HashCompare.GenericEqualityERIntrinsic>(samples@, obj.samples@)) { if (string.Equals(filePath@, obj.filePath@)) { PCM.WaveFormat waveFormat = format@; if (waveFormat.Equals(obj.format@)) { if (closed@ == obj.closed@) { return disposed@ == obj.disposed@; } return false; } return false; } return false; } return false; } return false; } return obj == null; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is OpusWriter obj2) { return Equals(obj2); } return false; } } [Serializable] [Struct] [CompilationMapping(/*Could not decode attribute arguments.*/)] public struct OpusWriterArgs : IEquatable, IStructuralEquatable, IComparable, IComparable, IStructuralComparable { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal string filePath@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal PCM.WaveFormat format@; [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly string filePath { [CompilerGenerated] [DebuggerNonUserCode] get { return filePath@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly PCM.WaveFormat format { [CompilerGenerated] [DebuggerNonUserCode] get { return format@; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(OpusWriterArgs))] public OpusWriterArgs(string filePath, PCM.WaveFormat format) { filePath@ = filePath; format@ = format; } [CompilerGenerated] public override string ToString() { return ExtraTopLevelOperators.PrintFormatToString>((PrintfFormat, Unit, string, string>)(object)new PrintfFormat, Unit, string, string, OpusWriterArgs>("%+A")).Invoke(this); } [CompilerGenerated] public sealed int CompareTo(OpusWriterArgs obj) { IComparer genericComparer = LanguagePrimitives.GenericComparer; int num = string.CompareOrdinal(filePath@, obj.filePath@); if (num < 0) { return num; } if (num > 0) { return num; } genericComparer = LanguagePrimitives.GenericComparer; PCM.WaveFormat waveFormat = format@; PCM.WaveFormat waveFormat2 = obj.format@; return waveFormat.CompareTo(waveFormat2, genericComparer); } [CompilerGenerated] public sealed int CompareTo(object obj) { return CompareTo((OpusWriterArgs)obj); } [CompilerGenerated] public sealed int CompareTo(object obj, IComparer comp) { OpusWriterArgs opusWriterArgs = (OpusWriterArgs)obj; int num = string.CompareOrdinal(filePath@, opusWriterArgs.filePath@); if (num < 0) { return num; } if (num > 0) { return num; } PCM.WaveFormat waveFormat = format@; PCM.WaveFormat waveFormat2 = opusWriterArgs.format@; return waveFormat.CompareTo(waveFormat2, comp); } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { int num = 0; PCM.WaveFormat waveFormat = format@; num = -1640531527 + (waveFormat.GetHashCode(comp) + ((num << 6) + (num >> 2))); return -1640531527 + ((filePath@?.GetHashCode() ?? 0) + ((num << 6) + (num >> 2))); } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(OpusWriterArgs obj, IEqualityComparer comp) { if (string.Equals(filePath@, obj.filePath@)) { PCM.WaveFormat waveFormat = format@; PCM.WaveFormat obj2 = obj.format@; return waveFormat.Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is OpusWriterArgs obj2) { return Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(OpusWriterArgs obj) { if (string.Equals(filePath@, obj.filePath@)) { PCM.WaveFormat waveFormat = format@; return waveFormat.Equals(obj.format@); } return false; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is OpusWriterArgs) { return Equals((OpusWriterArgs)obj); } return false; } } public static OpusWriter OpusWriter(OpusWriterArgs args) { return new OpusWriter(new PooledList((ClearMode)2, ArrayPool.Shared), args.filePath@, args.format@, closed: false, disposed: false); } [CompilationArgumentCounts(new int[] { 1, 1 })] public static void writeOpusSamples(OpusWriter opusWriter, PCM.Samples samples) { PooledList samples@ = opusWriter.samples@; ArraySegment arraySegment = new ArraySegment(samples.data@, 0, samples.length@); int num = 0; int num2 = arraySegment.Count - 1; if (num2 >= num) { do { samples@.Add(arraySegment[num]); num++; } while (num != num2 + 1); } } public static void closeOpusWriter(OpusWriter opusWriter) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown if (opusWriter.closed@) { return; } opusWriter.closed = true; string directoryName = Path.GetDirectoryName(opusWriter.filePath@); DirectoryInfo directoryInfo = Directory.CreateDirectory(directoryName); using FileStream fileStream = new FileStream(opusWriter.filePath@, FileMode.Create, FileAccess.Write); OpusEncoder val = Codec.OpusEncoder(); try { OpusOggWriteStream val2 = new OpusOggWriteStream((IOpusEncoder)(object)val, (Stream)fileStream, (OpusTags)null, opusWriter.format@.sampleRate@, 5, false); float[] array = ArrayPool.Shared.Rent(opusWriter.samples@.Count); PooledList samples@ = opusWriter.samples@; int count = opusWriter.samples@.Count; int num = 0; int num2 = count - 1; if (num2 >= num) { do { array[num] = samples@[num]; num++; } while (num != num2 + 1); } try { val2.WriteSamples(array, 0, opusWriter.samples@.Count); val2.Finish(); } finally { ArrayPool.Shared.Return(array); Operators.dispose((IDisposable)opusWriter); } } finally { if (val is IDisposable disposable) { disposable.Dispose(); } } } } } namespace .$Mirage.Core.Audio.Opus { internal static class Writer { } } namespace Mirage.Core.Audio.Opus { [CompilationMapping(/*Could not decode attribute arguments.*/)] public static class Reader { [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public sealed class OpusReader : IEquatable, IStructuralEquatable, IDisposable { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal OpusOggRentReadStream reader@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal FileStream fileStream@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal int totalSamples@; [CompilationMapping(/*Could not decode attribute arguments.*/)] public OpusOggRentReadStream reader { [CompilerGenerated] [DebuggerNonUserCode] get { return reader@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public FileStream fileStream { [CompilerGenerated] [DebuggerNonUserCode] get { return fileStream@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public int totalSamples { [CompilerGenerated] [DebuggerNonUserCode] get { return totalSamples@; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(OpusReader))] public OpusReader(OpusOggRentReadStream reader, FileStream fileStream, int totalSamples) { reader@ = reader; fileStream@ = fileStream; totalSamples@ = totalSamples; } [CompilerGenerated] public override string ToString() { return ExtraTopLevelOperators.PrintFormatToString>((PrintfFormat, Unit, string, string>)(object)new PrintfFormat, Unit, string, string, OpusReader>("%+A")).Invoke(this); } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { if (this != null) { int num = 0; num = -1640531527 + (totalSamples@ + ((num << 6) + (num >> 2))); num = -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic(comp, fileStream@) + ((num << 6) + (num >> 2))); return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic(comp, reader@) + ((num << 6) + (num >> 2))); } return 0; } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(OpusReader obj, IEqualityComparer comp) { if (this != null) { if (obj != null) { if (HashCompare.GenericEqualityWithComparerIntrinsic(comp, reader@, obj.reader@)) { if (HashCompare.GenericEqualityWithComparerIntrinsic(comp, fileStream@, obj.fileStream@)) { return totalSamples@ == obj.totalSamples@; } return false; } return false; } return false; } return obj == null; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is OpusReader obj2) { return Equals(obj2, comp); } return false; } virtual void IDisposable.Dispose() { Operators.dispose((IDisposable)fileStream@); } [CompilerGenerated] public sealed bool Equals(OpusReader obj) { if (this != null) { if (obj != null) { if (HashCompare.GenericEqualityERIntrinsic(reader@, obj.reader@)) { if (HashCompare.GenericEqualityERIntrinsic(fileStream@, obj.fileStream@)) { return totalSamples@ == obj.totalSamples@; } return false; } return false; } return false; } return obj == null; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is OpusReader obj2) { return Equals(obj2); } return false; } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct readOpusFile@25 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public string filePath; public override void MoveNext() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_00c0: Expected O, but got Unknown int resumptionPoint = ResumptionPoint; Exception ex2 = default(Exception); Exception ex; try { int num2; using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read)) { OpusOggRentReadStream val = new OpusOggRentReadStream((Stream)fileStream); int num = 0; while (val.HasNextPacket) { RentedPacket val2 = val.RentNextRawPacket(); byte[] packet = val2.packet; if (packet != null && 0 == 0) { ArrayPool.Shared.Return(val2.packet); num++; } } num2 = num * 960; } int totalSamples = num2; FileStream fileStream2 = new FileStream(filePath, FileMode.Open, FileAccess.Read); OpusReader result = new OpusReader(new OpusOggRentReadStream((Stream)fileStream2), fileStream2, totalSamples); Data.Result = result; if (true) { Data.MethodBuilder.SetResult(Data.Result); } } catch (object obj) { ex = (Exception)obj; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct readOpusFile@25-2 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public string filePath; public Mirage.Core.Task.Channel.Channel> channel; public ValueTaskAwaiter awaiter; public override void MoveNext() { //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex3 = default(Exception); Exception ex = default(Exception); try { bool flag2 = default(bool); bool flag = default(bool); switch (resumptionPoint) { default: flag = false; flag2 = false; ex = null; flag = flag || flag; break; case 1: break; } try { bool flag3; int num; bool flag4; switch (resumptionPoint) { default: awaiter = program@9(filePath, null).GetAwaiter(); flag3 = true; if (awaiter.IsCompleted) { break; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_008c; case 1: { num = 1; goto IL_008c; } IL_008c: flag4 = (byte)num != 0; flag3 = flag4; break; } int num2; if (flag3) { OpusReader result = awaiter.GetResult(); OpusReader opusReader = result; FSharpResult item = FSharpResult.NewOk(opusReader); ValueTask valueTask = channel.writer@.WriteAsync(item, channel.cancellationToken@); num2 = 1; } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } int num3; if (num2 != 0) { ValueTaskAwaiter valueTaskAwaiter = default(ValueTaskAwaiter); awaiter = valueTaskAwaiter; num3 = 1; } else { num3 = 0; } bool flag5 = (byte)num3 != 0; flag = flag5; } catch (object obj) { Exception ex2 = (Exception)obj; flag2 = true; ex = ex2; } int num4; if (flag2) { Exception ex2 = ex; FSharpResult item = FSharpResult.NewError(ex2); ValueTask valueTask = channel.writer@.WriteAsync(item, channel.cancellationToken@); num4 = 1; } else { num4 = (flag ? 1 : 0); } if (num4 != 0) { Data.MethodBuilder.SetResult(Data.Result); } } catch (object obj2) { ex = (Exception)obj2; ex3 = ex; } ex = ex3; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal sealed class readOpusFile@25-3 { public string filePath; [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public Mirage.Core.Task.Channel.Channel> channel; public readOpusFile@25-3(string filePath, Mirage.Core.Task.Channel.Channel> channel) { this.filePath = filePath; this.channel = channel; base..ctor(); } internal ValueTask Invoke() { return thread@12-2(filePath, channel, null); } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct readOpusFile@25-1 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public string filePath; public CancellationToken cancellationToken; public ValueTaskAwaiter> awaiter; public override void MoveNext() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex2 = default(Exception); Exception ex; try { bool flag; int num; bool flag2; switch (resumptionPoint) { default: { Mirage.Core.Task.Channel.Channel> channel = Mirage.Core.Task.Channel.Channel>(cancellationToken); Task> task = System.Threading.Tasks.Task.Run((Func>)new readOpusFile@25-3(filePath, channel).Invoke, cancellationToken); awaiter = channel.reader@.ReadAsync(channel.cancellationToken@).GetAwaiter(); flag = true; if (awaiter.IsCompleted) { break; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_009d; } case 1: { num = 1; goto IL_009d; } IL_009d: flag2 = (byte)num != 0; flag = flag2; break; } int num2; if (flag) { FSharpResult result = awaiter.GetResult(); FSharpResult val = result; if (val.Tag != 0) { throw val.ErrorValue; } OpusReader resultValue = val.ResultValue; Data.Result = resultValue; num2 = 1; } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } if (num2 != 0) { ValueTaskAwaiter> valueTaskAwaiter = default(ValueTaskAwaiter>); awaiter = valueTaskAwaiter; if (true) { Data.MethodBuilder.SetResult(Data.Result); } } } catch (object obj) { ex = (Exception)obj; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [CompilerGenerated] internal static ValueTask program@9(string filePath, Unit unitVar0) { readOpusFile@25 stateMachine = default(readOpusFile@25); stateMachine.filePath = filePath; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } [CompilerGenerated] internal static ValueTask thread@12-2(string filePath, Mirage.Core.Task.Channel.Channel> channel, Unit unitVar0) { readOpusFile@25-2 stateMachine = default(readOpusFile@25-2); stateMachine.filePath = filePath; stateMachine.channel = channel; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } public static ValueTask readOpusFile(string filePath) { CancellationToken none = CancellationToken.None; readOpusFile@25-1 stateMachine = default(readOpusFile@25-1); stateMachine.filePath = filePath; stateMachine.cancellationToken = none; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } } } namespace .$Mirage.Core.Audio.Opus { internal static class Reader { } } namespace Mirage.Core.Audio.Opus { [CompilationMapping(/*Could not decode attribute arguments.*/)] public static class Codec { [Literal] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public const int OpusBitRate = 24000; [Literal] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public const int OpusSampleRate = 48000; [Literal] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public const int OpusChannels = 1; [Literal] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public const int FrameSizeMs = 20; [Literal] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public const int SamplesPerPacket = 960; [Literal] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public const int PacketPcmLength = 1920; public static OpusDecoder OpusDecoder() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown return new OpusDecoder(20.0, 48000, 1); } public static OpusEncoder OpusEncoder() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown OpusEncoder val = new OpusEncoder(48000, 1, (OpusApplication)2049); val.UseVBR = true; val.Bitrate = 24000; val.UseConstrainedVBR = true; val.Complexity = 10; val.PredictionDisabled = true; val.UseDTX = false; return val; } } } namespace .$Mirage.Core.Audio.Opus { internal static class Codec { } } namespace Mirage.Core.Audio { [CompilationMapping(/*Could not decode attribute arguments.*/)] public static class PCM { [Serializable] [Struct] [CompilationMapping(/*Could not decode attribute arguments.*/)] public struct WaveFormat : IEquatable, IStructuralEquatable, IComparable, IComparable, IStructuralComparable { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal int sampleRate@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal int channels@; [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly int sampleRate { [CompilerGenerated] [DebuggerNonUserCode] get { return sampleRate@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly int channels { [CompilerGenerated] [DebuggerNonUserCode] get { return channels@; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(WaveFormat))] public WaveFormat(int sampleRate, int channels) { sampleRate@ = sampleRate; channels@ = channels; } [CompilerGenerated] public override string ToString() { return ExtraTopLevelOperators.PrintFormatToString>((PrintfFormat, Unit, string, string>)(object)new PrintfFormat, Unit, string, string, WaveFormat>("%+A")).Invoke(this); } [CompilerGenerated] public sealed int CompareTo(WaveFormat obj) { IComparer genericComparer = LanguagePrimitives.GenericComparer; int num = sampleRate@; int num2 = obj.sampleRate@; int num3 = ((num > num2) ? 1 : 0) - ((num < num2) ? 1 : 0); if (num3 < 0) { return num3; } if (num3 > 0) { return num3; } genericComparer = LanguagePrimitives.GenericComparer; num = channels@; num2 = obj.channels@; return ((num > num2) ? 1 : 0) - ((num < num2) ? 1 : 0); } [CompilerGenerated] public sealed int CompareTo(object obj) { return CompareTo((WaveFormat)obj); } [CompilerGenerated] public sealed int CompareTo(object obj, IComparer comp) { WaveFormat waveFormat = (WaveFormat)obj; int num = sampleRate@; int num2 = waveFormat.sampleRate@; int num3 = ((num > num2) ? 1 : 0) - ((num < num2) ? 1 : 0); if (num3 < 0) { return num3; } if (num3 > 0) { return num3; } num = channels@; num2 = waveFormat.channels@; return ((num > num2) ? 1 : 0) - ((num < num2) ? 1 : 0); } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { int num = 0; num = -1640531527 + (channels@ + ((num << 6) + (num >> 2))); return -1640531527 + (sampleRate@ + ((num << 6) + (num >> 2))); } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(WaveFormat obj, IEqualityComparer comp) { if (sampleRate@ == obj.sampleRate@) { return channels@ == obj.channels@; } return false; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is WaveFormat obj2) { return Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(WaveFormat obj) { if (sampleRate@ == obj.sampleRate@) { return channels@ == obj.channels@; } return false; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is WaveFormat) { return Equals((WaveFormat)obj); } return false; } } [Serializable] [Struct] [CompilationMapping(/*Could not decode attribute arguments.*/)] public struct PcmData : IEquatable, IStructuralEquatable, IComparable, IComparable, IStructuralComparable { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal byte[] data@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal int length@; [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly byte[] data { [CompilerGenerated] [DebuggerNonUserCode] get { return data@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly int length { [CompilerGenerated] [DebuggerNonUserCode] get { return length@; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(PcmData))] public PcmData(byte[] data, int length) { data@ = data; length@ = length; } [CompilerGenerated] public override string ToString() { return ExtraTopLevelOperators.PrintFormatToString>((PrintfFormat, Unit, string, string>)(object)new PrintfFormat, Unit, string, string, PcmData>("%+A")).Invoke(this); } [CompilerGenerated] public sealed int CompareTo(PcmData obj) { int num = HashCompare.GenericComparisonWithComparerIntrinsic(LanguagePrimitives.GenericComparer, data@, obj.data@); if (num < 0) { return num; } if (num > 0) { return num; } IComparer genericComparer = LanguagePrimitives.GenericComparer; int num2 = length@; int num3 = obj.length@; return ((num2 > num3) ? 1 : 0) - ((num2 < num3) ? 1 : 0); } [CompilerGenerated] public sealed int CompareTo(object obj) { return CompareTo((PcmData)obj); } [CompilerGenerated] public sealed int CompareTo(object obj, IComparer comp) { PcmData pcmData = (PcmData)obj; int num = HashCompare.GenericComparisonWithComparerIntrinsic(comp, data@, pcmData.data@); if (num < 0) { return num; } if (num > 0) { return num; } int num2 = length@; int num3 = pcmData.length@; return ((num2 > num3) ? 1 : 0) - ((num2 < num3) ? 1 : 0); } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { int num = 0; num = -1640531527 + (length@ + ((num << 6) + (num >> 2))); return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic(comp, data@) + ((num << 6) + (num >> 2))); } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(PcmData obj, IEqualityComparer comp) { if (HashCompare.GenericEqualityWithComparerIntrinsic(comp, data@, obj.data@)) { return length@ == obj.length@; } return false; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is PcmData obj2) { return Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(PcmData obj) { if (HashCompare.GenericEqualityERIntrinsic(data@, obj.data@)) { return length@ == obj.length@; } return false; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is PcmData) { return Equals((PcmData)obj); } return false; } } [Serializable] [Struct] [CompilationMapping(/*Could not decode attribute arguments.*/)] public struct Samples : IEquatable, IStructuralEquatable, IComparable, IComparable, IStructuralComparable { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal float[] data@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal int length@; [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly float[] data { [CompilerGenerated] [DebuggerNonUserCode] get { return data@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public readonly int length { [CompilerGenerated] [DebuggerNonUserCode] get { return length@; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(Samples))] public Samples(float[] data, int length) { data@ = data; length@ = length; } [CompilerGenerated] public override string ToString() { return ExtraTopLevelOperators.PrintFormatToString>((PrintfFormat, Unit, string, string>)(object)new PrintfFormat, Unit, string, string, Samples>("%+A")).Invoke(this); } [CompilerGenerated] public sealed int CompareTo(Samples obj) { int num = HashCompare.GenericComparisonWithComparerIntrinsic(LanguagePrimitives.GenericComparer, data@, obj.data@); if (num < 0) { return num; } if (num > 0) { return num; } IComparer genericComparer = LanguagePrimitives.GenericComparer; int num2 = length@; int num3 = obj.length@; return ((num2 > num3) ? 1 : 0) - ((num2 < num3) ? 1 : 0); } [CompilerGenerated] public sealed int CompareTo(object obj) { return CompareTo((Samples)obj); } [CompilerGenerated] public sealed int CompareTo(object obj, IComparer comp) { Samples samples = (Samples)obj; int num = HashCompare.GenericComparisonWithComparerIntrinsic(comp, data@, samples.data@); if (num < 0) { return num; } if (num > 0) { return num; } int num2 = length@; int num3 = samples.length@; return ((num2 > num3) ? 1 : 0) - ((num2 < num3) ? 1 : 0); } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { int num = 0; num = -1640531527 + (length@ + ((num << 6) + (num >> 2))); return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic(comp, data@) + ((num << 6) + (num >> 2))); } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(Samples obj, IEqualityComparer comp) { if (HashCompare.GenericEqualityWithComparerIntrinsic(comp, data@, obj.data@)) { return length@ == obj.length@; } return false; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is Samples obj2) { return Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(Samples obj) { if (HashCompare.GenericEqualityERIntrinsic(data@, obj.data@)) { return length@ == obj.length@; } return false; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is Samples) { return Equals((Samples)obj); } return false; } } [CompilationArgumentCounts(new int[] { 1, 1 })] public static int audioLengthMs(WaveFormat waveFormat, a sampleCount) { return (int)(LanguagePrimitives.ExplicitDynamic(sampleCount) / (double)waveFormat.sampleRate@ / (double)waveFormat.channels@ * 1000.0); } [CompilationArgumentCounts(new int[] { 1, 1 })] public static int audioLengthMs$W(FSharpFunc op_Explicit, WaveFormat waveFormat, a sampleCount) { return (int)(op_Explicit.Invoke(sampleCount) / (double)waveFormat.sampleRate@ / (double)waveFormat.channels@ * 1000.0); } public static PcmData toPcmData(Samples samples) { int num = samples.length@ * 2; byte[] array = ArrayPool.Shared.Rent(num); Array.Clear(array, 0, num); int num2 = 0; int num3 = 0; while (num2 < samples.length@) { short num4 = (short)(samples.data@[num2] * 32767f); array[num3] = (byte)((byte)num4 & 0xFF); int num5 = num3 + 1; byte b = (byte)num4; array[num5] = (byte)((byte)((uint)b >> 0) & 0xFF); num2++; num3 += 2; } return new PcmData(array, num); } public static Samples fromPcmData(PcmData pcmData) { int num = pcmData.length@ / 2; float[] array = ArrayPool.Shared.Rent(num); Array.Clear(array, 0, num); int num2 = 0; int num3 = 0; int num4 = num - 1; if (num4 >= num3) { do { short num5 = BitConverter.ToInt16(pcmData.data@, num3 * 2); array[num2] = (float)num5 / 32767f; num2++; num3++; } while (num3 != num4 + 1); } return new Samples(array, num); } } } namespace .$Mirage.Core.Audio { internal static class PCM { } } namespace Mirage.Core.Task { [CompilationMapping(/*Could not decode attribute arguments.*/)] public static class Loop { [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct forever@8 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public FSharpFunc> program; public ValueTaskAwaiter awaiter; public override void MoveNext() { int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex2 = default(Exception); Exception ex; try { bool flag; int num; bool flag2; bool flag3; int num2; int num3; bool flag4; switch (resumptionPoint) { default: flag = true; goto IL_00d5; case 1: { num = 1; goto IL_006f; } IL_00d5: if (flag ? true : false) { awaiter = program.Invoke((Unit)null).GetAwaiter(); flag2 = true; if (awaiter.IsCompleted) { goto IL_0079; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_006f; } if (flag) { Data.MethodBuilder.SetResult(Data.Result); } break; IL_006f: flag3 = (byte)num != 0; flag2 = flag3; goto IL_0079; IL_0079: if (flag2) { awaiter.GetResult(); _ = null; num2 = 1; } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } if (num2 != 0) { awaiter = default(ValueTaskAwaiter); num3 = 1; } else { num3 = 0; } flag4 = (byte)num3 != 0; flag = flag4; resumptionPoint = 0; goto IL_00d5; } } catch (object obj) { ex = (Exception)obj; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } public static ValueTask forever(FSharpFunc> program) { forever@8 stateMachine = default(forever@8); stateMachine.program = program; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } } } namespace .$Mirage.Core.Task { internal static class Loop { } } namespace Mirage.Core.Task { [CompilationMapping(/*Could not decode attribute arguments.*/)] public static class LVar { [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public sealed class LVar : IEquatable>, IStructuralEquatable, IDisposable { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal Lock.Lock lock@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal A value@; [CompilationMapping(/*Could not decode attribute arguments.*/)] internal Lock.Lock @lock { [CompilerGenerated] [DebuggerNonUserCode] get { return lock@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] internal A value { [CompilerGenerated] [DebuggerNonUserCode] get { return value@; } [CompilerGenerated] [DebuggerNonUserCode] set { value@ = value; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(LVar<>))] internal LVar(Lock.Lock @lock, A value) { lock@ = @lock; value@ = value; } [CompilerGenerated] public override string ToString() { return ((FSharpFunc>, string>)(object)ExtraTopLevelOperators.PrintFormatToString, string>>((PrintfFormat, string>, Unit, string, string>)(object)new PrintfFormat, string>>, string>, Unit, string, string, LVar, string>>>("%+A"))).Invoke((LVar>)(object)this); } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { if (this != null) { int num = 0; A val = value@; num = -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic(comp, val) + ((num << 6) + (num >> 2))); return -1640531527 + (lock@.GetHashCode(comp) + ((num << 6) + (num >> 2))); } return 0; } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(LVar obj, IEqualityComparer comp) { if (this != null) { if (obj != null) { Lock.Lock @lock = lock@; Lock.Lock obj2 = obj.lock@; if (@lock.Equals(obj2, comp)) { A val = value@; A val2 = obj.value@; return HashCompare.GenericEqualityWithComparerIntrinsic(comp, val, val2); } return false; } return false; } return obj == null; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is LVar obj2) { return Equals(obj2, comp); } return false; } virtual void IDisposable.Dispose() { Operators.dispose((IDisposable)lock@); } [CompilerGenerated] public sealed bool Equals(LVar obj) { if (this != null) { if (obj != null) { if (lock@.Equals(obj.lock@)) { A val = value@; A val2 = obj.value@; return HashCompare.GenericEqualityERIntrinsic(val, val2); } return false; } return false; } return obj == null; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is LVar obj2) { return Equals(obj2); } return false; } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct readLVar@27-1 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public LVar lvar; public override void MoveNext() { int resumptionPoint = ResumptionPoint; Exception ex2 = default(Exception); Exception ex; try { a value@ = lvar.value@; Data.Result = value@; if (true) { Data.MethodBuilder.SetResult(Data.Result); } } catch (object obj) { ex = (Exception)obj; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] internal sealed class readLVar@26 : FSharpFunc> { public LVar lvar; [CompilerGenerated] [DebuggerNonUserCode] internal readLVar@26(LVar lvar) { ((FSharpFunc>)(object)this)..ctor(); this.lvar = lvar; } public override ValueTask Invoke(Unit unitVar0) { readLVar@27-1 stateMachine = default(readLVar@27-1); stateMachine.lvar = lvar; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct writeLVar@34-1 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public LVar lvar; public a newValue; public override void MoveNext() { int resumptionPoint = ResumptionPoint; Exception ex2 = default(Exception); Exception ex; try { a value@ = lvar.value@; lvar.value = newValue; Data.Result = value@; if (true) { Data.MethodBuilder.SetResult(Data.Result); } } catch (object obj) { ex = (Exception)obj; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] internal sealed class writeLVar@33 : FSharpFunc> { public LVar lvar; public a newValue; [CompilerGenerated] [DebuggerNonUserCode] internal writeLVar@33(LVar lvar, a newValue) { ((FSharpFunc>)(object)this)..ctor(); this.lvar = lvar; this.newValue = newValue; } public override ValueTask Invoke(Unit unitVar0) { writeLVar@34-1 stateMachine = default(writeLVar@34-1); stateMachine.lvar = lvar; stateMachine.newValue = newValue; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } } [Serializable] internal sealed class writeLVar_@41 : FSharpFunc { internal static readonly writeLVar_@41 @_instance = new writeLVar_@41(); [CompilerGenerated] [DebuggerNonUserCode] internal writeLVar_@41() { } public override Unit Invoke(a _arg1) { return null; } } [Serializable] internal sealed class writeLVar_@41-1 : FSharpFunc, ValueTask> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public FSharpFunc f; [CompilerGenerated] [DebuggerNonUserCode] internal writeLVar_@41-1(FSharpFunc f) { ((FSharpFunc>, ValueTask>)(object)this)..ctor(); this.f = f; } public override ValueTask Invoke(ValueTask x) { Map val = null; ValueTask valueTask = default(ValueTask); ValueTask valueTask2 = valueTask; return Map.Map(new Tuple, FSharpFunc>(x, f), val); } } [Serializable] internal sealed class writeLVar_@41-2 : FSharpFunc> { public LVar lvar; [CompilerGenerated] [DebuggerNonUserCode] internal writeLVar_@41-2(LVar lvar) { this.lvar = lvar; } public override ValueTask Invoke(a newValue) { return writeLVar(lvar, newValue); } } [Serializable] internal sealed class writeLVar_@41-3 : FSharpFunc> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public FSharpFunc, ValueTask> func2; [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public FSharpFunc> func1; [CompilerGenerated] [DebuggerNonUserCode] internal writeLVar_@41-3(FSharpFunc, ValueTask> func2, FSharpFunc> func1) { this.func2 = func2; this.func1 = func1; } public override ValueTask Invoke(a x) { return ((FSharpFunc>, ValueTask>)(object)func2).Invoke((ValueTask>)func1.Invoke(x)); } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct accessLVar@45-1 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public LVar lvar; public FSharpFunc f; public override void MoveNext() { int resumptionPoint = ResumptionPoint; Exception ex2 = default(Exception); Exception ex; try { b result = f.Invoke(lvar.value@); Data.Result = result; if (true) { Data.MethodBuilder.SetResult(Data.Result); } } catch (object obj) { ex = (Exception)obj; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] internal sealed class accessLVar@44 : FSharpFunc> { public LVar lvar; public FSharpFunc f; [CompilerGenerated] [DebuggerNonUserCode] internal accessLVar@44(LVar lvar, FSharpFunc f) { ((FSharpFunc>>)(object)this)..ctor(); this.lvar = lvar; this.f = f; } public override ValueTask Invoke(Unit unitVar0) { accessLVar@45-1 stateMachine = default(accessLVar@45-1); stateMachine.lvar = lvar; stateMachine.f = f; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct modifyLVar@51-1 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public LVar lvar; public FSharpFunc f; public override void MoveNext() { int resumptionPoint = ResumptionPoint; Exception ex2 = default(Exception); Exception ex; try { lvar.value = f.Invoke(lvar.value@); if (true) { Data.MethodBuilder.SetResult(Data.Result); } } catch (object obj) { ex = (Exception)obj; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] internal sealed class modifyLVar@50 : FSharpFunc> { public LVar lvar; public FSharpFunc f; [CompilerGenerated] [DebuggerNonUserCode] internal modifyLVar@50(LVar lvar, FSharpFunc f) { this.lvar = lvar; this.f = f; } public override ValueTask Invoke(Unit unitVar0) { modifyLVar@51-1 stateMachine = default(modifyLVar@51-1); stateMachine.lvar = lvar; stateMachine.f = f; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } } public static LVar newLVar(a value) { return new LVar(new Lock.Lock(new SemaphoreSlim(1)), value); } public static ValueTask readLVar(LVar lvar) { return Lock.withLock(lvar.lock@, new readLVar@26(lvar)); } [CompilationArgumentCounts(new int[] { 1, 1 })] public static ValueTask writeLVar(LVar lvar, a newValue) { return Lock.withLock(lvar.lock@, new writeLVar@33(lvar, newValue)); } public static FSharpFunc> writeLVar_(LVar lvar) { FSharpFunc @_instance; @_instance = writeLVar_@41.@_instance; FSharpFunc, ValueTask> func = new writeLVar_@41-1(@_instance); FSharpFunc> func2 = new writeLVar_@41-2(lvar); return new writeLVar_@41-3(func, func2); } [CompilationArgumentCounts(new int[] { 1, 1 })] public static ValueTask accessLVar(LVar lvar, FSharpFunc f) { return Lock.withLock(lvar.lock@, new accessLVar@44(lvar, f)); } [CompilationArgumentCounts(new int[] { 1, 1 })] public static ValueTask modifyLVar(LVar lvar, FSharpFunc f) { return Lock.withLock(lvar.lock@, new modifyLVar@50(lvar, f)); } } } namespace .$Mirage.Core.Task { internal static class LVar { } } namespace Mirage.Core.Task { [CompilationMapping(/*Could not decode attribute arguments.*/)] public static class Lock { [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public sealed class Lock : IEquatable, IStructuralEquatable, IDisposable { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal SemaphoreSlim semaphore@; [CompilationMapping(/*Could not decode attribute arguments.*/)] public SemaphoreSlim semaphore { [CompilerGenerated] [DebuggerNonUserCode] get { return semaphore@; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(Lock))] public Lock(SemaphoreSlim semaphore) { semaphore@ = semaphore; } [CompilerGenerated] public override string ToString() { return ExtraTopLevelOperators.PrintFormatToString>((PrintfFormat, Unit, string, string>)(object)new PrintfFormat, Unit, string, string, Lock>("%+A")).Invoke(this); } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { if (this != null) { int num = 0; return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic(comp, semaphore@) + ((num << 6) + (num >> 2))); } return 0; } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(Lock obj, IEqualityComparer comp) { if (this != null) { if (obj != null) { return HashCompare.GenericEqualityWithComparerIntrinsic(comp, semaphore@, obj.semaphore@); } return false; } return obj == null; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is Lock obj2) { return Equals(obj2, comp); } return false; } virtual void IDisposable.Dispose() { Operators.dispose((IDisposable)semaphore@); } [CompilerGenerated] public sealed bool Equals(Lock obj) { if (this != null) { if (obj != null) { return HashCompare.GenericEqualityERIntrinsic(semaphore@, obj.semaphore@); } return false; } return obj == null; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is Lock obj2) { return Equals(obj2); } return false; } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct withLock@29 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public Lock @lock; public FSharpFunc> program; public TaskAwaiter awaiter; public ValueTaskAwaiter awaiter0; public override void MoveNext() { int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex2 = default(Exception); Exception ex; try { bool flag; int num; int num2; ICriticalNotifyCompletion criticalNotifyCompletion; bool flag2; switch (resumptionPoint) { default: awaiter = @lock.semaphore@.WaitAsync().GetAwaiter(); flag = true; if (awaiter.IsCompleted) { goto IL_007e; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_0075; case 1: num = 1; goto IL_0075; case 2: { try { bool flag3; int num3; bool flag4; switch (resumptionPoint) { default: awaiter0 = ((FSharpFunc>)(object)program).Invoke((Unit)null).GetAwaiter(); flag3 = true; if (awaiter0.IsCompleted) { break; } if (false) { goto case 2; } ResumptionPoint = 2; num3 = 0; goto IL_00f1; case 2: { num3 = 1; goto IL_00f1; } IL_00f1: flag4 = (byte)num3 != 0; flag3 = flag4; break; } int num4; if (flag3) { A result = awaiter0.GetResult(); A result2 = result; Data.Result = result2; num4 = 1; } else { criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter0; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num4 = 0; } int num5; if (num4 != 0) { ValueTaskAwaiter valueTaskAwaiter = default(ValueTaskAwaiter); awaiter0 = valueTaskAwaiter; num5 = 1; } else { num5 = 0; } bool flag5 = (byte)num5 != 0; flag2 = flag5; } catch (object obj) { ex = (Exception)obj; int num6 = @lock.semaphore@.Release(); bool flag5 = true; throw; } if (flag2) { int num6 = @lock.semaphore@.Release(); bool flag5 = true; } num2 = (flag2 ? 1 : 0); break; } IL_007e: if (flag) { awaiter.GetResult(); _ = null; flag2 = false; flag2 = flag2 || flag2; goto case 2; } criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; break; IL_0075: flag2 = (byte)num != 0; flag = flag2; goto IL_007e; } if (num2 != 0) { TaskAwaiter taskAwaiter = default(TaskAwaiter); awaiter = taskAwaiter; if (true) { Data.MethodBuilder.SetResult(Data.Result); } } } catch (object obj2) { ex = (Exception)obj2; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } public static Lock createLock() { return new Lock(new SemaphoreSlim(1)); } public static System.Threading.Tasks.Task lockAcquire(Lock @lock) { return @lock.semaphore@.WaitAsync(); } public static void lockRelease(Lock @lock) { int num = @lock.semaphore@.Release(); } public static bool tryAcquire(Lock @lock) { return @lock.semaphore@.Wait(TimeSpan.Zero); } [CompilationArgumentCounts(new int[] { 1, 1 })] public static ValueTask withLock(Lock @lock, FSharpFunc> program) { withLock@29 stateMachine = default(withLock@29); stateMachine.@lock = @lock; stateMachine.program = program; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } } } namespace .$Mirage.Core.Task { internal static class Lock { } } namespace Mirage.Core.Task { [CompilationMapping(/*Could not decode attribute arguments.*/)] public static class Fork { [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct thread@13-1 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public FSharpFunc> program; public Channel.Channel> channel; public ValueTaskAwaiter awaiter; public override void MoveNext() { //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00c0: Unknown result type (might be due to invalid IL or missing references) int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex3 = default(Exception); Exception ex = default(Exception); try { bool flag2 = default(bool); bool flag = default(bool); switch (resumptionPoint) { default: flag = false; flag2 = false; ex = null; flag = flag || flag; break; case 1: break; } try { bool flag3; int num; bool flag4; switch (resumptionPoint) { default: awaiter = ((FSharpFunc>)(object)program).Invoke((Unit)null).GetAwaiter(); flag3 = true; if (awaiter.IsCompleted) { break; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_008d; case 1: { num = 1; goto IL_008d; } IL_008d: flag4 = (byte)num != 0; flag3 = flag4; break; } int num2; if (flag3) { A result = awaiter.GetResult(); A val = result; FSharpResult item = FSharpResult.NewOk(val); ValueTask valueTask = channel.writer@.WriteAsync(item, channel.cancellationToken@); num2 = 1; } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } int num3; if (num2 != 0) { ValueTaskAwaiter valueTaskAwaiter = default(ValueTaskAwaiter); awaiter = valueTaskAwaiter; num3 = 1; } else { num3 = 0; } bool flag5 = (byte)num3 != 0; flag = flag5; } catch (object obj) { Exception ex2 = (Exception)obj; flag2 = true; ex = ex2; } int num4; if (flag2) { Exception ex2 = ex; FSharpResult item = FSharpResult.NewError(ex2); ValueTask valueTask = channel.writer@.WriteAsync(item, channel.cancellationToken@); num4 = 1; } else { num4 = (flag ? 1 : 0); } if (num4 != 0) { Data.MethodBuilder.SetResult(Data.Result); } } catch (object obj2) { ex = (Exception)obj2; ex3 = ex; } ex = ex3; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] internal sealed class thread@13 : FSharpFunc> { public FSharpFunc> program; public Channel.Channel> channel; [CompilerGenerated] [DebuggerNonUserCode] internal thread@13(FSharpFunc> program, Channel.Channel> channel) { this.program = program; this.channel = channel; } public override ValueTask Invoke(Unit unitVar0) { thread@13-1 stateMachine = default(thread@13-1); stateMachine.program = program; stateMachine.channel = channel; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } } [Serializable] [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal sealed class forkReturn@20-1 { public FSharpFunc> thread; public forkReturn@20-1(FSharpFunc> thread) { this.thread = thread; base..ctor(); } internal ValueTask Invoke() { return thread.Invoke((Unit)null); } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct forkReturn@10 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public CancellationToken cancellationToken; public FSharpFunc> program; public ValueTaskAwaiter> awaiter; public override void MoveNext() { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex = default(Exception); Exception errorValue; try { bool flag; int num; bool flag2; switch (resumptionPoint) { default: { Channel.Channel> channel = Channel.Channel>(cancellationToken); FSharpFunc> thread = new thread@13(program, channel); Task> task = System.Threading.Tasks.Task.Run((Func>)new forkReturn@20-1(thread).Invoke, cancellationToken); awaiter = channel.reader@.ReadAsync(channel.cancellationToken@).GetAwaiter(); flag = true; if (awaiter.IsCompleted) { break; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_00a6; } case 1: { num = 1; goto IL_00a6; } IL_00a6: flag2 = (byte)num != 0; flag = flag2; break; } int num2; if (flag) { FSharpResult result = awaiter.GetResult(); FSharpResult val = result; if (val.Tag != 0) { errorValue = val.ErrorValue; throw errorValue; } A resultValue = val.ResultValue; A result2 = resultValue; Data.Result = result2; num2 = 1; } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } if (num2 != 0) { ValueTaskAwaiter> valueTaskAwaiter = default(ValueTaskAwaiter>); awaiter = valueTaskAwaiter; if (true) { Data.MethodBuilder.SetResult(Data.Result); } } } catch (object obj) { errorValue = (Exception)obj; ex = errorValue; } errorValue = ex; if (errorValue != null) { Data.MethodBuilder.SetException(errorValue); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] internal sealed class fork@30 : FSharpFunc, Unit> { internal static readonly fork@30 @_instance = new fork@30(); [CompilerGenerated] [DebuggerNonUserCode] internal fork@30() { ((FSharpFunc>, Unit>)(object)this)..ctor(); } public override Unit Invoke(ValueTask _arg1) { return null; } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct fork@30-4 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public FSharpFunc> program; public Channel.Channel> channel; public ValueTaskAwaiter awaiter; public override void MoveNext() { //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex3 = default(Exception); Exception ex = default(Exception); try { bool flag2 = default(bool); bool flag = default(bool); switch (resumptionPoint) { default: flag = false; flag2 = false; ex = null; flag = flag || flag; break; case 1: break; } try { bool flag3; int num; bool flag4; switch (resumptionPoint) { default: awaiter = ((FSharpFunc>)(object)program).Invoke((Unit)null).GetAwaiter(); flag3 = true; if (awaiter.IsCompleted) { break; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_008c; case 1: { num = 1; goto IL_008c; } IL_008c: flag4 = (byte)num != 0; flag3 = flag4; break; } int num2; if (flag3) { a result = awaiter.GetResult(); a val = result; FSharpResult item = FSharpResult.NewOk(val); ValueTask valueTask = channel.writer@.WriteAsync(item, channel.cancellationToken@); num2 = 1; } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } int num3; if (num2 != 0) { ValueTaskAwaiter valueTaskAwaiter = default(ValueTaskAwaiter); awaiter = valueTaskAwaiter; num3 = 1; } else { num3 = 0; } bool flag5 = (byte)num3 != 0; flag = flag5; } catch (object obj) { Exception ex2 = (Exception)obj; flag2 = true; ex = ex2; } int num4; if (flag2) { Exception ex2 = ex; FSharpResult item = FSharpResult.NewError(ex2); ValueTask valueTask = channel.writer@.WriteAsync(item, channel.cancellationToken@); num4 = 1; } else { num4 = (flag ? 1 : 0); } if (num4 != 0) { Data.MethodBuilder.SetResult(Data.Result); } } catch (object obj2) { ex = (Exception)obj2; ex3 = ex; } ex = ex3; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] internal sealed class fork@30-3 : FSharpFunc> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public FSharpFunc> program; [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public Channel.Channel> channel; [CompilerGenerated] [DebuggerNonUserCode] internal fork@30-3(FSharpFunc> program, Channel.Channel> channel) { this.program = program; this.channel = channel; } public override ValueTask Invoke(Unit unitVar0) { fork@30-4 stateMachine = default(fork@30-4); stateMachine.program = program; stateMachine.channel = channel; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } } [Serializable] [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal sealed class fork@30-5 { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public FSharpFunc> thread; public fork@30-5(FSharpFunc> thread) { this.thread = thread; base..ctor(); } internal ValueTask Invoke() { return thread.Invoke((Unit)null); } } [SpecialName] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [CompilerGenerated] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal struct fork@30-2 : IAsyncStateMachine, IResumableStateMachine>> { public TaskBaseStateMachineData> Data; public int ResumptionPoint; public CancellationToken cancellationToken; public FSharpFunc> program; public ValueTaskAwaiter> awaiter; public override void MoveNext() { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) int resumptionPoint = ResumptionPoint; switch (resumptionPoint) { } Exception ex2 = default(Exception); Exception ex; try { bool flag; int num; bool flag2; switch (resumptionPoint) { default: { Channel.Channel> channel = Channel.Channel>(cancellationToken); FSharpFunc> thread = new fork@30-3(program, channel); Task> task = System.Threading.Tasks.Task.Run((Func>)new fork@30-5(thread).Invoke, cancellationToken); awaiter = channel.reader@.ReadAsync(channel.cancellationToken@).GetAwaiter(); flag = true; if (awaiter.IsCompleted) { break; } if (false) { goto case 1; } ResumptionPoint = 1; num = 0; goto IL_00a6; } case 1: { num = 1; goto IL_00a6; } IL_00a6: flag2 = (byte)num != 0; flag = flag2; break; } int num2; if (flag) { FSharpResult result = awaiter.GetResult(); FSharpResult val = result; if (val.Tag != 0) { throw val.ErrorValue; } a resultValue = val.ResultValue; Data.Result = resultValue; num2 = 1; } else { ICriticalNotifyCompletion criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter; Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this); num2 = 0; } if (num2 != 0) { ValueTaskAwaiter> valueTaskAwaiter = default(ValueTaskAwaiter>); awaiter = valueTaskAwaiter; if (true) { Data.MethodBuilder.SetResult(Data.Result); } } } catch (object obj) { ex = (Exception)obj; ex2 = ex; } ex = ex2; if (ex != null) { Data.MethodBuilder.SetException(ex); } } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } public override void SetStateMachine(IAsyncStateMachine state) { Data.MethodBuilder.SetStateMachine(state); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(state); } public override int get_ResumptionPoint() { return ResumptionPoint; } public override TaskBaseStateMachineData> get_Data() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Data; } public override void set_Data(TaskBaseStateMachineData> value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Data = value; } } [Serializable] internal sealed class fork@30-1 : FSharpFunc>, ValueTask> { public CancellationToken cancellationToken; [CompilerGenerated] [DebuggerNonUserCode] internal fork@30-1(CancellationToken cancellationToken) { ((FSharpFunc>>>, ValueTask>>>)(object)this)..ctor(); this.cancellationToken = cancellationToken; } public override ValueTask Invoke(FSharpFunc> program) { fork@30-2 stateMachine = default(fork@30-2); stateMachine.cancellationToken = cancellationToken; stateMachine.program = program; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } } [Serializable] internal sealed class fork@30-6 : FSharpFunc>, Unit> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public FSharpFunc, Unit> func2; [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] public FSharpFunc>, ValueTask> func1; [CompilerGenerated] [DebuggerNonUserCode] internal fork@30-6(FSharpFunc, Unit> func2, FSharpFunc>, ValueTask> func1) { ((FSharpFunc>>>, Unit>)(object)this)..ctor(); this.func2 = func2; this.func1 = func1; } public override Unit Invoke(FSharpFunc> x) { return ((FSharpFunc>, Unit>)(object)func2).Invoke((ValueTask>)((FSharpFunc>>>, ValueTask>>>)(object)func1).Invoke((FSharpFunc>>>)(object)x)); } } [CompilationArgumentCounts(new int[] { 1, 1 })] public static ValueTask forkReturn(CancellationToken cancellationToken, FSharpFunc> program) { forkReturn@10 stateMachine = default(forkReturn@10); stateMachine.cancellationToken = cancellationToken; stateMachine.program = program; stateMachine.Data.MethodBuilder = AsyncValueTaskMethodBuilder.Create(); stateMachine.Data.MethodBuilder.Start(ref stateMachine); return stateMachine.Data.MethodBuilder.Task; } public static FSharpFunc>, Unit> fork(CancellationToken cancellationToken) { FSharpFunc, Unit> @_instance; @_instance = fork@30.@_instance; FSharpFunc>, ValueTask> func = new fork@30-1(cancellationToken); return new fork@30-6(@_instance, func); } } } namespace .$Mirage.Core.Task { internal static class Fork { } } namespace Mirage.Core.Task { [CompilationMapping(/*Could not decode attribute arguments.*/)] public static class Channel { [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public sealed class Channel : IEquatable>, IStructuralEquatable { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal ChannelWriter writer@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal ChannelReader reader@; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal CancellationToken cancellationToken@; [CompilationMapping(/*Could not decode attribute arguments.*/)] public ChannelWriter writer { [CompilerGenerated] [DebuggerNonUserCode] get { return writer@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public ChannelReader reader { [CompilerGenerated] [DebuggerNonUserCode] get { return reader@; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public CancellationToken cancellationToken { [CompilerGenerated] [DebuggerNonUserCode] get { return cancellationToken@; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(Channel<>))] public Channel(ChannelWriter writer, ChannelReader reader, CancellationToken cancellationToken) { writer@ = writer; reader@ = reader; cancellationToken@ = cancellationToken; } [CompilerGenerated] public override string ToString() { return ((FSharpFunc>, string>)(object)ExtraTopLevelOperators.PrintFormatToString, string>>((PrintfFormat, string>, Unit, string, string>)(object)new PrintfFormat, string>>, string>, Unit, string, string, Channel, string>>>("%+A"))).Invoke((Channel>)(object)this); } [CompilerGenerated] public sealed int GetHashCode(IEqualityComparer comp) { if (this != null) { int num = 0; num = -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic(comp, cancellationToken@) + ((num << 6) + (num >> 2))); num = -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic>(comp, reader@) + ((num << 6) + (num >> 2))); return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic>(comp, writer@) + ((num << 6) + (num >> 2))); } return 0; } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public bool Equals(Channel obj, IEqualityComparer comp) { if (this != null) { if (obj != null) { if (HashCompare.GenericEqualityWithComparerIntrinsic>(comp, writer@, obj.writer@)) { if (HashCompare.GenericEqualityWithComparerIntrinsic>(comp, reader@, obj.reader@)) { return HashCompare.GenericEqualityWithComparerIntrinsic(comp, cancellationToken@, obj.cancellationToken@); } return false; } return false; } return false; } return obj == null; } [CompilerGenerated] public sealed bool Equals(object obj, IEqualityComparer comp) { if (obj is Channel obj2) { return Equals(obj2, comp); } return false; } [CompilerGenerated] public sealed bool Equals(Channel obj) { if (this != null) { if (obj != null) { if (HashCompare.GenericEqualityERIntrinsic>(writer@, obj.writer@)) { if (HashCompare.GenericEqualityERIntrinsic>(reader@, obj.reader@)) { return HashCompare.GenericEqualityERIntrinsic(cancellationToken@, obj.cancellationToken@); } return false; } return false; } return false; } return obj == null; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is Channel obj2) { return Equals(obj2); } return false; } } public static Channel Channel(CancellationToken cancellationToken) { System.Threading.Channels.Channel channel = System.Threading.Channels.Channel.CreateUnbounded(); return new Channel(channel.Writer, channel.Reader, cancellationToken); } [CompilationArgumentCounts(new int[] { 1, 1 })] public static void writeChannel(Channel channel, a element) { ValueTask valueTask = channel.writer@.WriteAsync(element, channel.cancellationToken@); } public static ValueTask readChannel(Channel channel) { return channel.reader@.ReadAsync(channel.cancellationToken@); } } } namespace .$Mirage.Core.Task { internal static class Channel { } } namespace Mirage.Core { [CompilationMapping(/*Could not decode attribute arguments.*/)] public static class Pooled { [CompilationArgumentCounts(new int[] { 1, 1, 1 })] public static void copyFrom(PooledList pooledList, A[] destination, int count) { int num = 0; int num2 = count - 1; if (num2 >= num) { do { destination[num] = pooledList[num]; num++; } while (num != num2 + 1); } } [CompilationArgumentCounts(new int[] { 1, 1 })] public static void appendSegment(PooledList pooledList, ArraySegment segment) { int num = 0; int num2 = segment.Count - 1; if (num2 >= num) { do { pooledList.Add(segment[num]); num++; } while (num != num2 + 1); } } } } namespace .$Mirage.Core { internal static class Pooled { } } namespace Mirage.Prelude { [AutoOpen] [CompilationMapping(/*Could not decode attribute arguments.*/)] public static class Operator { [SpecialName] [CompilationArgumentCounts(new int[] { 1, 1 })] public static void op_AdditionAssignment(ref A source, A value) { A val = source; source = LanguagePrimitives.AdditionDynamic(val, value); } [SpecialName] [CompilationArgumentCounts(new int[] { 1, 1 })] public static void op_AdditionAssignment$W(FSharpFunc> op_Addition, ref A source, A value) { A val = source; source = FSharpFunc.InvokeFast(op_Addition, val, value); } [SpecialName] [CompilationArgumentCounts(new int[] { 1, 1 })] public static void op_SubtractionAssignment(ref A source, A value) { A val = source; source = LanguagePrimitives.SubtractionDynamic(val, value); } [SpecialName] [CompilationArgumentCounts(new int[] { 1, 1 })] public static void op_SubtractionAssignment$W(FSharpFunc> op_Subtraction, ref A source, A value) { A val = source; source = FSharpFunc.InvokeFast(op_Subtraction, val, value); } [SpecialName] [CompilationArgumentCounts(new int[] { 1, 1 })] public static void op_MultiplyAssignment(ref A source, A value) { A val = source; source = LanguagePrimitives.MultiplyDynamic(val, value); } [SpecialName] [CompilationArgumentCounts(new int[] { 1, 1 })] public static void op_MultiplyAssignment$W(FSharpFunc> op_Multiply, ref A source, A value) { A val = source; source = FSharpFunc.InvokeFast(op_Multiply, val, value); } [SpecialName] [CompilationArgumentCounts(new int[] { 1, 1 })] public static void op_DivisionAssignment(ref A source, A value) { A val = source; source = LanguagePrimitives.DivisionDynamic(val, value); } [SpecialName] [CompilationArgumentCounts(new int[] { 1, 1 })] public static void op_DivisionAssignment$W(FSharpFunc> op_Division, ref A source, A value) { A val = source; source = FSharpFunc.InvokeFast(op_Division, val, value); } [SpecialName] [CompilationArgumentCounts(new int[] { 1, 1 })] public static void op_PercentEquals(ref A source, FSharpFunc modify) { source = modify.Invoke(source); } } } namespace { internal static class $Operator { } } namespace .$.NETStandard,Version=v2.1 { internal static class AssemblyAttributes { } } namespace .$Mirage { internal static class AssemblyInfo { } } namespace System.Diagnostics.CodeAnalysis { [Serializable] [Flags] [CompilerGenerated] [DebuggerNonUserCode] internal enum DynamicallyAccessedMemberTypes { All = -1, None = 0, PublicParameterlessConstructor = 1, PublicConstructors = 3, NonPublicConstructors = 4, PublicMethods = 8, NonPublicMethods = 0x10, PublicFields = 0x20, NonPublicFields = 0x40, PublicNestedTypes = 0x80, NonPublicNestedTypes = 0x100, PublicProperties = 0x200, NonPublicProperties = 0x400, PublicEvents = 0x800, NonPublicEvents = 0x1000, Interfaces = 0x2000 } [CompilerGenerated] internal class DynamicDependencyAttribute : Attribute { [CompilerGenerated] [DebuggerNonUserCode] private DynamicallyAccessedMemberTypes MemberType@; [CompilerGenerated] [DebuggerNonUserCode] private Type Type@; [CompilerGenerated] [DebuggerNonUserCode] public DynamicallyAccessedMemberTypes MemberType { [CompilerGenerated] [DebuggerNonUserCode] get { return MemberType@; } } [CompilerGenerated] [DebuggerNonUserCode] public Type Type { [CompilerGenerated] [DebuggerNonUserCode] get { return Type@; } } [CompilerGenerated] [DebuggerNonUserCode] public DynamicDependencyAttribute(DynamicallyAccessedMemberTypes MemberType, Type Type) { MemberType@ = MemberType; Type@ = Type; } } }