示例#1
0
        protected override void ProcessingStopped()
        {
            _running = false;
            _thread?.Join();

            _seekWindow?.Close();
            _seekWindow?.Dispose();
            _reader.Dispose();
            _reader     = null;
            _seekWindow = null;
        }
示例#2
0
        public override bool PrepareProcessing()
        {
            if (!File.Exists(FileName))
            {
                NodeSystemSettings.Instance.SystemHost.ReportError(this, $"File not found: {FileName}");
                return(false);
            }

            try {
                _reader = new Stream1DReader(
                    new BinaryReader(
                        File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read)
                        )
                    );
            } catch (Exception e) {
                NodeSystemSettings.Instance.SystemHost.ReportError(this, $"Could not open {FileName}. Unknown exception: {e}");
                return(false);
            }

            if (_buffer == null || _buffer.Samplerate != Samplerate)
            {
                _buffer = new TimeLocatedBuffer(NodeSystemSettings.Instance.SystemHost.GetDefaultBufferSize(Samplerate), Samplerate);
            }

            _stateBag = new List <StateEntry>();

            _buffer.ResetTime();
            _fileTargetPosition = 0;

            if (NodeSystemSettings.Instance.SystemHost.DockPanelInstance != null)
            {
                _seekWindow                 = new FileNodeWindow();
                _seekWindow.Max             = _reader.SampleCount;
                _seekWindow.Min             = 0;
                _seekWindow.Value           = 0;
                _seekWindow.ValueBackground = 0;
            }

            _servedLookup = new List <bool>(Enumerable.Range(0, _portOut.Connections.Count).Select(i => false));

            return(true);
        }