Esempio n. 1
0
        void CompleteInitialization()
        {
            Contract.Ensures(_dspState != IntPtr.Zero);
            Contract.Ensures(_block != IntPtr.Zero);

            _dspState = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(VorbisDspState)));
            if (SafeNativeMethods.VorbisAnalysisInitialize(_dspState, _info) != Result.Ok)
            {
                throw new IOException(Resources.NativeVorbisEncoderAnalysisInitialize);
            }

            _block = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(VorbisBlock)));
            if (SafeNativeMethods.VorbisBlockInitialize(_dspState, _block) != Result.Ok)
            {
                throw new IOException(Resources.NativeVorbisEncoderBlockInitialize);
            }
        }