Beispiel #1
0
        public Operation SetSinkVolume(UInt32 index, Volume vol, OperationSuccessCallback cb)
        {
            int cookie = cbManager.NewCookie();
            Action <IntPtr, int, IntPtr> wrapped_cb = (IntPtr context, int success, IntPtr userdata) => {
                cb(success);
            };

            cbManager.AddDelegate(wrapped_cb, cookie);
            try {
                return(new Operation(pa_context_set_sink_volume_by_index(context,
                                                                         index,
                                                                         vol,
                                                                         wrapped_cb,
                                                                         IntPtr.Zero)));
            } catch (ArgumentNullException) {
                throw new Exception(String.Format("Error setting sink volume: {0}", LastError.Message));
            }
        }
Beispiel #2
0
        public Operation MoveSinkInputByIndex(UInt32 sinkInputIndex, UInt32 sinkIndex, OperationSuccessCallback cb)
        {
            int cookie = cbManager.NewCookie();
            Action <IntPtr, int, IntPtr> wrapped_cb = (IntPtr context, int success, IntPtr userdata) => {
                cb(success);
                cbManager.RemoveDelegate(cookie);
            };

            cbManager.AddDelegate(wrapped_cb, cookie);
            try {
                return(new Operation(pa_context_move_sink_input_by_index(context,
                                                                         sinkInputIndex,
                                                                         sinkIndex,
                                                                         wrapped_cb,
                                                                         IntPtr.Zero)));
            } catch (ArgumentNullException) {
                throw new Exception(String.Format("Error moving SinkInput {0} to sink {1}: {2}", sinkInputIndex, sinkIndex, LastError.Message));
            }
        }