コード例 #1
0
ファイル: Out123.cs プロジェクト: fdefelici/aiv-mpg123
        public Out123.Format GetFormat()
        {
            IntPtr rate      = Marshal.AllocHGlobal(Marshal.SizeOf <IntPtr>());
            IntPtr channels  = Marshal.AllocHGlobal(Marshal.SizeOf <IntPtr>());
            IntPtr encoding  = Marshal.AllocHGlobal(Marshal.SizeOf <IntPtr>());
            IntPtr framesize = Marshal.AllocHGlobal(Marshal.SizeOf <IntPtr>());

            Out123.Errors error = Out123NativeMethods.GetFormat(handle, rate, channels, encoding, framesize);
            if (error != Out123.Errors.OK)
            {
                Marshal.FreeHGlobal(rate);
                Marshal.FreeHGlobal(channels);
                Marshal.FreeHGlobal(encoding);
                Marshal.FreeHGlobal(framesize);
                throw new Out123.ErrorException(this);
            }

            Out123.Format result = new Out123.Format(rate.ToInt64(), channels.ToInt32(), encoding.ToInt32(), framesize.ToInt32());
            Marshal.FreeHGlobal(rate);
            Marshal.FreeHGlobal(channels);
            Marshal.FreeHGlobal(encoding);
            Marshal.FreeHGlobal(framesize);
            return(result);
        }