protected virtual void Dispose(bool disposing) { ReleaseUnmanagedResources(); if (disposing) { if (WorkBytesEvent != null) { WorkBytesEvent.Dispose(); } if (OrigBytesEvent != null) { OrigBytesEvent.Dispose(); } if (DelayBytesEvent != null) { DelayBytesEvent.Dispose(); } if (WorkEnergyEvent != null) { WorkEnergyEvent.Dispose(); } if (FreqWaveEvent != null) { FreqWaveEvent.Dispose(); } if (OrigThread != null) { OrigThread.Abort(); if (OrigThread.ThreadState != ThreadState.Aborted) { Thread.Sleep(100); } } if (DelayThread != null) { DelayThread.Abort(); } if (WorkThread != null) { WorkThread.Abort(); if (WorkThread.ThreadState != ThreadState.Aborted) { Thread.Sleep(100); } } if (EnergyThread != null) { EnergyThread.Abort(); } if (FreqThread != null) { FreqThread.Abort(); } } }
/// <summary> /// 线程处理函数:延时数据处理 /// </summary> void ThreadDelayWaveStart() { while (true) { DelayBytesEvent.WaitOne(); var r = new byte[2]; for (int i = 0; i < DelayWaveBytes.Length; i++) { for (int j = 0; j < (DelayWaveBytes[0].Length / 2); j++) { r[0] = DelayWaveBytes[i][j * 2 + 1]; r[1] = DelayWaveBytes[i][j * 2 + 0]; short a = BitConverter.ToInt16(r, 0); DelayWaveFloats[i][j] = a / 8192.0f; // OrigWave_Floats[i][j] = a / 104800.0f; } } DelayGraphEventHandler(null, DelayWaveFloats); } }