Beispiel #1
0
        internal Operation GetSinkInfoByIndex(UInt32 index, SinkInfoCallback cb)
        {
            int cookie = cbManager.NewCookie();
            Action <IntPtr, SinkInfo, int, IntPtr> wrapped_cb = (IntPtr c, SinkInfo info, int eol, IntPtr userdata) => {
                cb(info, eol);
            };

            cbManager.AddDelegate(wrapped_cb, cookie);
            try {
                return(new Operation(pa_context_get_sink_info_by_index(context, index, wrapped_cb, IntPtr.Zero)));
            } catch (ArgumentNullException) {
                throw new Exception(String.Format("Error getting SinkInfo for index {0}: {1}", index, LastError.Message));
            }
        }
Beispiel #2
0
        internal Operation EnumerateSinks(SinkInfoCallback cb)
        {
            int cookie = cbManager.NewCookie();
            Action <IntPtr, SinkInfo, int, IntPtr> wrapped_cb = (IntPtr c, SinkInfo info, int eol, IntPtr userdata) => {
                cb(info, eol);
                if (eol != 0)
                {
                    cbManager.RemoveDelegate(cookie);
                }
            };

            cbManager.AddDelegate(wrapped_cb, cookie);
            try {
                return(new Operation(pa_context_get_sink_info_list(context, wrapped_cb, IntPtr.Zero)));
            } catch (ArgumentNullException) {
                throw new Exception(String.Format("Error enumerating sinks: {0}", LastError.Message));
            }
        }