// Method to marshal from native to managed struct
        internal unsafe void __MarshalFrom(ref __Native @ref)
        {
            this.Size = @ref.Size;
            this.Flags = @ref.Flags;
            this.BufferBytes = @ref.BufferBytes;
            this.Reserved = @ref.Reserved;
            this.Format = WaveFormat.MarshalFrom(@ref.FormatPointer);
            this.EffectCount = @ref.EffectCount;
            if (EffectCount > 0)
            {
                var nativeDescriptions = new CaptureEffectDescription.__Native[EffectCount];
                Utilities.Read(@ref.EffectDescriptionPointer, nativeDescriptions, 0, EffectCount);

                EffectDescriptions = new CaptureEffectDescription[EffectCount];
                for (int i = 0; i < EffectCount; i++)
                {
                    EffectDescriptions[i] = new CaptureEffectDescription();
                    EffectDescriptions[i].__MarshalFrom(ref nativeDescriptions[i]);
                }
            }
        }
        // Method to marshal from managed struct tot native
        internal unsafe void __MarshalTo(ref __Native @ref)
        {
            @ref.Size = this.Size;
            @ref.Flags = this.Flags;
            @ref.BufferBytes = this.BufferBytes;
            @ref.Reserved = this.Reserved;
            @ref.FormatPointer = WaveFormat.MarshalToPtr(this.Format);

            int effectCount = EffectDescriptions == null ? 0 : EffectDescriptions.Length;
            @ref.EffectCount = effectCount;
            if (effectCount > 0)
            {
                var nativeDescriptions = new CaptureEffectDescription.__Native[effectCount];
                for(int i = 0; i < effectCount; i++)
                {
                    nativeDescriptions[i] = CaptureEffectDescription.__NewNative();
                    EffectDescriptions[i].__MarshalTo(ref nativeDescriptions[i]);
                }

                @ref.EffectDescriptionPointer =  Marshal.AllocHGlobal(effectCount*Utilities.SizeOf<CaptureEffectDescription.__Native>());
                Utilities.Write(@ref.EffectDescriptionPointer, nativeDescriptions, 0, effectCount);
            }
        }