コード例 #1
0
ファイル: Receiver.cs プロジェクト: MrMahgu/KlakSpout
        public void Dispose()
        {
            if (_plugin != IntPtr.Zero)
            {
                // Isssue the closer event to destroy the plugin object from the
                // render thread.
                _event.IssuePluginEvent(EventID.CloseReceiver);

                // Event kicker (interop memory) deallocation:
                // The close event above will refer to the block from the render
                // thread, so we actually can't free the memory here. To avoid this
                // problem, EventKicker uses MemoryPool to delay the memory
                // deallocation by the end of the frame.
                _event.Dispose();

                _plugin = IntPtr.Zero;
            }

            Utility.Destroy(_texture);
            _texture = null;
        }
コード例 #2
0
        public Sender(string target, Texture texture)
        {
            // Plugin object allocation
            _plugin = Plugin.CreateSender(target, texture.width, texture.height);
            if (_plugin == IntPtr.Zero)
            {
                return;
            }

            // Event kicker (heap block for interop communication)
            _event = new EventKicker
                         (new EventData(_plugin, texture.GetNativeTexturePtr()));

            // Initial update event
            _event.IssuePluginEvent(EventID.UpdateSender);
        }
コード例 #3
0
ファイル: Receiver.cs プロジェクト: MrMahgu/KlakSpout
        public Receiver(string sourceName)
        {
            if (string.IsNullOrEmpty(sourceName))
            {
                return;
            }

            // Plugin object allocation
            _plugin = Plugin.CreateReceiver(sourceName);
            if (_plugin == IntPtr.Zero)
            {
                return;
            }

            // Event kicker (heap block for interop communication)
            _event = new EventKicker(new EventData(_plugin));

            // Initial update event
            _event.IssuePluginEvent(EventID.UpdateReceiver);
        }
コード例 #4
0
 public void Update()
 => _event?.IssuePluginEvent(EventID.UpdateSender);