Beispiel #1
0
        public XtAudio(string id, IntPtr window, XtTraceCallback trace, XtFatalCallback fatal)
        {
            XtAudio.trace      = trace;
            XtAudio.win32Trace = trace == null ? null : new XtNative.TraceCallbackWin32(trace);
            XtAudio.linuxTrace = trace == null ? null : new XtNative.TraceCallbackLinux(trace);
            XtAudio.fatal      = fatal;
            XtAudio.win32Fatal = fatal == null ? null : new XtNative.FatalCallbackWin32(fatal);
            XtAudio.linuxFatal = fatal == null ? null : new XtNative.FatalCallbackLinux(fatal);
            Delegate traceDelegate = Environment.OSVersion.Platform == PlatformID.Win32NT ? (Delegate)win32Trace : linuxTrace;
            Delegate fatalDelegate = Environment.OSVersion.Platform == PlatformID.Win32NT ? (Delegate)win32Fatal : linuxFatal;
            IntPtr   tracePtr      = trace == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(traceDelegate);
            IntPtr   fatalPtr      = fatal == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(fatalDelegate);

            using (XtNative.Utf8Buffer buffer = new XtNative.Utf8Buffer(id))
                XtNative.XtAudioInit(buffer.ptr, window, tracePtr, fatalPtr);
        }